use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class JobSchedulesImpl method updateAsync.
/**
* Updates the properties of the specified job schedule.
*
* @param jobScheduleId The id of the job schedule to update.
* @param jobScheduleUpdateParameter 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 updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, 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 (jobScheduleUpdateParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleUpdateParameter 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(jobScheduleUpdateParameter, serviceCallback);
final JobScheduleUpdateOptions jobScheduleUpdateOptions = 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.update(jobScheduleId, jobScheduleUpdateParameter, 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(updateDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class JobsImpl method patch.
/**
* 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
* @throws BatchErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/
public ServiceResponseWithHeaders<Void, JobPatchHeaders> patch(String jobId, JobPatchParameter jobPatchParameter, JobPatchOptions jobPatchOptions) throws BatchErrorException, IOException, IllegalArgumentException {
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (jobPatchParameter == null) {
throw new IllegalArgumentException("Parameter jobPatchParameter is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(jobPatchParameter);
Validator.validate(jobPatchOptions);
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());
return patchDelegate(call.execute());
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method enableAutoScaleAsync.
/**
* Enables automatic scaling for a pool.
*
* @param poolId The id of the pool on which to enable automatic scaling.
* @param poolEnableAutoScaleParameter 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 enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, 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 (poolEnableAutoScaleParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter poolEnableAutoScaleParameter 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(poolEnableAutoScaleParameter, serviceCallback);
final PoolEnableAutoScaleOptions poolEnableAutoScaleOptions = 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.enableAutoScale(poolId, poolEnableAutoScaleParameter, 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(enableAutoScaleDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class WebSiteManagementClientImpl method checkNameAvailabilityWithServiceResponseAsync.
/**
* Check if a resource name is available.
* Check if a resource name is available.
*
* @param name Resource name to verify.
* @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment'
* @param isFqdn Is fully qualified domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceNameAvailabilityInner object
*/
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type, Boolean isFqdn) {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (type == null) {
throw new IllegalArgumentException("Parameter type is required and cannot be null.");
}
final String apiVersion = "2016-03-01";
ResourceNameAvailabilityRequest request = new ResourceNameAvailabilityRequest();
request.withName(name);
request.withType(type);
request.withIsFqdn(isFqdn);
return service.checkNameAvailability(this.subscriptionId(), apiVersion, this.acceptLanguage(), request, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ResourceNameAvailabilityInner>>>() {
@Override
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ResourceNameAvailabilityInner> clientResponse = checkNameAvailabilityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class WebSiteManagementClientImpl method checkNameAvailabilityWithServiceResponseAsync.
/**
* Check if a resource name is available.
* Check if a resource name is available.
*
* @param name Resource name to verify.
* @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment'
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceNameAvailabilityInner object
*/
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type) {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (type == null) {
throw new IllegalArgumentException("Parameter type is required and cannot be null.");
}
final String apiVersion = "2016-03-01";
final Boolean isFqdn = null;
ResourceNameAvailabilityRequest request = new ResourceNameAvailabilityRequest();
request.withName(name);
request.withType(type);
request.withIsFqdn(null);
return service.checkNameAvailability(this.subscriptionId(), apiVersion, this.acceptLanguage(), request, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ResourceNameAvailabilityInner>>>() {
@Override
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ResourceNameAvailabilityInner> clientResponse = checkNameAvailabilityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
Aggregations