Search in sources :

Example 16 with PageImpl

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

the class FilesImpl method listFromTask.

/**
     * Lists the files in a task's directory on its compute node.
     *
     * @param jobId The id of the job that contains the task.
     * @param taskId The id of the task whose files you want to list.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the List<NodeFile> object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<NodeFile>, FileListFromTaskHeaders> listFromTask(final String jobId, final String taskId) throws BatchErrorException, IOException, IllegalArgumentException {
    if (jobId == null) {
        throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
    }
    if (taskId == null) {
        throw new IllegalArgumentException("Parameter taskId 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 Boolean recursive = null;
    final FileListFromTaskOptions fileListFromTaskOptions = 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.listFromTask(jobId, taskId, recursive, this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    ServiceResponseWithHeaders<PageImpl<NodeFile>, FileListFromTaskHeaders> response = listFromTaskDelegate(call.execute());
    PagedList<NodeFile> result = new PagedList<NodeFile>(response.getBody()) {

        @Override
        public Page<NodeFile> nextPage(String nextPageLink) throws BatchErrorException, IOException {
            return listFromTaskNext(nextPageLink, null).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) FileListFromTaskHeaders(com.microsoft.azure.batch.protocol.models.FileListFromTaskHeaders) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) NodeFile(com.microsoft.azure.batch.protocol.models.NodeFile) FileListFromTaskOptions(com.microsoft.azure.batch.protocol.models.FileListFromTaskOptions)

Example 17 with PageImpl

use of com.microsoft.azure.batch.protocol.models.PageImpl 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&lt;CloudJob&gt; 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 18 with PageImpl

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

the class ApplicationsImpl method list.

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

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

Example 19 with PageImpl

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

the class ComputeNodesImpl method list.

/**
     * Lists the compute nodes in the specified pool.
     *
     * @param poolId The id of the pool from which you want to list nodes.
     * @param computeNodeListOptions 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;ComputeNode&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<ComputeNode>, ComputeNodeListHeaders> list(final String poolId, final ComputeNodeListOptions computeNodeListOptions) 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.");
    }
    Validator.validate(computeNodeListOptions);
    String filter = null;
    if (computeNodeListOptions != null) {
        filter = computeNodeListOptions.filter();
    }
    String select = null;
    if (computeNodeListOptions != null) {
        select = computeNodeListOptions.select();
    }
    Integer maxResults = null;
    if (computeNodeListOptions != null) {
        maxResults = computeNodeListOptions.maxResults();
    }
    Integer timeout = null;
    if (computeNodeListOptions != null) {
        timeout = computeNodeListOptions.timeout();
    }
    String clientRequestId = null;
    if (computeNodeListOptions != null) {
        clientRequestId = computeNodeListOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (computeNodeListOptions != null) {
        returnClientRequestId = computeNodeListOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (computeNodeListOptions != null) {
        ocpDate = computeNodeListOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.list(poolId, this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    ServiceResponseWithHeaders<PageImpl<ComputeNode>, ComputeNodeListHeaders> response = listDelegate(call.execute());
    PagedList<ComputeNode> result = new PagedList<ComputeNode>(response.getBody()) {

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

Example 20 with PageImpl

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

the class CertificatesImpl method list.

/**
     * Lists all of the certificates that have been added to the specified account.
     *
     * @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;Certificate&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<Certificate>, CertificateListHeaders> list() throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    final CertificateListOptions certificateListOptions = null;
    String filter = null;
    String select = 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.list(this.client.apiVersion(), this.client.acceptLanguage(), filter, select, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    ServiceResponseWithHeaders<PageImpl<Certificate>, CertificateListHeaders> response = listDelegate(call.execute());
    PagedList<Certificate> result = new PagedList<Certificate>(response.getBody()) {

        @Override
        public Page<Certificate> nextPage(String nextPageLink) throws BatchErrorException, IOException {
            return listNext(nextPageLink, null).getBody();
        }
    };
    return new ServiceResponseWithHeaders<>(result, response.getHeaders(), response.getResponse());
}
Also used : PageImpl(com.microsoft.azure.batch.protocol.models.PageImpl) PagedList(com.microsoft.azure.PagedList) CertificateListHeaders(com.microsoft.azure.batch.protocol.models.CertificateListHeaders) DateTime(org.joda.time.DateTime) ServiceResponseWithHeaders(com.microsoft.rest.ServiceResponseWithHeaders) ResponseBody(okhttp3.ResponseBody) CertificateListOptions(com.microsoft.azure.batch.protocol.models.CertificateListOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) Certificate(com.microsoft.azure.batch.protocol.models.Certificate)

Aggregations

PagedList (com.microsoft.azure.PagedList)26 PageImpl (com.microsoft.azure.batch.protocol.models.PageImpl)26 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)26 ServiceResponseWithHeaders (com.microsoft.rest.ServiceResponseWithHeaders)26 ResponseBody (okhttp3.ResponseBody)26 DateTime (org.joda.time.DateTime)26 CloudJob (com.microsoft.azure.batch.protocol.models.CloudJob)4 NodeFile (com.microsoft.azure.batch.protocol.models.NodeFile)4 AccountListNodeAgentSkusHeaders (com.microsoft.azure.batch.protocol.models.AccountListNodeAgentSkusHeaders)2 ApplicationListHeaders (com.microsoft.azure.batch.protocol.models.ApplicationListHeaders)2 ApplicationSummary (com.microsoft.azure.batch.protocol.models.ApplicationSummary)2 Certificate (com.microsoft.azure.batch.protocol.models.Certificate)2 CertificateListHeaders (com.microsoft.azure.batch.protocol.models.CertificateListHeaders)2 CloudJobSchedule (com.microsoft.azure.batch.protocol.models.CloudJobSchedule)2 CloudPool (com.microsoft.azure.batch.protocol.models.CloudPool)2 CloudTask (com.microsoft.azure.batch.protocol.models.CloudTask)2 ComputeNode (com.microsoft.azure.batch.protocol.models.ComputeNode)2 ComputeNodeListHeaders (com.microsoft.azure.batch.protocol.models.ComputeNodeListHeaders)2 FileListFromComputeNodeHeaders (com.microsoft.azure.batch.protocol.models.FileListFromComputeNodeHeaders)2 FileListFromTaskHeaders (com.microsoft.azure.batch.protocol.models.FileListFromTaskHeaders)2