Search in sources :

Example 11 with ServiceCall

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

the class ComputeNodesImpl method getRemoteLoginSettingsAsync.

/**
     * Gets the settings required for remote login to a compute node.
     *
     * @param poolId The id of the pool that contains the compute node.
     * @param nodeId The id of the compute node for which to obtain the remote login settings.
     * @param computeNodeGetRemoteLoginSettingsOptions 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 getRemoteLoginSettingsAsync(String poolId, String nodeId, ComputeNodeGetRemoteLoginSettingsOptions computeNodeGetRemoteLoginSettingsOptions, final ServiceCallback<ComputeNodeGetRemoteLoginSettingsResult> 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 (nodeId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter nodeId 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(computeNodeGetRemoteLoginSettingsOptions, serviceCallback);
    Integer timeout = null;
    if (computeNodeGetRemoteLoginSettingsOptions != null) {
        timeout = computeNodeGetRemoteLoginSettingsOptions.timeout();
    }
    String clientRequestId = null;
    if (computeNodeGetRemoteLoginSettingsOptions != null) {
        clientRequestId = computeNodeGetRemoteLoginSettingsOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (computeNodeGetRemoteLoginSettingsOptions != null) {
        returnClientRequestId = computeNodeGetRemoteLoginSettingsOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (computeNodeGetRemoteLoginSettingsOptions != null) {
        ocpDate = computeNodeGetRemoteLoginSettingsOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.getRemoteLoginSettings(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<ComputeNodeGetRemoteLoginSettingsResult>(serviceCallback) {

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

Example 12 with ServiceCall

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

the class ComputeNodesImpl method deleteUserAsync.

/**
     * Deletes a user account from the specified compute node.
     *
     * @param poolId The id of the pool that contains the compute node.
     * @param nodeId The id of the machine on which you want to delete a user account.
     * @param userName The name of the user account to delete.
     * @param computeNodeDeleteUserOptions 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 deleteUserAsync(String poolId, String nodeId, String userName, ComputeNodeDeleteUserOptions computeNodeDeleteUserOptions, 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 (nodeId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter nodeId is required and cannot be null."));
        return null;
    }
    if (userName == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter userName 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(computeNodeDeleteUserOptions, serviceCallback);
    Integer timeout = null;
    if (computeNodeDeleteUserOptions != null) {
        timeout = computeNodeDeleteUserOptions.timeout();
    }
    String clientRequestId = null;
    if (computeNodeDeleteUserOptions != null) {
        clientRequestId = computeNodeDeleteUserOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (computeNodeDeleteUserOptions != null) {
        returnClientRequestId = computeNodeDeleteUserOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (computeNodeDeleteUserOptions != null) {
        ocpDate = computeNodeDeleteUserOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.deleteUser(poolId, nodeId, userName, 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(deleteUserDelegate(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)

Example 13 with ServiceCall

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

the class ComputeNodesImpl method enableSchedulingAsync.

/**
     * Enables task scheduling on the specified compute node.
     *
     * @param poolId The id of the pool that contains the compute node.
     * @param nodeId The id of the compute node on which you want to enable task scheduling.
     * @param computeNodeEnableSchedulingOptions 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 enableSchedulingAsync(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions, 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 (nodeId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter nodeId 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(computeNodeEnableSchedulingOptions, serviceCallback);
    Integer timeout = null;
    if (computeNodeEnableSchedulingOptions != null) {
        timeout = computeNodeEnableSchedulingOptions.timeout();
    }
    String clientRequestId = null;
    if (computeNodeEnableSchedulingOptions != null) {
        clientRequestId = computeNodeEnableSchedulingOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (computeNodeEnableSchedulingOptions != null) {
        returnClientRequestId = computeNodeEnableSchedulingOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (computeNodeEnableSchedulingOptions != null) {
        ocpDate = computeNodeEnableSchedulingOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.enableScheduling(poolId, nodeId, 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(enableSchedulingDelegate(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)

Example 14 with ServiceCall

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

the class ComputeNodesImpl method reimageAsync.

/**
     * Reinstalls the operating system on the specified compute node.
     *
     * @param poolId The id of the pool that contains the compute node.
     * @param nodeId The id of the compute node that you want to restart.
     * @param nodeReimageOption When to reimage the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskcompletion', 'retaineddata'
     * @param computeNodeReimageOptions 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 reimageAsync(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption, ComputeNodeReimageOptions computeNodeReimageOptions, 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 (nodeId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter nodeId 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(computeNodeReimageOptions, serviceCallback);
    Integer timeout = null;
    if (computeNodeReimageOptions != null) {
        timeout = computeNodeReimageOptions.timeout();
    }
    String clientRequestId = null;
    if (computeNodeReimageOptions != null) {
        clientRequestId = computeNodeReimageOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (computeNodeReimageOptions != null) {
        returnClientRequestId = computeNodeReimageOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (computeNodeReimageOptions != null) {
        ocpDate = computeNodeReimageOptions.ocpDate();
    }
    NodeReimageParameter nodeReimageParameter = null;
    if (nodeReimageOption != null) {
        nodeReimageParameter = new NodeReimageParameter();
        nodeReimageParameter.withNodeReimageOption(nodeReimageOption);
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.reimage(poolId, nodeId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, nodeReimageParameter, 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(reimageDelegate(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) NodeReimageParameter(com.microsoft.azure.batch.protocol.models.NodeReimageParameter)

Example 15 with ServiceCall

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

the class PoolsImpl method listPoolUsageMetricsAsync.

/**
     * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
     *
     * @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 listPoolUsageMetricsAsync(final ListOperationCallback<PoolUsageMetrics> 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;
    }
    final PoolListPoolUsageMetricsOptions poolListPoolUsageMetricsOptions = null;
    DateTime startTime = null;
    DateTime endTime = null;
    String filter = null;
    Integer maxResults = 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.listPoolUsageMetrics(this.client.apiVersion(), this.client.acceptLanguage(), startTime, endTime, filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<List<PoolUsageMetrics>>(serviceCallback) {

        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
            try {
                ServiceResponseWithHeaders<PageImpl<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> result = listPoolUsageMetricsDelegate(response);
                serviceCallback.load(result.getBody().getItems());
                if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
                    listPoolUsageMetricsNextAsync(result.getBody().getNextPageLink(), null, serviceCall, serviceCallback);
                } else {
                    serviceCallback.success(new ServiceResponseWithHeaders<>(serviceCallback.get(), result.getHeaders(), result.getResponse()));
                }
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) DateTime(org.joda.time.DateTime) ServiceResponseWithHeaders(com.microsoft.rest.ServiceResponseWithHeaders) ResponseBody(okhttp3.ResponseBody) PoolListPoolUsageMetricsOptions(com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) PoolUsageMetrics(com.microsoft.azure.batch.protocol.models.PoolUsageMetrics) List(java.util.List) PagedList(com.microsoft.azure.PagedList)

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