use of com.microsoft.rest.DateTimeRfc1123 in project azure-sdk-for-java by Azure.
the class PoolsImpl method listPoolUsageMetricsNextAsync.
/**
* Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceCall the ServiceCall object tracking the Retrofit calls
* @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 listPoolUsageMetricsNextAsync(final String nextPageLink, final ServiceCall serviceCall, final ListOperationCallback<PoolUsageMetrics> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (nextPageLink == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."));
return null;
}
final PoolListPoolUsageMetricsNextOptions poolListPoolUsageMetricsNextOptions = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.listPoolUsageMetricsNext(nextPageLink, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
serviceCall.newCall(call);
call.enqueue(new ServiceResponseCallback<List<PoolUsageMetrics>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> result = listPoolUsageMetricsNextDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
listPoolUsageMetricsNextAsync(result.getBody().getNextPageLink(), null, serviceCall, serviceCallback);
} else {
serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
}
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.DateTimeRfc1123 in project azure-sdk-for-java by Azure.
the class PoolsImpl method listPoolUsageMetricsAsync.
/**
* Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
*
* @param poolListPoolUsageMetricsOptions Additional parameters for the operation
* @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 listPoolUsageMetricsAsync(final PoolListPoolUsageMetricsOptions poolListPoolUsageMetricsOptions, final ListOperationCallback<PoolUsageMetrics> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
Validator.validate(poolListPoolUsageMetricsOptions, serviceCallback);
DateTime startTime = null;
if (poolListPoolUsageMetricsOptions != null) {
startTime = poolListPoolUsageMetricsOptions.startTime();
}
DateTime endTime = null;
if (poolListPoolUsageMetricsOptions != null) {
endTime = poolListPoolUsageMetricsOptions.endTime();
}
String filter = null;
if (poolListPoolUsageMetricsOptions != null) {
filter = poolListPoolUsageMetricsOptions.filter();
}
Integer maxResults = null;
if (poolListPoolUsageMetricsOptions != null) {
maxResults = poolListPoolUsageMetricsOptions.maxResults();
}
Integer timeout = null;
if (poolListPoolUsageMetricsOptions != null) {
timeout = poolListPoolUsageMetricsOptions.timeout();
}
String clientRequestId = null;
if (poolListPoolUsageMetricsOptions != null) {
clientRequestId = poolListPoolUsageMetricsOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolListPoolUsageMetricsOptions != null) {
returnClientRequestId = poolListPoolUsageMetricsOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolListPoolUsageMetricsOptions != null) {
ocpDate = poolListPoolUsageMetricsOptions.ocpDate();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.listPoolUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<List<PoolUsageMetrics>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> result = listPoolUsageMetricsDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
PoolListPoolUsageMetricsNextOptions poolListPoolUsageMetricsNextOptions = null;
if (poolListPoolUsageMetricsOptions != null) {
poolListPoolUsageMetricsNextOptions = new PoolListPoolUsageMetricsNextOptions();
poolListPoolUsageMetricsNextOptions.withClientRequestId(poolListPoolUsageMetricsOptions.clientRequestId());
poolListPoolUsageMetricsNextOptions.withReturnClientRequestId(poolListPoolUsageMetricsOptions.returnClientRequestId());
poolListPoolUsageMetricsNextOptions.withOcpDate(poolListPoolUsageMetricsOptions.ocpDate());
}
listPoolUsageMetricsNextAsync(result.getBody().getNextPageLink(), poolListPoolUsageMetricsNextOptions, serviceCall, serviceCallback);
} else {
serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
}
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.DateTimeRfc1123 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.rest.DateTimeRfc1123 in project azure-sdk-for-java by Azure.
the class JobsImpl method disableAsync.
/**
* Disables the specified job, preventing new tasks from running.
*
* @param jobId The id of the job to disable.
* @param disableTasks What to do with active tasks associated with the job. Possible values include: 'requeue', 'terminate', 'wait'
* @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 disableAsync(String jobId, DisableJobOption disableTasks, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobId 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 (disableTasks == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter disableTasks is required and cannot be null."));
return null;
}
final JobDisableOptions jobDisableOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
String ifMatch = null;
String ifNoneMatch = null;
DateTime ifModifiedSince = null;
DateTime ifUnmodifiedSince = null;
JobDisableParameter jobDisableParameter = new JobDisableParameter();
jobDisableParameter.withDisableTasks(disableTasks);
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);
}
Call<ResponseBody> call = service.disable(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, jobDisableParameter, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(disableDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.DateTimeRfc1123 in project azure-sdk-for-java by Azure.
the class JobsImpl method deleteAsync.
/**
* Deletes a job.
*
* @param jobId The id of the job to delete.
* @param jobDeleteOptions Additional parameters for the operation
* @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 deleteAsync(String jobId, JobDeleteOptions jobDeleteOptions, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobId 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;
}
Validator.validate(jobDeleteOptions, serviceCallback);
Integer timeout = null;
if (jobDeleteOptions != null) {
timeout = jobDeleteOptions.timeout();
}
String clientRequestId = null;
if (jobDeleteOptions != null) {
clientRequestId = jobDeleteOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (jobDeleteOptions != null) {
returnClientRequestId = jobDeleteOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (jobDeleteOptions != null) {
ocpDate = jobDeleteOptions.ocpDate();
}
String ifMatch = null;
if (jobDeleteOptions != null) {
ifMatch = jobDeleteOptions.ifMatch();
}
String ifNoneMatch = null;
if (jobDeleteOptions != null) {
ifNoneMatch = jobDeleteOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (jobDeleteOptions != null) {
ifModifiedSince = jobDeleteOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (jobDeleteOptions != null) {
ifUnmodifiedSince = jobDeleteOptions.ifUnmodifiedSince();
}
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);
}
Call<ResponseBody> call = service.delete(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<Void>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(deleteDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
Aggregations