Search in sources :

Example 1 with ApplicationGetOptions

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

the class ApplicationsImpl method get.

/**
     * Gets information about the specified application.
     *
     * @param applicationId The id of the application.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the ApplicationSummary object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> get(String applicationId) throws BatchErrorException, IOException, IllegalArgumentException {
    if (applicationId == null) {
        throw new IllegalArgumentException("Parameter applicationId is required and cannot be null.");
    }
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    final ApplicationGetOptions applicationGetOptions = 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.get(applicationId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return getDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) ApplicationGetOptions(com.microsoft.azure.batch.protocol.models.ApplicationGetOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 2 with ApplicationGetOptions

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

the class ApplicationOperations method getApplication.

/**
     * Gets information about the specified application.
     *
     * @param applicationId The ID of the application to get.
     * @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
     * @return An {@link ApplicationSummary} containing information about the specified application.
     * @throws BatchErrorException Exception thrown from REST call
     * @throws IOException Exception thrown from serialization/deserialization
     */
public ApplicationSummary getApplication(String applicationId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
    ApplicationGetOptions options = new ApplicationGetOptions();
    BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
    bhMgr.applyRequestBehaviors(options);
    ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response = this._parentBatchClient.protocolLayer().applications().get(applicationId, options);
    return response.getBody();
}
Also used : ApplicationGetHeaders(com.microsoft.azure.batch.protocol.models.ApplicationGetHeaders) ApplicationGetOptions(com.microsoft.azure.batch.protocol.models.ApplicationGetOptions) ApplicationSummary(com.microsoft.azure.batch.protocol.models.ApplicationSummary)

Example 3 with ApplicationGetOptions

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

the class ApplicationsImpl method getAsync.

/**
     * Gets information about the specified application.
     *
     * @param applicationId The id of the application.
     * @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 getAsync(String applicationId, final ServiceCallback<ApplicationSummary> serviceCallback) throws IllegalArgumentException {
    if (serviceCallback == null) {
        throw new IllegalArgumentException("ServiceCallback is required for async calls.");
    }
    if (applicationId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter applicationId 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 ApplicationGetOptions applicationGetOptions = 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.get(applicationId, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<ApplicationSummary>(serviceCallback) {

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

Aggregations

ApplicationGetOptions (com.microsoft.azure.batch.protocol.models.ApplicationGetOptions)3 ApplicationSummary (com.microsoft.azure.batch.protocol.models.ApplicationSummary)2 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)2 ResponseBody (okhttp3.ResponseBody)2 DateTime (org.joda.time.DateTime)2 ApplicationGetHeaders (com.microsoft.azure.batch.protocol.models.ApplicationGetHeaders)1 ServiceCall (com.microsoft.rest.ServiceCall)1