Пример #1
0
        public virtual Pageable <ComputeNode> List(string poolId, ComputeNodeListOptions computeNodeListOptions, CancellationToken cancellationToken = default)
        {
            if (poolId == null)
            {
                throw new ArgumentNullException(nameof(poolId));
            }

            Page <ComputeNode> FirstPageFunc(int?pageSizeHint)
            {
                var response = RestClient.List(poolId, computeNodeListOptions, cancellationToken);

                return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse()));
            }

            Page <ComputeNode> NextPageFunc(string nextLink, int?pageSizeHint)
            {
                var response = RestClient.ListNextPage(nextLink, poolId, computeNodeListOptions, cancellationToken);

                return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse()));
            }

            return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc));
        }
Пример #2
0
        public virtual AsyncPageable <ComputeNode> ListAsync(string poolId, ComputeNodeListOptions computeNodeListOptions, CancellationToken cancellationToken = default)
        {
            if (poolId == null)
            {
                throw new ArgumentNullException(nameof(poolId));
            }

            async Task <Page <ComputeNode> > FirstPageFunc(int?pageSizeHint)
            {
                var response = await RestClient.ListAsync(poolId, computeNodeListOptions, cancellationToken).ConfigureAwait(false);

                return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse()));
            }

            async Task <Page <ComputeNode> > NextPageFunc(string nextLink, int?pageSizeHint)
            {
                var response = await RestClient.ListNextPageAsync(nextLink, poolId, computeNodeListOptions, cancellationToken).ConfigureAwait(false);

                return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse()));
            }

            return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc));
        }
 /// <summary>
 /// Lists the compute nodes in the specified pool.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The ID of the pool from which you want to list nodes.
 /// </param>
 /// <param name='computeNodeListOptions'>
 /// Additional parameters for the operation
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IPage <ComputeNode> > ListAsync(this IComputeNodeOperations operations, string poolId, ComputeNodeListOptions computeNodeListOptions = default(ComputeNodeListOptions), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(poolId, computeNodeListOptions, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Lists the compute nodes in the specified pool.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The ID of the pool from which you want to list nodes.
 /// </param>
 /// <param name='computeNodeListOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static IPage <ComputeNode> List(this IComputeNodeOperations operations, string poolId, ComputeNodeListOptions computeNodeListOptions = default(ComputeNodeListOptions))
 {
     return(operations.ListAsync(poolId, computeNodeListOptions).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Lists the compute nodes in the specified pool.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='poolId'>
 /// The id of the pool from which you want to list nodes.
 /// </param>
 /// <param name='computeNodeListOptions'>
 /// Additional parameters for the operation
 /// </param>
 public static Microsoft.Rest.Azure.IPage <ComputeNode> List(this IComputeNodeOperations operations, string poolId, ComputeNodeListOptions computeNodeListOptions = default(ComputeNodeListOptions))
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IComputeNodeOperations)s).ListAsync(poolId, computeNodeListOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }