use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class JobsImpl method patchAsync.
/**
* Updates the properties of a job.
*
* @param jobId The id of the job whose properties you want to update.
* @param jobPatchParameter The parameters for the request.
* @param jobPatchOptions 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 patchAsync(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions, 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 (jobPatchParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobPatchParameter 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(jobPatchParameter, serviceCallback);
Validator.validate(jobPatchOptions, serviceCallback);
Integer timeout = null;
if (jobPatchOptions != null) {
timeout = jobPatchOptions.timeout();
}
String clientRequestId = null;
if (jobPatchOptions != null) {
clientRequestId = jobPatchOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (jobPatchOptions != null) {
returnClientRequestId = jobPatchOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (jobPatchOptions != null) {
ocpDate = jobPatchOptions.ocpDate();
}
String ifMatch = null;
if (jobPatchOptions != null) {
ifMatch = jobPatchOptions.ifMatch();
}
String ifNoneMatch = null;
if (jobPatchOptions != null) {
ifNoneMatch = jobPatchOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (jobPatchOptions != null) {
ifModifiedSince = jobPatchOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (jobPatchOptions != null) {
ifUnmodifiedSince = jobPatchOptions.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.patch(jobId, jobPatchParameter, 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(patchDelegate(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 deleteAsync.
/**
* Deletes a task from the specified job.
*
* @param jobId The id of the job from which to delete the task.
* @param taskId The id of the task to delete.
* @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, 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 TaskDeleteOptions taskDeleteOptions = 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.delete(jobId, taskId, 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;
}
use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class TasksImpl method terminateAsync.
/**
* Terminates the specified task.
*
* @param jobId The id of the job containing the task.
* @param taskId The id of the task to terminate.
* @param taskTerminateOptions 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 terminateAsync(String jobId, String taskId, TaskTerminateOptions taskTerminateOptions, 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;
}
Validator.validate(taskTerminateOptions, serviceCallback);
Integer timeout = null;
if (taskTerminateOptions != null) {
timeout = taskTerminateOptions.timeout();
}
String clientRequestId = null;
if (taskTerminateOptions != null) {
clientRequestId = taskTerminateOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (taskTerminateOptions != null) {
returnClientRequestId = taskTerminateOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (taskTerminateOptions != null) {
ocpDate = taskTerminateOptions.ocpDate();
}
String ifMatch = null;
if (taskTerminateOptions != null) {
ifMatch = taskTerminateOptions.ifMatch();
}
String ifNoneMatch = null;
if (taskTerminateOptions != null) {
ifNoneMatch = taskTerminateOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (taskTerminateOptions != null) {
ifModifiedSince = taskTerminateOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (taskTerminateOptions != null) {
ifUnmodifiedSince = taskTerminateOptions.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.terminate(jobId, taskId, 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(terminateDelegate(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 listAsync.
/**
* Lists all of the tasks that are associated with the specified job.
*
* @param jobId The id of the job.
* @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 listAsync(final String jobId, final ListOperationCallback<CloudTask> 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;
}
final TaskListOptions taskListOptions = null;
String filter = null;
String select = null;
String expand = null;
Integer maxResults = 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.list(jobId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<List<CloudTask>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<CloudTask>, TaskListHeaders> result = listDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
listNextAsync(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.ServiceCall in project azure-sdk-for-java by Azure.
the class PoolsImpl method stopResizeAsync.
/**
* Stops an ongoing resize operation on the pool.
* This does not restore the pool to its previous state before the resize operation: it only stops any further changes being made, and the pool maintains its current state.
*
* @param poolId The id of the pool whose resizing you want to stop.
* @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 stopResizeAsync(String poolId, 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 (this.client.apiVersion() == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."));
return null;
}
final PoolStopResizeOptions poolStopResizeOptions = 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.stopResize(poolId, 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(stopResizeDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
Aggregations