Search in sources :

Example 1 with PoolListPoolUsageMetricsHeaders

use of com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsHeaders 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<PoolUsageMetrics> 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 2 with PoolListPoolUsageMetricsHeaders

use of com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsHeaders 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)

Aggregations

PagedList (com.microsoft.azure.PagedList)2 PageImpl (com.microsoft.azure.batch.protocol.models.PageImpl)2 PoolListPoolUsageMetricsHeaders (com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsHeaders)2 PoolUsageMetrics (com.microsoft.azure.batch.protocol.models.PoolUsageMetrics)2 DateTimeRfc1123 (com.microsoft.rest.DateTimeRfc1123)2 ServiceResponseWithHeaders (com.microsoft.rest.ServiceResponseWithHeaders)2 ResponseBody (okhttp3.ResponseBody)2 DateTime (org.joda.time.DateTime)2 PoolListPoolUsageMetricsNextOptions (com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsNextOptions)1 PoolListPoolUsageMetricsOptions (com.microsoft.azure.batch.protocol.models.PoolListPoolUsageMetricsOptions)1