/// <summary> /// Retrieves all of the Pools on a particular Network Domain at an MCP 2.0 data center. /// </summary> /// <param name="options">The filter options</param> /// <param name="pagingOptions"> The paging Options.</param> /// <returns>The async task of <see cref="PagedResponse{PoolType}"/></returns> public async Task <PagedResponse <PoolType> > GetPoolsPaginated(PoolListOptions options = null, PageableRequest pagingOptions = null) { var response = await _api.GetAsync <pools>(ApiUris.GetPools(_api.OrganizationId), pagingOptions, options); return(new PagedResponse <PoolType> { items = response.pool, totalCount = response.totalCountSpecified ? response.totalCount : (int?)null, pageCount = response.pageCountSpecified ? response.pageCount : (int?)null, pageNumber = response.pageNumberSpecified ? response.pageNumber : (int?)null, pageSize = response.pageSizeSpecified ? response.pageSize : (int?)null }); }
public virtual Pageable <CloudPool> List(PoolListOptions poolListOptions, CancellationToken cancellationToken = default) { Page <CloudPool> FirstPageFunc(int?pageSizeHint) { var response = RestClient.List(poolListOptions, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } Page <CloudPool> NextPageFunc(string nextLink, int?pageSizeHint) { var response = RestClient.ListNextPage(nextLink, poolListOptions, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }
public virtual AsyncPageable <CloudPool> ListAsync(PoolListOptions poolListOptions, CancellationToken cancellationToken = default) { async Task <Page <CloudPool> > FirstPageFunc(int?pageSizeHint) { var response = await RestClient.ListAsync(poolListOptions, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } async Task <Page <CloudPool> > NextPageFunc(string nextLink, int?pageSizeHint) { var response = await RestClient.ListNextPageAsync(nextLink, poolListOptions, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }
/// <summary> /// Lists all of the Pools in the specified Account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='poolListOptions'> /// Additional parameters for the operation /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <CloudPool> > ListAsync(this IPoolOperations operations, PoolListOptions poolListOptions = default(PoolListOptions), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(poolListOptions, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Lists all of the Pools in the specified Account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='poolListOptions'> /// Additional parameters for the operation /// </param> public static IPage <CloudPool> List(this IPoolOperations operations, PoolListOptions poolListOptions = default(PoolListOptions)) { return(operations.ListAsync(poolListOptions).GetAwaiter().GetResult()); }
/// <summary> /// Retrieves all of the Pools on a particular Network Domain at an MCP 2.0 data center. /// </summary> /// <param name="options">The filter options</param> /// <returns>The async task of collection of <see cref="PoolType"/></returns> public async Task <IEnumerable <PoolType> > GetPools(PoolListOptions options = null) { var response = await GetPoolsPaginated(options, null); return(response.items); }
/// <summary> /// Lists all of the pools in the specified account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='poolListOptions'> /// Additional parameters for the operation /// </param> public static Microsoft.Rest.Azure.IPage <CloudPool> List(this IPoolOperations operations, PoolListOptions poolListOptions = default(PoolListOptions)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IPoolOperations)s).ListAsync(poolListOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }