Search in sources :

Example 1 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.
     * @throws BatchErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the List<ComputeNode> object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<ComputeNode>, ComputeNodeListHeaders> list(final String poolId) 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.");
    }
    final ComputeNodeListOptions computeNodeListOptions = 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(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 {
            return listNext(nextPageLink, null).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) ComputeNodeListOptions(com.microsoft.azure.batch.protocol.models.ComputeNodeListOptions) DateTime(org.joda.time.DateTime) ServiceResponseWithHeaders(com.microsoft.rest.ServiceResponseWithHeaders) ResponseBody(okhttp3.ResponseBody) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123)

Example 2 with PageImpl

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

the class PoolsImpl method listPoolUsageMetrics.

/**
     * Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
     *
     * @param poolListPoolUsageMetricsOptions 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;PoolUsageMetrics&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> listPoolUsageMetrics(final PoolListPoolUsageMetricsOptions poolListPoolUsageMetricsOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(poolListPoolUsageMetricsOptions);
    DateTime startTime = null;
    if (poolListPoolUsageMetricsOptions != null) {
        startTime = poolListPoolUsageMetricsOptions.startTime();
    }
    DateTime endTime = null;
    if (poolListPoolUsageMetricsOptions != null) {
        endTime = poolListPoolUsageMetricsOptions.endTime();
    }
    String filter = null;
    if (poolListPoolUsageMetricsOptions != null) {
        filter = poolListPoolUsageMetricsOptions.filter();
    }
    Integer maxResults = null;
    if (poolListPoolUsageMetricsOptions != null) {
        maxResults = poolListPoolUsageMetricsOptions.maxResults();
    }
    Integer timeout = null;
    if (poolListPoolUsageMetricsOptions != null) {
        timeout = poolListPoolUsageMetricsOptions.timeout();
    }
    String clientRequestId = null;
    if (poolListPoolUsageMetricsOptions != null) {
        clientRequestId = poolListPoolUsageMetricsOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (poolListPoolUsageMetricsOptions != null) {
        returnClientRequestId = poolListPoolUsageMetricsOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (poolListPoolUsageMetricsOptions != null) {
        ocpDate = poolListPoolUsageMetricsOptions.ocpDate();
    }
    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());
    ServiceResponseWithHeaders<PageImpl<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> response = listPoolUsageMetricsDelegate(call.execute());
    PagedList<PoolUsageMetrics> result = new PagedList<PoolUsageMetrics>(response.getBody()) {

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

Example 3 with PageImpl

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

the class PoolsImpl method listPoolUsageMetrics.

/**
     * Lists the usage metrics, aggregated by pool across individual time intervals, for 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;PoolUsageMetrics&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> listPoolUsageMetrics() throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be 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());
    ServiceResponseWithHeaders<PageImpl<PoolUsageMetrics>, PoolListPoolUsageMetricsHeaders> response = listPoolUsageMetricsDelegate(call.execute());
    PagedList<PoolUsageMetrics> result = new PagedList<PoolUsageMetrics>(response.getBody()) {

        @Override
        public Page<PoolUsageMetrics> nextPage(String nextPageLink) throws BatchErrorException, IOException {
            return listPoolUsageMetricsNext(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) PoolListPoolUsageMetricsOptions(com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsOptions) DateTimeRfc1123(com.microsoft.rest.DateTimeRfc1123) PoolUsageMetrics(com.microsoft.azure.batch.protocol.models.PoolUsageMetrics) PoolListPoolUsageMetricsHeaders(com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsHeaders)

Example 4 with PageImpl

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

the class PoolsImpl method list.

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

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

Example 5 with PageImpl

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

the class AccountsImpl method listNodeAgentSkus.

/**
     * Lists all node agent SKUs supported by the Azure Batch service.
     *
     * @param accountListNodeAgentSkusOptions 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;NodeAgentSku&gt; object wrapped in {@link ServiceResponseWithHeaders} if successful.
     */
public ServiceResponseWithHeaders<PagedList<NodeAgentSku>, AccountListNodeAgentSkusHeaders> listNodeAgentSkus(final AccountListNodeAgentSkusOptions accountListNodeAgentSkusOptions) throws BatchErrorException, IOException, IllegalArgumentException {
    if (this.client.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
    }
    Validator.validate(accountListNodeAgentSkusOptions);
    String filter = null;
    if (accountListNodeAgentSkusOptions != null) {
        filter = accountListNodeAgentSkusOptions.filter();
    }
    Integer maxResults = null;
    if (accountListNodeAgentSkusOptions != null) {
        maxResults = accountListNodeAgentSkusOptions.maxResults();
    }
    Integer timeout = null;
    if (accountListNodeAgentSkusOptions != null) {
        timeout = accountListNodeAgentSkusOptions.timeout();
    }
    String clientRequestId = null;
    if (accountListNodeAgentSkusOptions != null) {
        clientRequestId = accountListNodeAgentSkusOptions.clientRequestId();
    }
    Boolean returnClientRequestId = null;
    if (accountListNodeAgentSkusOptions != null) {
        returnClientRequestId = accountListNodeAgentSkusOptions.returnClientRequestId();
    }
    DateTime ocpDate = null;
    if (accountListNodeAgentSkusOptions != null) {
        ocpDate = accountListNodeAgentSkusOptions.ocpDate();
    }
    DateTimeRfc1123 ocpDateConverted = null;
    if (ocpDate != null) {
        ocpDateConverted = new DateTimeRfc1123(ocpDate);
    }
    Call<ResponseBody> call = service.listNodeAgentSkus(this.client.apiVersion(), this.client.acceptLanguage(), filter, maxResults, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
    ServiceResponseWithHeaders<PageImpl<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusDelegate(call.execute());
    PagedList<NodeAgentSku> result = new PagedList<NodeAgentSku>(response.getBody()) {

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

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