Search in sources :

Example 56 with DateTimeRfc1123

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

the class JobsImpl method list.

/**
     * Lists all of the jobs in the specified account.
     *
     * @param jobListOptions 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 List<CloudJob> object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<CloudJob>, JobListHeaders> list(final JobListOptions jobListOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(jobListOptions);
    String filter = null;
    if (jobListOptions != null) {
        filter = jobListOptions.filter();
    }
    String select = null;
    if (jobListOptions != null) {
        select = jobListOptions.select();
    }
    String expand = null;
    if (jobListOptions != null) {
        expand = jobListOptions.expand();
    }
    Integer maxResults = null;
    if (jobListOptions != null) {
        maxResults = jobListOptions.maxResults();
    }
    Integer timeout = null;
    if (jobListOptions != null) {
        timeout = jobListOptions.timeout();
    }
    String clientRequestId = null;
    if (jobListOptions != null) {
        clientRequestId = jobListOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobListOptions != null) {
        returnClientRequestId = jobListOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobListOptions != null) {
        ocpDate = jobListOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    ServiceResponseWithHeaders<PageImpl<CloudJob>, JobListHeaders> response = listDelegate(call.execute());
    PagedList<CloudJob> result = new PagedList<CloudJob>(response.getBody()) {

        @Override
        public Page<CloudJob> nextPage(String nextPageLink) throws BatchErrorException, IOException {
            JobListNextOptions jobListNextOptions = null;
            if (jobListOptions != null) {
                jobListNextOptions = new JobListNextOptions();
                jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId());
                jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId());
                jobListNextOptions.withOcpDate(jobListOptions.ocpDate());
            }
            return listNext(nextPageLink, jobListNextOptions).getBody();
        }
    };
    return new ServiceResponseWithHeaders<>(result, response.getHeaders(), response.getResponse());
}
Also used : PageImpl(com.microsoft.azure.batch.protocol.models.PageImpl) PagedList(com.microsoft.azure.PagedList) DateTime(org.joda.time.DateTime) ServiceResponseWithHeaders(com.microsoft.rest.ServiceResponseWithHeaders) ResponseBody(okhttp3.ResponseBody) CloudJob(com.microsoft.azure.batch.protocol.models.CloudJob) JobListHeaders(com.microsoft.azure.batch.protocol.models.JobListHeaders) JobListNextOptions(com.microsoft.azure.batch.protocol.models.JobListNextOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 57 with DateTimeRfc1123

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

the class JobsImpl method add.

/**
     * Adds a job to the specified account.
     *
     * @param job The job to be added.
     * @param jobAddOptions 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, JobAddHeaders> add(JobAddParameter job, JobAddOptions jobAddOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (job == null) {
        throw new IllegalArgumentException("Parameter job 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(job);
    Validator.validate(jobAddOptions);
    Integer timeout = null;
    if (jobAddOptions != null) {
        timeout = jobAddOptions.timeout();
    }
    String clientRequestId = null;
    if (jobAddOptions != null) {
        clientRequestId = jobAddOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobAddOptions != null) {
        returnClientRequestId = jobAddOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobAddOptions != null) {
        ocpDate = jobAddOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.add(job, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return addDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 58 with DateTimeRfc1123

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

the class JobsImpl method listFromJobScheduleNext.

/**
     * Lists the jobs that have been created under the specified job schedule.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param jobListFromJobScheduleNextOptions 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 List&lt;CloudJob&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PageImpl<CloudJob>, JobListFromJobScheduleHeaders> listFromJobScheduleNext(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (nextPageLink == null) {
        throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
    }
    Validator.validate(jobListFromJobScheduleNextOptions);
    String clientRequestId = null;
    if (jobListFromJobScheduleNextOptions != null) {
        clientRequestId = jobListFromJobScheduleNextOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobListFromJobScheduleNextOptions != null) {
        returnClientRequestId = jobListFromJobScheduleNextOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobListFromJobScheduleNextOptions != null) {
        ocpDate = jobListFromJobScheduleNextOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.listFromJobScheduleNext(nextPageLink, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return listFromJobScheduleNextDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 59 with DateTimeRfc1123

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

the class JobsImpl method listAsync.

/**
     * Lists all of the jobs in the specified account.
     *
     * @param jobListOptions 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 listAsync(final JobListOptions jobListOptions, final ListOperationCallback<CloudJob> 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;
    }
    Validator.validate(jobListOptions, serviceCallback);
    String filter = null;
    if (jobListOptions != null) {
        filter = jobListOptions.filter();
    }
    String select = null;
    if (jobListOptions != null) {
        select = jobListOptions.select();
    }
    String expand = null;
    if (jobListOptions != null) {
        expand = jobListOptions.expand();
    }
    Integer maxResults = null;
    if (jobListOptions != null) {
        maxResults = jobListOptions.maxResults();
    }
    Integer timeout = null;
    if (jobListOptions != null) {
        timeout = jobListOptions.timeout();
    }
    String clientRequestId = null;
    if (jobListOptions != null) {
        clientRequestId = jobListOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobListOptions != null) {
        returnClientRequestId = jobListOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobListOptions != null) {
        ocpDate = jobListOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, expand, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    final ServiceCall serviceCall = new ServiceCall(call);
    call.enqueue(new ServiceResponseCallback<List<CloudJob>>(serviceCallback) {

        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
            try {
                ServiceResponseWithHeaders<PageImpl<CloudJob>, JobListHeaders> result = listDelegate(response);
                serviceCallback.load(result.getBody().getItems());
                if (result.getBody().getNextPageLink() != null && serviceCallback.progress(result.getBody().getItems()) == ListOperationCallback.PagingBahavior.CONTINUE) {
                    JobListNextOptions jobListNextOptions = null;
                    if (jobListOptions != null) {
                        jobListNextOptions = new JobListNextOptions();
                        jobListNextOptions.withClientRequestId(jobListOptions.clientRequestId());
                        jobListNextOptions.withReturnClientRequestId(jobListOptions.returnClientRequestId());
                        jobListNextOptions.withOcpDate(jobListOptions.ocpDate());
                    }
                    listNextAsync(result.getBody().getNextPageLink(), jobListNextOptions, 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) CloudJob(com.microsoft.azure.batch.protocol.models.CloudJob) JobListNextOptions(com.microsoft.azure.batch.protocol.models.JobListNextOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) List(java.util.List) PagedList(com.microsoft.azure.PagedList)

Example 60 with DateTimeRfc1123

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

the class JobsImpl method listFromJobScheduleNext.

/**
     * Lists the jobs that have been created under the specified job schedule.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the List&lt;CloudJob&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PageImpl<CloudJob>, JobListFromJobScheduleHeaders> listFromJobScheduleNext(final String nextPageLink) throws BatchErrorException, IOException, IllegalArgumentException {
    if (nextPageLink == null) {
        throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
    }
    final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null;
    String clientRequestId = null;
    Boolean returnClientRequestId = null;
    DateTime ocpDate = null;
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.listFromJobScheduleNext(nextPageLink, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return listFromJobScheduleNextDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) JobListFromJobScheduleNextOptions(com.microsoft.azure.batch.protocol.models.JobListFromJobScheduleNextOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Aggregations

DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)349 DateTime (org.joda.time.DateTime)349 ResponseBody (okhttp3.ResponseBody)332 ServiceCall (com.microsoft.rest.ServiceCall)148 PagedList (com.microsoft.azure.PagedList)78 ServiceResponseWithHeaders (com.microsoft.rest.ServiceResponseWithHeaders)78 List (java.util.List)52 PageImpl (com.microsoft.azure.batch.protocol.models.PageImpl)26 CloudJob (com.microsoft.azure.batch.protocol.models.CloudJob)14 NodeFile (com.microsoft.azure.batch.protocol.models.NodeFile)12 ApplicationSummary (com.microsoft.azure.batch.protocol.models.ApplicationSummary)8 Certificate (com.microsoft.azure.batch.protocol.models.Certificate)8 CloudJobSchedule (com.microsoft.azure.batch.protocol.models.CloudJobSchedule)8 CloudPool (com.microsoft.azure.batch.protocol.models.CloudPool)8 CloudTask (com.microsoft.azure.batch.protocol.models.CloudTask)8 ComputeNode (com.microsoft.azure.batch.protocol.models.ComputeNode)8 PoolUsageMetrics (com.microsoft.azure.batch.protocol.models.PoolUsageMetrics)6 InputStream (java.io.InputStream)6 JobPreparationAndReleaseTaskExecutionInformation (com.microsoft.azure.batch.protocol.models.JobPreparationAndReleaseTaskExecutionInformation)5 ApplicationListNextOptions (com.microsoft.azure.batch.protocol.models.ApplicationListNextOptions)4