Search in sources :

Example 1 with PoolUpgradeOSParameter

use of com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter in project azure-sdk-for-java by Azure.

the class PoolsImpl method upgradeOSAsync.

/**
     * Upgrades the operating system of the specified pool.
     *
     * @param poolId The id of the pool to upgrade.
     * @param targetOSVersion The Azure Guest OS version to be installed on the virtual machines 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 upgradeOSAsync(String poolId, String targetOSVersion, 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;
    }
    if (targetOSVersion == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter targetOSVersion is required and cannot be null."));
        return null;
    }
    final PoolUpgradeOSOptions poolUpgradeOSOptions = 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;
    PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter();
    poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion);
    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.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, 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(upgradeOSDelegate(response));
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) PoolUpgradeOSOptions(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) PoolUpgradeOSParameter(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 2 with PoolUpgradeOSParameter

use of com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter in project azure-sdk-for-java by Azure.

the class PoolsImpl method upgradeOSAsync.

/**
     * Upgrades the operating system of the specified pool.
     *
     * @param poolId The id of the pool to upgrade.
     * @param targetOSVersion The Azure Guest OS version to be installed on the virtual machines in the pool.
     * @param poolUpgradeOSOptions 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 upgradeOSAsync(String poolId, String targetOSVersion, PoolUpgradeOSOptions poolUpgradeOSOptions, 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;
    }
    if (targetOSVersion == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter targetOSVersion is required and cannot be null."));
        return null;
    }
    Validator.validate(poolUpgradeOSOptions, serviceCallback);
    Integer timeout = null;
    if (poolUpgradeOSOptions != null) {
        timeout = poolUpgradeOSOptions.timeout();
    }
    String clientRequestId = null;
    if (poolUpgradeOSOptions != null) {
        clientRequestId = poolUpgradeOSOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (poolUpgradeOSOptions != null) {
        returnClientRequestId = poolUpgradeOSOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (poolUpgradeOSOptions != null) {
        ocpDate = poolUpgradeOSOptions.ocpDate();
    }
    String ifMatch = null;
    if (poolUpgradeOSOptions != null) {
        ifMatch = poolUpgradeOSOptions.ifMatch();
    }
    String ifNoneMatch = null;
    if (poolUpgradeOSOptions != null) {
        ifNoneMatch = poolUpgradeOSOptions.ifNoneMatch();
    }
    DateTime ifModifiedSince = null;
    if (poolUpgradeOSOptions != null) {
        ifModifiedSince = poolUpgradeOSOptions.ifModifiedSince();
    }
    DateTime ifUnmodifiedSince = null;
    if (poolUpgradeOSOptions != null) {
        ifUnmodifiedSince = poolUpgradeOSOptions.ifUnmodifiedSince();
    }
    PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter();
    poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion);
    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.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, 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(upgradeOSDelegate(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) PoolUpgradeOSParameter(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 3 with PoolUpgradeOSParameter

use of com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter in project azure-sdk-for-java by Azure.

the class PoolsImpl method upgradeOS.

/**
     * Upgrades the operating system of the specified pool.
     *
     * @param poolId The id of the pool to upgrade.
     * @param targetOSVersion The Azure Guest OS version to be installed on the virtual machines in the pool.
     * @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, PoolUpgradeOSHeaders> upgradeOS(String poolId, String targetOSVersion) throws BatchErrorException, IOException, IllegalArgumentException {
    if (poolId == null) {
        throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    if (targetOSVersion == null) {
        throw new IllegalArgumentException("Parameter targetOSVersion is required and cannot be null.");
    }
    final PoolUpgradeOSOptions poolUpgradeOSOptions = 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;
    PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter();
    poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion);
    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.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, this.client.userAgent());
    return upgradeOSDelegate(call.execute());
}
Also used : PoolUpgradeOSOptions(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSOptions) PoolUpgradeOSParameter(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 4 with PoolUpgradeOSParameter

use of com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter in project azure-sdk-for-java by Azure.

the class PoolsImpl method upgradeOS.

/**
     * Upgrades the operating system of the specified pool.
     *
     * @param poolId The id of the pool to upgrade.
     * @param targetOSVersion The Azure Guest OS version to be installed on the virtual machines in the pool.
     * @param poolUpgradeOSOptions 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, PoolUpgradeOSHeaders> upgradeOS(String poolId, String targetOSVersion, PoolUpgradeOSOptions poolUpgradeOSOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (poolId == null) {
        throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    if (targetOSVersion == null) {
        throw new IllegalArgumentException("Parameter targetOSVersion is required and cannot be null.");
    }
    Validator.validate(poolUpgradeOSOptions);
    Integer timeout = null;
    if (poolUpgradeOSOptions != null) {
        timeout = poolUpgradeOSOptions.timeout();
    }
    String clientRequestId = null;
    if (poolUpgradeOSOptions != null) {
        clientRequestId = poolUpgradeOSOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (poolUpgradeOSOptions != null) {
        returnClientRequestId = poolUpgradeOSOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (poolUpgradeOSOptions != null) {
        ocpDate = poolUpgradeOSOptions.ocpDate();
    }
    String ifMatch = null;
    if (poolUpgradeOSOptions != null) {
        ifMatch = poolUpgradeOSOptions.ifMatch();
    }
    String ifNoneMatch = null;
    if (poolUpgradeOSOptions != null) {
        ifNoneMatch = poolUpgradeOSOptions.ifNoneMatch();
    }
    DateTime ifModifiedSince = null;
    if (poolUpgradeOSOptions != null) {
        ifModifiedSince = poolUpgradeOSOptions.ifModifiedSince();
    }
    DateTime ifUnmodifiedSince = null;
    if (poolUpgradeOSOptions != null) {
        ifUnmodifiedSince = poolUpgradeOSOptions.ifUnmodifiedSince();
    }
    PoolUpgradeOSParameter poolUpgradeOSParameter = new PoolUpgradeOSParameter();
    poolUpgradeOSParameter.withTargetOSVersion(targetOSVersion);
    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.upgradeOS(poolId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, poolUpgradeOSParameter, this.client.userAgent());
    return upgradeOSDelegate(call.execute());
}
Also used : PoolUpgradeOSParameter(com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Aggregations

PoolUpgradeOSParameter (com.microsoft.azure.batch.protocol.models.PoolUpgradeOSParameter)4 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)4 ResponseBody (okhttp3.ResponseBody)4 DateTime (org.joda.time.DateTime)4 PoolUpgradeOSOptions (com.microsoft.azure.batch.protocol.models.PoolUpgradeOSOptions)2 ServiceCall (com.microsoft.rest.ServiceCall)2