Search in sources :

Example 86 with DateTimeRfc1123

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

the class JobSchedulesImpl method list.

/**
     * Lists all of the job schedules in the specified account.
     *
     * @param jobScheduleListOptions 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<CloudJobSchedule> object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<CloudJobSchedule>, JobScheduleListHeaders> list(final JobScheduleListOptions jobScheduleListOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(jobScheduleListOptions);
    String filter = null;
    if (jobScheduleListOptions != null) {
        filter = jobScheduleListOptions.filter();
    }
    String select = null;
    if (jobScheduleListOptions != null) {
        select = jobScheduleListOptions.select();
    }
    String expand = null;
    if (jobScheduleListOptions != null) {
        expand = jobScheduleListOptions.expand();
    }
    Integer maxResults = null;
    if (jobScheduleListOptions != null) {
        maxResults = jobScheduleListOptions.maxResults();
    }
    Integer timeout = null;
    if (jobScheduleListOptions != null) {
        timeout = jobScheduleListOptions.timeout();
    }
    String clientRequestId = null;
    if (jobScheduleListOptions != null) {
        clientRequestId = jobScheduleListOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobScheduleListOptions != null) {
        returnClientRequestId = jobScheduleListOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobScheduleListOptions != null) {
        ocpDate = jobScheduleListOptions.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<CloudJobSchedule>, JobScheduleListHeaders> response = listDelegate(call.execute());
    PagedList<CloudJobSchedule> result = new PagedList<CloudJobSchedule>(response.getBody()) {

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

Example 87 with DateTimeRfc1123

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

the class JobSchedulesImpl method listNext.

/**
     * Lists all of the job schedules in the specified account.
     *
     * @param nextPageLink The NextLink from the previous successful call to List operation.
     * @param jobScheduleListNextOptions 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;CloudJobSchedule&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PageImpl<CloudJobSchedule>, JobScheduleListHeaders> listNext(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (nextPageLink == null) {
        throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
    }
    Validator.validate(jobScheduleListNextOptions);
    String clientRequestId = null;
    if (jobScheduleListNextOptions != null) {
        clientRequestId = jobScheduleListNextOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobScheduleListNextOptions != null) {
        returnClientRequestId = jobScheduleListNextOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobScheduleListNextOptions != null) {
        ocpDate = jobScheduleListNextOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.listNext(nextPageLink, this.client.acceptLanguage(), clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return listNextDelegate(call.execute());
}
Also used : DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 88 with DateTimeRfc1123

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

the class JobSchedulesImpl method patchAsync.

/**
     * Updates the properties of the specified job schedule.
     *
     * @param jobScheduleId The id of the job schedule to update.
     * @param jobSchedulePatchParameter 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 patchAsync(String jobScheduleId, JobSchedulePatchParameter jobSchedulePatchParameter, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
    if (serviceCallback == null) {
        throw new IllegalArgumentException("ServiceCallback is required for async calls.");
    }
    if (jobScheduleId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId is required and cannot be null."));
        return null;
    }
    if (jobSchedulePatchParameter == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter jobSchedulePatchParameter 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(jobSchedulePatchParameter, serviceCallback);
    final JobSchedulePatchOptions jobSchedulePatchOptions = 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;
    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.patch(jobScheduleId, jobSchedulePatchParameter, 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(patchDelegate(response));
            } catch (BatchErrorException | IOException exception) {
                serviceCallback.failure(exception);
            }
        }
    });
    return serviceCall;
}
Also used : ServiceCall(com.microsoft.rest.ServiceCall) JobSchedulePatchOptions(com.microsoft.azure.batch.protocol.models.JobSchedulePatchOptions) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 89 with DateTimeRfc1123

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

the class JobSchedulesImpl method add.

/**
     * Adds a job schedule to the specified account.
     *
     * @param cloudJobSchedule The job schedule to be added.
     * @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, JobScheduleAddHeaders> add(JobScheduleAddParameter cloudJobSchedule) throws BatchErrorException, IOException, IllegalArgumentException {
    if (cloudJobSchedule == null) {
        throw new IllegalArgumentException("Parameter cloudJobSchedule 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(cloudJobSchedule);
    final JobScheduleAddOptions jobScheduleAddOptions = 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.add(cloudJobSchedule, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    return addDelegate(call.execute());
}
Also used : JobScheduleAddOptions(com.microsoft.azure.batch.protocol.models.JobScheduleAddOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) DateTime(org.joda.time.DateTime) ResponseBody(okhttp3.ResponseBody)

Example 90 with DateTimeRfc1123

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

the class JobSchedulesImpl method existsAsync.

/**
     * Checks the specified job schedule exists.
     *
     * @param jobScheduleId The id of the job schedule which you want to check.
     * @param jobScheduleExistsOptions 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 jobScheduleId, JobScheduleExistsOptions jobScheduleExistsOptions, final ServiceCallback<Boolean> serviceCallback) throws IllegalArgumentException {
    if (serviceCallback == null) {
        throw new IllegalArgumentException("ServiceCallback is required for async calls.");
    }
    if (jobScheduleId == null) {
        serviceCallback.failure(new IllegalArgumentException("Parameter jobScheduleId 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(jobScheduleExistsOptions, serviceCallback);
    Integer timeout = null;
    if (jobScheduleExistsOptions != null) {
        timeout = jobScheduleExistsOptions.timeout();
    }
    String clientRequestId = null;
    if (jobScheduleExistsOptions != null) {
        clientRequestId = jobScheduleExistsOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (jobScheduleExistsOptions != null) {
        returnClientRequestId = jobScheduleExistsOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (jobScheduleExistsOptions != null) {
        ocpDate = jobScheduleExistsOptions.ocpDate();
    }
    String ifMatch = null;
    if (jobScheduleExistsOptions != null) {
        ifMatch = jobScheduleExistsOptions.ifMatch();
    }
    String ifNoneMatch = null;
    if (jobScheduleExistsOptions != null) {
        ifNoneMatch = jobScheduleExistsOptions.ifNoneMatch();
    }
    DateTime ifModifiedSince = null;
    if (jobScheduleExistsOptions != null) {
        ifModifiedSince = jobScheduleExistsOptions.ifModifiedSince();
    }
    DateTime ifUnmodifiedSince = null;
    if (jobScheduleExistsOptions != null) {
        ifUnmodifiedSince = jobScheduleExistsOptions.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(jobScheduleId, 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)

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