use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class TasksImpl method updateAsync.
/**
* Updates the properties of the specified task.
*
* @param jobId The id of the job containing the task.
* @param taskId The id of the task to update.
* @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 updateAsync(String jobId, String taskId, 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 (taskId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter taskId 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;
}
final TaskConstraints constraints = null;
final TaskUpdateOptions taskUpdateOptions = 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;
TaskUpdateParameter taskUpdateParameter = new TaskUpdateParameter();
taskUpdateParameter.withConstraints(null);
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.update(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, taskUpdateParameter, 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(updateDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class TasksImpl method addCollectionAsync.
/**
* Adds a collection of tasks to the specified job.
*
* @param jobId The id of the job to which the task collection is to be added.
* @param value The collection of tasks to add.
* @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 addCollectionAsync(String jobId, List<TaskAddParameter> value, final ServiceCallback<TaskAddCollectionResult> 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 (value == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter value is required and cannot be null."));
return null;
}
Validator.validate(value, serviceCallback);
final TaskAddCollectionOptions taskAddCollectionOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
TaskAddCollectionParameter taskCollection = new TaskAddCollectionParameter();
taskCollection.withValue(value);
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.addCollection(jobId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, taskCollection, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<TaskAddCollectionResult>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(addCollectionDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class TasksImpl method addAsync.
/**
* Adds a task to the specified job.
*
* @param jobId The id of the job to which the task is to be added.
* @param task The task to be added.
* @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 addAsync(String jobId, TaskAddParameter task, 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 (task == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter task 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(task, serviceCallback);
final TaskAddOptions taskAddOptions = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, 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(addDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class TasksImpl method addAsync.
/**
* Adds a task to the specified job.
*
* @param jobId The id of the job to which the task is to be added.
* @param task The task to be added.
* @param taskAddOptions 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 addAsync(String jobId, TaskAddParameter task, TaskAddOptions taskAddOptions, 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 (task == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter task 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(task, serviceCallback);
Validator.validate(taskAddOptions, serviceCallback);
Integer timeout = null;
if (taskAddOptions != null) {
timeout = taskAddOptions.timeout();
}
String clientRequestId = null;
if (taskAddOptions != null) {
clientRequestId = taskAddOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (taskAddOptions != null) {
returnClientRequestId = taskAddOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (taskAddOptions != null) {
ocpDate = taskAddOptions.ocpDate();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.add(jobId, task, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, 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(addDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class PoolsImpl method resizeAsync.
/**
* Changes the number of compute nodes that are assigned to a pool.
*
* @param poolId The id of the pool to resize.
* @param poolResizeParameter The parameters for the request.
* @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 resizeAsync(String poolId, PoolResizeParameter poolResizeParameter, final ServiceCallback<Void> 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 (poolResizeParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter poolResizeParameter 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(poolResizeParameter, serviceCallback);
final PoolResizeOptions poolResizeOptions = 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;
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.resize(poolId, poolResizeParameter, 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(resizeDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
Aggregations