use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method updateProperties.
/**
* Updates the properties of a pool.
*
* @param poolId The id of the pool to update.
* @param poolUpdatePropertiesParameter The parameters for the request.
* @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, PoolUpdatePropertiesHeaders> updateProperties(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter) throws BatchErrorException, IOException, IllegalArgumentException {
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (poolUpdatePropertiesParameter == null) {
throw new IllegalArgumentException("Parameter poolUpdatePropertiesParameter 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(poolUpdatePropertiesParameter);
final PoolUpdatePropertiesOptions poolUpdatePropertiesOptions = 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.updateProperties(poolId, poolUpdatePropertiesParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
return updatePropertiesDelegate(call.execute());
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method removeNodesAsync.
/**
* Removes compute nodes from the specified pool.
*
* @param poolId The id of the pool from which you want to remove nodes.
* @param nodeRemoveParameter The parameters for the request.
* @param poolRemoveNodesOptions 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 removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions, 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 (nodeRemoveParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter nodeRemoveParameter 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(nodeRemoveParameter, serviceCallback);
Validator.validate(poolRemoveNodesOptions, serviceCallback);
Integer timeout = null;
if (poolRemoveNodesOptions != null) {
timeout = poolRemoveNodesOptions.timeout();
}
String clientRequestId = null;
if (poolRemoveNodesOptions != null) {
clientRequestId = poolRemoveNodesOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolRemoveNodesOptions != null) {
returnClientRequestId = poolRemoveNodesOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolRemoveNodesOptions != null) {
ocpDate = poolRemoveNodesOptions.ocpDate();
}
String ifMatch = null;
if (poolRemoveNodesOptions != null) {
ifMatch = poolRemoveNodesOptions.ifMatch();
}
String ifNoneMatch = null;
if (poolRemoveNodesOptions != null) {
ifNoneMatch = poolRemoveNodesOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (poolRemoveNodesOptions != null) {
ifModifiedSince = poolRemoveNodesOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (poolRemoveNodesOptions != null) {
ifUnmodifiedSince = poolRemoveNodesOptions.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.removeNodes(poolId, nodeRemoveParameter, 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(removeNodesDelegate(response));
} catch (BatchErrorException | IOException exception) {
serviceCallback.failure(exception);
}
}
});
return serviceCall;
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method patchAsync.
/**
* Updates the properties of a pool.
*
* @param poolId The id of the pool to update.
* @param poolPatchParameter 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 patchAsync(String poolId, PoolPatchParameter poolPatchParameter, 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 (poolPatchParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter poolPatchParameter 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(poolPatchParameter, serviceCallback);
final PoolPatchOptions poolPatchOptions = 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.patch(poolId, poolPatchParameter, 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 okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method enableAutoScale.
/**
* 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 poolEnableAutoScaleOptions 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, PoolEnableAutoScaleHeaders> enableAutoScale(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions) throws BatchErrorException, IOException, IllegalArgumentException {
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (poolEnableAutoScaleParameter == null) {
throw new IllegalArgumentException("Parameter poolEnableAutoScaleParameter 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(poolEnableAutoScaleParameter);
Validator.validate(poolEnableAutoScaleOptions);
Integer timeout = null;
if (poolEnableAutoScaleOptions != null) {
timeout = poolEnableAutoScaleOptions.timeout();
}
String clientRequestId = null;
if (poolEnableAutoScaleOptions != null) {
clientRequestId = poolEnableAutoScaleOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (poolEnableAutoScaleOptions != null) {
returnClientRequestId = poolEnableAutoScaleOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (poolEnableAutoScaleOptions != null) {
ocpDate = poolEnableAutoScaleOptions.ocpDate();
}
String ifMatch = null;
if (poolEnableAutoScaleOptions != null) {
ifMatch = poolEnableAutoScaleOptions.ifMatch();
}
String ifNoneMatch = null;
if (poolEnableAutoScaleOptions != null) {
ifNoneMatch = poolEnableAutoScaleOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (poolEnableAutoScaleOptions != null) {
ifModifiedSince = poolEnableAutoScaleOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (poolEnableAutoScaleOptions != null) {
ifUnmodifiedSince = poolEnableAutoScaleOptions.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.enableAutoScale(poolId, poolEnableAutoScaleParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.userAgent());
return enableAutoScaleDelegate(call.execute());
}
use of okhttp3.Request in project azure-sdk-for-java by Azure.
the class PoolsImpl method patch.
/**
* Updates the properties of a pool.
*
* @param poolId The id of the pool to update.
* @param poolPatchParameter The parameters for the request.
* @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, PoolPatchHeaders> patch(String poolId, PoolPatchParameter poolPatchParameter) throws BatchErrorException, IOException, IllegalArgumentException {
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (poolPatchParameter == null) {
throw new IllegalArgumentException("Parameter poolPatchParameter 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(poolPatchParameter);
final PoolPatchOptions poolPatchOptions = 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.patch(poolId, poolPatchParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, this.client.userAgent());
return patchDelegate(call.execute());
}
Aggregations