Search in sources :

Example 76 with ServiceCall

use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.

the class PoolsImpl method updatePropertiesAsync.

/**
     * Updates the properties of a pool.
     *
     * @param poolId The id of the pool to update.
     * @param poolUpdatePropertiesParameter 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 updatePropertiesAsync(String poolId, PoolUpdatePropertiesParameter poolUpdatePropertiesParameter, 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 (poolUpdatePropertiesParameter == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter poolUpdatePropertiesParameter 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(poolUpdatePropertiesParameter, serviceCallback);
    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());
    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(updatePropertiesDelegate(response));
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) PoolUpdatePropertiesOptions(com.microsoft.azure.batch.protocol.models.PoolUpdatePropertiesOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 77 with ServiceCall

use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.

the class PoolsImpl method evaluateAutoScaleAsync.

/**
     * Gets the result of evaluating an automatic scaling formula on the pool.
     *
     * @param poolId The id of the pool on which to evaluate the automatic scaling formula.
     * @param autoScaleFormula A formula for the desired number of compute nodes in the pool.
     * @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 evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback<AutoScaleRun> 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;
    }
    if (autoScaleFormula == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter autoScaleFormula is required and cannot be null."));
        return null;
    }
    final PoolEvaluateAutoScaleOptions poolEvaluateAutoScaleOptions = null;
    Integer timeout = null;
    String clientRequestId = null;
    Boolean returnClientRequestId = null;
    DateTime ocpDate = null;
    PoolEvaluateAutoScaleParameter poolEvaluateAutoScaleParameter = new PoolEvaluateAutoScaleParameter();
    poolEvaluateAutoScaleParameter.withAutoScaleFormula(autoScaleFormula);
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.evaluateAutoScale(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, poolEvaluateAutoScaleParameter, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<AutoScaleRun>(serviceCallback) {

        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
            try {
                serviceCallback.success(evaluateAutoScaleDelegate(response));
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) AutoScaleRun(com.microsoft.azure.batch.protocol.models.AutoScaleRun) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) PoolEvaluateAutoScaleOptions(com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleOptions) PoolEvaluateAutoScaleParameter(com.microsoft.azure.batch.protocol.models.PoolEvaluateAutoScaleParameter)

Example 78 with ServiceCall

use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.

the class PoolsImpl method existsAsync.

/**
     * Gets basic properties of a pool.
     *
     * @param poolId The id of the pool to get.
     * @param poolExistsOptions 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 existsAsync(String poolId, PoolExistsOptions poolExistsOptions, final ServiceCallback<Boolean> 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;
    }
    Validator.validate(poolExistsOptions, serviceCallback);
    Integer timeout = null;
    if (poolExistsOptions != null) {
        timeout = poolExistsOptions.timeout();
    }
    String clientRequestId = null;
    if (poolExistsOptions != null) {
        clientRequestId = poolExistsOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (poolExistsOptions != null) {
        returnClientRequestId = poolExistsOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (poolExistsOptions != null) {
        ocpDate = poolExistsOptions.ocpDate();
    }
    String ifMatch = null;
    if (poolExistsOptions != null) {
        ifMatch = poolExistsOptions.ifMatch();
    }
    String ifNoneMatch = null;
    if (poolExistsOptions != null) {
        ifNoneMatch = poolExistsOptions.ifNoneMatch();
    }
    DateTime ifModifiedSince = null;
    if (poolExistsOptions != null) {
        ifModifiedSince = poolExistsOptions.ifModifiedSince();
    }
    DateTime ifUnmodifiedSince = null;
    if (poolExistsOptions != null) {
        ifUnmodifiedSince = poolExistsOptions.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<Void> call = service.exists(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 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;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime)

Example 79 with ServiceCall

use of com.microsoft.rest.ServiceCall in project azure-sdk-for-java by Azure.

the class PoolsImpl method disableAutoScaleAsync.

/**
     * Disables automatic scaling for a pool.
     *
     * @param poolId The id of the pool on which to disable automatic scaling.
     * @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 disableAutoScaleAsync(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 PoolDisableAutoScaleOptions poolDisableAutoScaleOptions = 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.disableAutoScale(poolId, 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(disableAutoScaleDelegate(response));
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) PoolDisableAutoScaleOptions(com.microsoft.azure.batch.protocol.models.PoolDisableAutoScaleOptions)

Example 80 with ServiceCall

use of com.microsoft.rest.ServiceCall 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 poolEnableAutoScaleOptions 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 enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter, PoolEnableAutoScaleOptions poolEnableAutoScaleOptions, 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);
    Validator.validate(poolEnableAutoScaleOptions, serviceCallback);
    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());
    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;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Aggregations

DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)148 ServiceCall (com.microsoft.rest.ServiceCall)148 DateTime (org.joda.time.DateTime)148 ResponseBody (okhttp3.ResponseBody)140 PagedList (com.microsoft.azure.PagedList)26 ServiceResponseWithHeaders (com.microsoft.rest.ServiceResponseWithHeaders)26 List (java.util.List)26 CloudJob (com.microsoft.azure.batch.protocol.models.CloudJob)6 InputStream (java.io.InputStream)6 ApplicationSummary (com.microsoft.azure.batch.protocol.models.ApplicationSummary)4 Certificate (com.microsoft.azure.batch.protocol.models.Certificate)4 CloudJobSchedule (com.microsoft.azure.batch.protocol.models.CloudJobSchedule)4 CloudPool (com.microsoft.azure.batch.protocol.models.CloudPool)4 CloudTask (com.microsoft.azure.batch.protocol.models.CloudTask)4 ComputeNode (com.microsoft.azure.batch.protocol.models.ComputeNode)4 NodeFile (com.microsoft.azure.batch.protocol.models.NodeFile)3 AutoScaleRun (com.microsoft.azure.batch.protocol.models.AutoScaleRun)2 CloudTaskListSubtasksResult (com.microsoft.azure.batch.protocol.models.CloudTaskListSubtasksResult)2 ComputeNodeGetRemoteLoginSettingsResult (com.microsoft.azure.batch.protocol.models.ComputeNodeGetRemoteLoginSettingsResult)2 JobDisableParameter (com.microsoft.azure.batch.protocol.models.JobDisableParameter)2