use of com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions in project azure-sdk-for-java by Azure.
the class PoolsImpl method evaluateAutoScale.
/**
* Gets the result of evaluating an automatic scaling formula on the pool.
*
* @param poolId The id of the pool on which to evaluate the automatic scaling formula.
* @param autoScaleFormula A formula for the desired number of compute nodes in the pool.
* @throws BatchErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the AutoScaleRun object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/
public ServiceResponseWithHeaders<AutoScaleRun, PoolEvaluateAutoScaleHeaders> evaluateAutoScale(String poolId, String autoScaleFormula) throws BatchErrorException, IOException, IllegalArgumentException {
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.");
}
if (autoScaleFormula == null) {
throw new IllegalArgumentException("Parameter autoScaleFormula is required and cannot be null.");
}
final PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter = new PoolEvaluateAutoScaleParameter();
poolEvaluateAutoScaleParameter.withAutoScaleFormula(autoScaleFormula);
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.evaluateAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, poolEvaluateAutoScaleParameter, this.client.userAgent());
return evaluateAutoScaleDelegate(call.execute());
}
use of com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions in project azure-sdk-for-java by Azure.
the class PoolsImpl method evaluateAutoScaleAsync.
/**
* Gets the result of evaluating an automatic scaling formula on the pool.
*
* @param poolId The id of the pool on which to evaluate the automatic scaling formula.
* @param autoScaleFormula A formula for the desired number of compute nodes in the pool.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback<AutoScaleRun> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (poolId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter poolId is required and cannot be null."));
return null;
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
if (autoScaleFormula == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter autoScaleFormula is required and cannot be null."));
return null;
}
final PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter = new PoolEvaluateAutoScaleParameter();
poolEvaluateAutoScaleParameter.withAutoScaleFormula(autoScaleFormula);
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.evaluateAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, poolEvaluateAutoScaleParameter, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<AutoScaleRun>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(evaluateAutoScaleDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
Aggregations