use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.
the class PoolsImpl method listAsync.
/**
* 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 callback is null
* @return the {@link Call} object
*/
public ServiceCall listAsync(final PoolListOptions poolListOptions, final ListOperationCallback<CloudPool> 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(poolListOptions, serviceCallback);
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();
}
String 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();
}
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.list(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<CloudPool>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<PageImpl<CloudPool>, PoolListHeaders> result = listDelegate(response);
serviceCallback.load(result.getBody().getItems());
if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
PoolListNextOptions poolListNextOptions = null;
if (poolListOptions != null) {
poolListNextOptions = new PoolListNextOptions();
poolListNextOptions.withClientRequestId(poolListOptions.clientRequestId());
poolListNextOptions.withReturnClientRequestId(poolListOptions.returnClientRequestId());
poolListNextOptions.withOcpDate(poolListOptions.ocpDate());
}
listNextAsync(result.getBody().getNextPageLink(), poolListNextOptions, 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 JobSchedulesImpl method disableAsync.
/**
* Disables a job schedule.
*
* @param jobScheduleId The id of the job schedule to disable.
* @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 jobScheduleId, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobScheduleId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleDisableOptions jobScheduleDisableOptions = 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.disable(jobScheduleId, 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(disableDelegate(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 JobSchedulesImpl method disableAsync.
/**
* Disables a job schedule.
*
* @param jobScheduleId The id of the job schedule to disable.
* @param jobScheduleDisableOptions 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 disableAsync(String jobScheduleId, JobScheduleDisableOptions jobScheduleDisableOptions, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobScheduleId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleDisableOptions, serviceCallback);
Integer timeout = null;
if (jobScheduleDisableOptions != null) {
timeout = jobScheduleDisableOptions.timeout();
}
String clientRequestId = null;
if (jobScheduleDisableOptions != null) {
clientRequestId = jobScheduleDisableOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (jobScheduleDisableOptions != null) {
returnClientRequestId = jobScheduleDisableOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (jobScheduleDisableOptions != null) {
ocpDate = jobScheduleDisableOptions.ocpDate();
}
String ifMatch = null;
if (jobScheduleDisableOptions != null) {
ifMatch = jobScheduleDisableOptions.ifMatch();
}
String ifNoneMatch = null;
if (jobScheduleDisableOptions != null) {
ifNoneMatch = jobScheduleDisableOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (jobScheduleDisableOptions != null) {
ifModifiedSince = jobScheduleDisableOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (jobScheduleDisableOptions != null) {
ifUnmodifiedSince = jobScheduleDisableOptions.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.disable(jobScheduleId, 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(disableDelegate(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 JobSchedulesImpl method existsAsync.
/**
* Checks the specified job schedule exists.
*
* @param jobScheduleId The id of the job schedule which you want to check.
* @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 existsAsync(String jobScheduleId, final ServiceCallback<Boolean> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobScheduleId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId 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 JobScheduleExistsOptions jobScheduleExistsOptions = 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<Void> call = service.exists(jobScheduleId, 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 ServiceResponseEmptyCallback<Boolean>(serviceCallback) {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
try {
serviceCallback.success(existsDelegate(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 JobSchedulesImpl method terminateAsync.
/**
* Terminates a job schedule.
*
* @param jobScheduleId The id of the job schedule to terminates.
* @param jobScheduleTerminateOptions 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 jobScheduleId, JobScheduleTerminateOptions jobScheduleTerminateOptions, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
if (jobScheduleId == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleTerminateOptions, serviceCallback);
Integer timeout = null;
if (jobScheduleTerminateOptions != null) {
timeout = jobScheduleTerminateOptions.timeout();
}
String clientRequestId = null;
if (jobScheduleTerminateOptions != null) {
clientRequestId = jobScheduleTerminateOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (jobScheduleTerminateOptions != null) {
returnClientRequestId = jobScheduleTerminateOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (jobScheduleTerminateOptions != null) {
ocpDate = jobScheduleTerminateOptions.ocpDate();
}
String ifMatch = null;
if (jobScheduleTerminateOptions != null) {
ifMatch = jobScheduleTerminateOptions.ifMatch();
}
String ifNoneMatch = null;
if (jobScheduleTerminateOptions != null) {
ifNoneMatch = jobScheduleTerminateOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (jobScheduleTerminateOptions != null) {
ifModifiedSince = jobScheduleTerminateOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (jobScheduleTerminateOptions != null) {
ifUnmodifiedSince = jobScheduleTerminateOptions.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(jobScheduleId, 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;
}
Aggregations