com.microsoft.azure.batch.protocol.implementation.PoolsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-batch Show documentation
Show all versions of azure-batch Show documentation
This package contains the root module of Microsoft Azure Batch SDK.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.batch.protocol.implementation;
import retrofit2.Retrofit;
import com.microsoft.azure.batch.protocol.Pools;
import com.google.common.base.Joiner;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.batch.protocol.models.AutoScaleRun;
import com.microsoft.azure.batch.protocol.models.BatchErrorException;
import com.microsoft.azure.batch.protocol.models.CloudPool;
import com.microsoft.azure.batch.protocol.models.NodeRemoveParameter;
import com.microsoft.azure.batch.protocol.models.PageImpl;
import com.microsoft.azure.batch.protocol.models.PoolAddHeaders;
import com.microsoft.azure.batch.protocol.models.PoolAddOptions;
import com.microsoft.azure.batch.protocol.models.PoolAddParameter;
import com.microsoft.azure.batch.protocol.models.PoolDeleteHeaders;
import com.microsoft.azure.batch.protocol.models.PoolDeleteOptions;
import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleHeaders;
import com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleOptions;
import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleHeaders;
import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleOptions;
import com.microsoft.azure.batch.protocol.models.PoolEnableAutoScaleParameter;
import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleHeaders;
import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions;
import com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleParameter;
import com.microsoft.azure.batch.protocol.models.PoolExistsHeaders;
import com.microsoft.azure.batch.protocol.models.PoolExistsOptions;
import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsHeaders;
import com.microsoft.azure.batch.protocol.models.PoolGetAllLifetimeStatisticsOptions;
import com.microsoft.azure.batch.protocol.models.PoolGetHeaders;
import com.microsoft.azure.batch.protocol.models.PoolGetOptions;
import com.microsoft.azure.batch.protocol.models.PoolListHeaders;
import com.microsoft.azure.batch.protocol.models.PoolListNextOptions;
import com.microsoft.azure.batch.protocol.models.PoolListOptions;
import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsHeaders;
import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsNextOptions;
import com.microsoft.azure.batch.protocol.models.PoolListUsageMetricsOptions;
import com.microsoft.azure.batch.protocol.models.PoolPatchHeaders;
import com.microsoft.azure.batch.protocol.models.PoolPatchOptions;
import com.microsoft.azure.batch.protocol.models.PoolPatchParameter;
import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesHeaders;
import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesOptions;
import com.microsoft.azure.batch.protocol.models.PoolResizeHeaders;
import com.microsoft.azure.batch.protocol.models.PoolResizeOptions;
import com.microsoft.azure.batch.protocol.models.PoolResizeParameter;
import com.microsoft.azure.batch.protocol.models.PoolStatistics;
import com.microsoft.azure.batch.protocol.models.PoolStopResizeHeaders;
import com.microsoft.azure.batch.protocol.models.PoolStopResizeOptions;
import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesHeaders;
import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesOptions;
import com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesParameter;
import com.microsoft.azure.batch.protocol.models.PoolUsageMetrics;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.DateTimeRfc1123;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponseWithHeaders;
import com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import okhttp3.ResponseBody;
import org.joda.time.DateTime;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.HEAD;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.PATCH;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in Pools.
*/
public class PoolsImpl implements Pools {
/** The Retrofit service to perform REST calls. */
private PoolsService service;
/** The service client containing this operation class. */
private BatchServiceClientImpl client;
/**
* Initializes an instance of PoolsImpl.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public PoolsImpl(Retrofit retrofit, BatchServiceClientImpl client) {
this.service = retrofit.create(PoolsService.class);
this.client = client;
}
/**
* The interface defining all the services for Pools to be
* used by Retrofit to perform actually REST calls.
*/
interface PoolsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listUsageMetrics" })
@GET("poolusagemetrics")
Observable> listUsageMetrics(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("starttime") DateTime startTime, @Query("endtime") DateTime endTime, @Query("$filter") String filter, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools getAllLifetimeStatistics" })
@GET("lifetimepoolstats")
Observable> getAllLifetimeStatistics(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools add" })
@POST("pools")
Observable> add(@Body PoolAddParameter pool, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools list" })
@GET("pools")
Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$filter") String filter, @Query("$select") String select, @Query("$expand") String expand, @Query("maxresults") Integer maxResults, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools delete" })
@HTTP(path = "pools/{poolId}", method = "DELETE", hasBody = true)
Observable> delete(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools exists" })
@HEAD("pools/{poolId}")
Observable> exists(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools get" })
@GET("pools/{poolId}")
Observable> get(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$select") String select, @Query("$expand") String expand, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools patch" })
@PATCH("pools/{poolId}")
Observable> patch(@Path("poolId") String poolId, @Body PoolPatchParameter poolPatchParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools disableAutoScale" })
@POST("pools/{poolId}/disableautoscale")
Observable> disableAutoScale(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools enableAutoScale" })
@POST("pools/{poolId}/enableautoscale")
Observable> enableAutoScale(@Path("poolId") String poolId, @Body PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools evaluateAutoScale" })
@POST("pools/{poolId}/evaluateautoscale")
Observable> evaluateAutoScale(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Body PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools resize" })
@POST("pools/{poolId}/resize")
Observable> resize(@Path("poolId") String poolId, @Body PoolResizeParameter poolResizeParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools stopResize" })
@POST("pools/{poolId}/stopresize")
Observable> stopResize(@Path("poolId") String poolId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools updateProperties" })
@POST("pools/{poolId}/updateproperties")
Observable> updateProperties(@Path("poolId") String poolId, @Body PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; odata=minimalmetadata; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools removeNodes" })
@POST("pools/{poolId}/removenodes")
Observable> removeNodes(@Path("poolId") String poolId, @Body NodeRemoveParameter nodeRemoveParameter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("timeout") Integer timeout, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("If-Match") String ifMatch, @Header("If-None-Match") String ifNoneMatch, @Header("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @Header("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listUsageMetricsNext" })
@GET
Observable> listUsageMetricsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.batch.protocol.Pools listNext" })
@GET
Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("client-request-id") UUID clientRequestId, @Header("return-client-request-id") Boolean returnClientRequestId, @Header("ocp-date") DateTimeRfc1123 ocpDate, @Header("User-Agent") String userAgent);
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PoolUsageMetrics> object if successful.
*/
public PagedList listUsageMetrics() {
ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync().toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listUsageMetricsNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture> listUsageMetricsAsync(final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listUsageMetricsSinglePageAsync(),
new Func1, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) {
return listUsageMetricsNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PoolUsageMetrics> object
*/
public Observable> listUsageMetricsAsync() {
return listUsageMetricsWithServiceResponseAsync()
.map(new Func1, PoolListUsageMetricsHeaders>, Page>() {
@Override
public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) {
return response.body();
}
});
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PoolUsageMetrics> object
*/
public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync() {
return listUsageMetricsSinglePageAsync()
.concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, null));
}
});
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/
public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsSinglePageAsync() {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolListUsageMetricsOptions poolListUsageMetricsOptions = null;
DateTime startTime = null;
DateTime endTime = null;
String filter = null;
Integer maxResults = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.listUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(Response response) {
try {
ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsDelegate(response);
return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @param poolListUsageMetricsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<PoolUsageMetrics> object if successful.
*/
public PagedList listUsageMetrics(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null;
if (poolListUsageMetricsOptions != null) {
poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions();
poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId());
poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId());
poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate());
}
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body();
}
};
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @param poolListUsageMetricsOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions),
new Func1, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(String nextPageLink) {
PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null;
if (poolListUsageMetricsOptions != null) {
poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions();
poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId());
poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId());
poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate());
}
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions);
}
},
serviceCallback);
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @param poolListUsageMetricsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PoolUsageMetrics> object
*/
public Observable> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
return listUsageMetricsWithServiceResponseAsync(poolListUsageMetricsOptions)
.map(new Func1, PoolListUsageMetricsHeaders>, Page>() {
@Override
public Page call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> response) {
return response.body();
}
});
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
* @param poolListUsageMetricsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<PoolUsageMetrics> object
*/
public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsWithServiceResponseAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
return listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions)
.concatMap(new Func1, PoolListUsageMetricsHeaders>, Observable, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null;
if (poolListUsageMetricsOptions != null) {
poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions();
poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId());
poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId());
poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate());
}
return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions));
}
});
}
/**
* Lists the usage metrics, aggregated by Pool across individual time intervals, for the specified Account.
* If you do not specify a $filter clause including a poolId, the response includes all Pools that existed in the Account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
*
ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> * @param poolListUsageMetricsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<PoolUsageMetrics> object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/
public Observable, PoolListUsageMetricsHeaders>> listUsageMetricsSinglePageAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolListUsageMetricsOptions);
DateTime startTime = null;
if (poolListUsageMetricsOptions != null) {
startTime = poolListUsageMetricsOptions.startTime();
}
DateTime endTime = null;
if (poolListUsageMetricsOptions != null) {
endTime = poolListUsageMetricsOptions.endTime();
}
String filter = null;
if (poolListUsageMetricsOptions != null) {
filter = poolListUsageMetricsOptions.filter();
}
Integer maxResults = null;
if (poolListUsageMetricsOptions != null) {
maxResults = poolListUsageMetricsOptions.maxResults();
}
Integer timeout = null;
if (poolListUsageMetricsOptions != null) {
timeout = poolListUsageMetricsOptions.timeout();
}
UUID clientRequestId = null;
if (poolListUsageMetricsOptions != null) {
clientRequestId = poolListUsageMetricsOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolListUsageMetricsOptions != null) {
returnClientRequestId = poolListUsageMetricsOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolListUsageMetricsOptions != null) {
ocpDate = poolListUsageMetricsOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.listUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable, PoolListUsageMetricsHeaders>> call(Response response) {
try {
ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> result = listUsageMetricsDelegate(response);
return Observable.just(new ServiceResponseWithHeaders, PoolListUsageMetricsHeaders>(result.body(), result.headers(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders, PoolListUsageMetricsHeaders> listUsageMetricsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, PoolListUsageMetricsHeaders.class);
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PoolStatistics object if successful.
*/
public PoolStatistics getAllLifetimeStatistics() {
return getAllLifetimeStatisticsWithServiceResponseAsync().toBlocking().single().body();
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture getAllLifetimeStatisticsAsync(final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(), serviceCallback);
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PoolStatistics object
*/
public Observable getAllLifetimeStatisticsAsync() {
return getAllLifetimeStatisticsWithServiceResponseAsync().map(new Func1, PoolStatistics>() {
@Override
public PoolStatistics call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PoolStatistics object
*/
public Observable> getAllLifetimeStatisticsWithServiceResponseAsync() {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PoolStatistics object if successful.
*/
public PoolStatistics getAllLifetimeStatistics(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) {
return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).toBlocking().single().body();
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions), serviceCallback);
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PoolStatistics object
*/
public Observable getAllLifetimeStatisticsAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) {
return getAllLifetimeStatisticsWithServiceResponseAsync(poolGetAllLifetimeStatisticsOptions).map(new Func1, PoolStatistics>() {
@Override
public PoolStatistics call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets lifetime summary statistics for all of the Pools in the specified Account.
* Statistics are aggregated across all Pools that have ever existed in the Account, from Account creation to the last update time of the statistics. The statistics may not be immediately available. The Batch service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
*
* @param poolGetAllLifetimeStatisticsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PoolStatistics object
*/
public Observable> getAllLifetimeStatisticsWithServiceResponseAsync(PoolGetAllLifetimeStatisticsOptions poolGetAllLifetimeStatisticsOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolGetAllLifetimeStatisticsOptions);
Integer timeout = null;
if (poolGetAllLifetimeStatisticsOptions != null) {
timeout = poolGetAllLifetimeStatisticsOptions.timeout();
}
UUID clientRequestId = null;
if (poolGetAllLifetimeStatisticsOptions != null) {
clientRequestId = poolGetAllLifetimeStatisticsOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolGetAllLifetimeStatisticsOptions != null) {
returnClientRequestId = poolGetAllLifetimeStatisticsOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolGetAllLifetimeStatisticsOptions != null) {
ocpDate = poolGetAllLifetimeStatisticsOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.getAllLifetimeStatistics(this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = getAllLifetimeStatisticsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders getAllLifetimeStatisticsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, PoolGetAllLifetimeStatisticsHeaders.class);
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void add(PoolAddParameter pool) {
addWithServiceResponseAsync(pool).toBlocking().single().body();
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture addAsync(PoolAddParameter pool, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(pool), serviceCallback);
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable addAsync(PoolAddParameter pool) {
return addWithServiceResponseAsync(pool).map(new Func1, Void>() {
@Override
public Void call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable> addWithServiceResponseAsync(PoolAddParameter pool) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (pool == null) {
throw new IllegalArgumentException("Parameter pool is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(pool);
final PoolAddOptions poolAddOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.add(pool, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = addDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @param poolAddOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void add(PoolAddParameter pool, PoolAddOptions poolAddOptions) {
addWithServiceResponseAsync(pool, poolAddOptions).toBlocking().single().body();
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @param poolAddOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(addWithServiceResponseAsync(pool, poolAddOptions), serviceCallback);
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @param poolAddOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) {
return addWithServiceResponseAsync(pool, poolAddOptions).map(new Func1, Void>() {
@Override
public Void call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Adds a Pool to the specified Account.
* When naming Pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers.
*
* @param pool The Pool to be added.
* @param poolAddOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable> addWithServiceResponseAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (pool == null) {
throw new IllegalArgumentException("Parameter pool is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(pool);
Validator.validate(poolAddOptions);
Integer timeout = null;
if (poolAddOptions != null) {
timeout = poolAddOptions.timeout();
}
UUID clientRequestId = null;
if (poolAddOptions != null) {
clientRequestId = poolAddOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolAddOptions != null) {
returnClientRequestId = poolAddOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolAddOptions != null) {
ocpDate = poolAddOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.add(pool, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = addDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders addDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(201, new TypeToken() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, PoolAddHeaders.class);
}
/**
* Lists all of the Pools in the specified Account.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<CloudPool> object if successful.
*/
public PagedList list() {
ServiceResponseWithHeaders, PoolListHeaders> response = listSinglePageAsync().toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
}
/**
* Lists all of the Pools in the specified Account.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(),
new Func1, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
}
/**
* Lists all of the Pools in the specified Account.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<CloudPool> object
*/
public Observable> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1, PoolListHeaders>, Page>() {
@Override
public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) {
return response.body();
}
});
}
/**
* Lists all of the Pools in the specified Account.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<CloudPool> object
*/
public Observable, PoolListHeaders>> listWithServiceResponseAsync() {
return listSinglePageAsync()
.concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, null));
}
});
}
/**
* Lists all of the Pools in the specified Account.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/
public Observable, PoolListHeaders>> listSinglePageAsync() {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolListOptions poolListOptions = null;
String filter = null;
String select = null;
String expand = null;
Integer maxResults = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(Response response) {
try {
ServiceResponseWithHeaders, PoolListHeaders> result = listDelegate(response);
return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Lists all of the Pools in the specified Account.
*
* @param poolListOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<CloudPool> object if successful.
*/
public PagedList list(final PoolListOptions poolListOptions) {
ServiceResponseWithHeaders, PoolListHeaders> response = listSinglePageAsync(poolListOptions).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
PoolListNextOptions poolListNextOptions = null;
if (poolListOptions != null) {
poolListNextOptions = new PoolListNextOptions();
poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId());
poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId());
poolListNextOptions.withOcpDate(poolListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, poolListNextOptions).toBlocking().single().body();
}
};
}
/**
* Lists all of the Pools in the specified Account.
*
* @param poolListOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture> listAsync(final PoolListOptions poolListOptions, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(poolListOptions),
new Func1, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(String nextPageLink) {
PoolListNextOptions poolListNextOptions = null;
if (poolListOptions != null) {
poolListNextOptions = new PoolListNextOptions();
poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId());
poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId());
poolListNextOptions.withOcpDate(poolListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, poolListNextOptions);
}
},
serviceCallback);
}
/**
* Lists all of the Pools in the specified Account.
*
* @param poolListOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<CloudPool> object
*/
public Observable> listAsync(final PoolListOptions poolListOptions) {
return listWithServiceResponseAsync(poolListOptions)
.map(new Func1, PoolListHeaders>, Page>() {
@Override
public Page call(ServiceResponseWithHeaders, PoolListHeaders> response) {
return response.body();
}
});
}
/**
* Lists all of the Pools in the specified Account.
*
* @param poolListOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<CloudPool> object
*/
public Observable, PoolListHeaders>> listWithServiceResponseAsync(final PoolListOptions poolListOptions) {
return listSinglePageAsync(poolListOptions)
.concatMap(new Func1, PoolListHeaders>, Observable, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(ServiceResponseWithHeaders, PoolListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
PoolListNextOptions poolListNextOptions = null;
if (poolListOptions != null) {
poolListNextOptions = new PoolListNextOptions();
poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId());
poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId());
poolListNextOptions.withOcpDate(poolListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, poolListNextOptions));
}
});
}
/**
* Lists all of the Pools in the specified Account.
*
ServiceResponseWithHeaders, PoolListHeaders> * @param poolListOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<CloudPool> object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/
public Observable, PoolListHeaders>> listSinglePageAsync(final PoolListOptions poolListOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolListOptions);
String filter = null;
if (poolListOptions != null) {
filter = poolListOptions.filter();
}
String select = null;
if (poolListOptions != null) {
select = poolListOptions.select();
}
String expand = null;
if (poolListOptions != null) {
expand = poolListOptions.expand();
}
Integer maxResults = null;
if (poolListOptions != null) {
maxResults = poolListOptions.maxResults();
}
Integer timeout = null;
if (poolListOptions != null) {
timeout = poolListOptions.timeout();
}
UUID clientRequestId = null;
if (poolListOptions != null) {
clientRequestId = poolListOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolListOptions != null) {
returnClientRequestId = poolListOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolListOptions != null) {
ocpDate = poolListOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable, PoolListHeaders>>>() {
@Override
public Observable, PoolListHeaders>> call(Response response) {
try {
ServiceResponseWithHeaders, PoolListHeaders> result = listDelegate(response);
return Observable.just(new ServiceResponseWithHeaders, PoolListHeaders>(result.body(), result.headers(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders, PoolListHeaders> listDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., BatchErrorException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, PoolListHeaders.class);
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void delete(String poolId) {
deleteWithServiceResponseAsync(poolId).toBlocking().single().body();
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture deleteAsync(String poolId, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(poolId), serviceCallback);
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable deleteAsync(String poolId) {
return deleteWithServiceResponseAsync(poolId).map(new Func1, Void>() {
@Override
public Void call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable> deleteWithServiceResponseAsync(String poolId) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolDeleteOptions poolDeleteOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String ifMatch = null;
String ifNoneMatch = null;
DateTime ifModifiedSince = null;
DateTime ifUnmodifiedSince = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.delete(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @param poolDeleteOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void delete(String poolId, PoolDeleteOptions poolDeleteOptions) {
deleteWithServiceResponseAsync(poolId, poolDeleteOptions).toBlocking().single().body();
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @param poolDeleteOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture deleteAsync(String poolId, PoolDeleteOptions poolDeleteOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(deleteWithServiceResponseAsync(poolId, poolDeleteOptions), serviceCallback);
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @param poolDeleteOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable deleteAsync(String poolId, PoolDeleteOptions poolDeleteOptions) {
return deleteWithServiceResponseAsync(poolId, poolDeleteOptions).map(new Func1, Void>() {
@Override
public Void call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Deletes a Pool from the specified Account.
* When you request that a Pool be deleted, the following actions occur: the Pool state is set to deleting; any ongoing resize operation on the Pool are stopped; the Batch service starts resizing the Pool to zero Compute Nodes; any Tasks running on existing Compute Nodes are terminated and requeued (as if a resize Pool operation had been requested with the default requeue option); finally, the Pool is removed from the system. Because running Tasks are requeued, the user can rerun these Tasks by updating their Job to target a different Pool. The Tasks can then run on the new Pool. If you want to override the requeue behavior, then you should call resize Pool explicitly to shrink the Pool to zero size before deleting the Pool. If you call an Update, Patch or Delete API on a Pool in the deleting state, it will fail with HTTP status code 409 with error code PoolBeingDeleted.
*
* @param poolId The ID of the Pool to delete.
* @param poolDeleteOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public Observable> deleteWithServiceResponseAsync(String poolId, PoolDeleteOptions poolDeleteOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolDeleteOptions);
Integer timeout = null;
if (poolDeleteOptions != null) {
timeout = poolDeleteOptions.timeout();
}
UUID clientRequestId = null;
if (poolDeleteOptions != null) {
clientRequestId = poolDeleteOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolDeleteOptions != null) {
returnClientRequestId = poolDeleteOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolDeleteOptions != null) {
ocpDate = poolDeleteOptions.ocpDate();
}
String ifMatch = null;
if (poolDeleteOptions != null) {
ifMatch = poolDeleteOptions.ifMatch();
}
String ifNoneMatch = null;
if (poolDeleteOptions != null) {
ifNoneMatch = poolDeleteOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (poolDeleteOptions != null) {
ifModifiedSince = poolDeleteOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (poolDeleteOptions != null) {
ifUnmodifiedSince = poolDeleteOptions.ifUnmodifiedSince();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.delete(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders deleteDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(202, new TypeToken() { }.getType())
.registerError(BatchErrorException.class)
.buildWithHeaders(response, PoolDeleteHeaders.class);
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the boolean object if successful.
*/
public boolean exists(String poolId) {
return existsWithServiceResponseAsync(poolId).toBlocking().single().body();
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture existsAsync(String poolId, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(poolId), serviceCallback);
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the Boolean object
*/
public Observable existsAsync(String poolId) {
return existsWithServiceResponseAsync(poolId).map(new Func1, Boolean>() {
@Override
public Boolean call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the Boolean object
*/
public Observable> existsWithServiceResponseAsync(String poolId) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolExistsOptions poolExistsOptions = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String ifMatch = null;
String ifNoneMatch = null;
DateTime ifModifiedSince = null;
DateTime ifUnmodifiedSince = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.exists(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = existsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolExistsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the boolean object if successful.
*/
public boolean exists(String poolId, PoolExistsOptions poolExistsOptions) {
return existsWithServiceResponseAsync(poolId, poolExistsOptions).toBlocking().single().body();
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolExistsOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture existsAsync(String poolId, PoolExistsOptions poolExistsOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(existsWithServiceResponseAsync(poolId, poolExistsOptions), serviceCallback);
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolExistsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the Boolean object
*/
public Observable existsAsync(String poolId, PoolExistsOptions poolExistsOptions) {
return existsWithServiceResponseAsync(poolId, poolExistsOptions).map(new Func1, Boolean>() {
@Override
public Boolean call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets basic properties of a Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolExistsOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the Boolean object
*/
public Observable> existsWithServiceResponseAsync(String poolId, PoolExistsOptions poolExistsOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolExistsOptions);
Integer timeout = null;
if (poolExistsOptions != null) {
timeout = poolExistsOptions.timeout();
}
UUID clientRequestId = null;
if (poolExistsOptions != null) {
clientRequestId = poolExistsOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolExistsOptions != null) {
returnClientRequestId = poolExistsOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolExistsOptions != null) {
ocpDate = poolExistsOptions.ocpDate();
}
String ifMatch = null;
if (poolExistsOptions != null) {
ifMatch = poolExistsOptions.ifMatch();
}
String ifNoneMatch = null;
if (poolExistsOptions != null) {
ifNoneMatch = poolExistsOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (poolExistsOptions != null) {
ifModifiedSince = poolExistsOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (poolExistsOptions != null) {
ifUnmodifiedSince = poolExistsOptions.ifUnmodifiedSince();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.exists(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = existsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponseWithHeaders existsDelegate(Response response) throws BatchErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.register(404, new TypeToken() { }.getType())
.registerError(BatchErrorException.class)
.buildEmptyWithHeaders(response, PoolExistsHeaders.class);
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the CloudPool object if successful.
*/
public CloudPool get(String poolId) {
return getWithServiceResponseAsync(poolId).toBlocking().single().body();
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture getAsync(String poolId, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId), serviceCallback);
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CloudPool object
*/
public Observable getAsync(String poolId) {
return getWithServiceResponseAsync(poolId).map(new Func1, CloudPool>() {
@Override
public CloudPool call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CloudPool object
*/
public Observable> getWithServiceResponseAsync(String poolId) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final PoolGetOptions poolGetOptions = null;
String select = null;
String expand = null;
Integer timeout = null;
UUID clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String ifMatch = null;
String ifNoneMatch = null;
DateTime ifModifiedSince = null;
DateTime ifUnmodifiedSince = null;
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.get(poolId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponseWithHeaders clientResponse = getDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolGetOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws BatchErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the CloudPool object if successful.
*/
public CloudPool get(String poolId, PoolGetOptions poolGetOptions) {
return getWithServiceResponseAsync(poolId, poolGetOptions).toBlocking().single().body();
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolGetOptions Additional parameters for the operation
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture getAsync(String poolId, PoolGetOptions poolGetOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromHeaderResponse(getWithServiceResponseAsync(poolId, poolGetOptions), serviceCallback);
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolGetOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CloudPool object
*/
public Observable getAsync(String poolId, PoolGetOptions poolGetOptions) {
return getWithServiceResponseAsync(poolId, poolGetOptions).map(new Func1, CloudPool>() {
@Override
public CloudPool call(ServiceResponseWithHeaders response) {
return response.body();
}
});
}
/**
* Gets information about the specified Pool.
*
* @param poolId The ID of the Pool to get.
* @param poolGetOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CloudPool object
*/
public Observable> getWithServiceResponseAsync(String poolId, PoolGetOptions poolGetOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(poolGetOptions);
String select = null;
if (poolGetOptions != null) {
select = poolGetOptions.select();
}
String expand = null;
if (poolGetOptions != null) {
expand = poolGetOptions.expand();
}
Integer timeout = null;
if (poolGetOptions != null) {
timeout = poolGetOptions.timeout();
}
UUID clientRequestId = null;
if (poolGetOptions != null) {
clientRequestId = poolGetOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolGetOptions != null) {
returnClientRequestId = poolGetOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolGetOptions != null) {
ocpDate = poolGetOptions.ocpDate();
}
String ifMatch = null;
if (poolGetOptions != null) {
ifMatch = poolGetOptions.ifMatch();
}
String ifNoneMatch = null;
if (poolGetOptions != null) {
ifNoneMatch = poolGetOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (poolGetOptions != null) {
ifModifiedSince = poolGetOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (poolGetOptions != null) {
ifUnmodifiedSince = poolGetOptions.ifUnmodifiedSince();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.get(poolId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable