All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.seeq.api.MonitorsApi Maven / Gradle / Ivy

There is a newer version: 66.0.0-v202410141803
Show newest version
package com.seeq.api;

import com.seeq.ApiException;
import com.seeq.ApiClient;
import com.seeq.Configuration;
import com.seeq.model.*;
import com.seeq.Pair;

import javax.ws.rs.core.GenericType;
import javax.ws.rs.ProcessingException;

import com.seeq.model.GaugeDatumV1;
import com.seeq.model.MeterDatumV1;
import com.seeq.model.MonitorDefinitionsOutputV1;
import com.seeq.model.MonitorInputV1;
import com.seeq.model.MonitorOutputV1;
import com.seeq.model.MonitorsOutputV1;
import com.seeq.model.StatusMessageBase;
import com.seeq.model.TimerDatumV1;


  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;

  public class MonitorsApi {
  private ApiClient apiClient;
  private long retryTimeout = 5_000; // Default of 5 seconds

  public MonitorsApi() {
  this(Configuration.getDefaultApiClient());
  }

  public MonitorsApi(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

  public void setRetryTimeout(long retryTimeout) {
    this.retryTimeout = retryTimeout;
  }

  public long getRetryTimeout() {
    return this.retryTimeout;
  }

  public ApiClient getApiClient() {
  return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

    /**
    * Retrieve the current value of the specified monitor. All times are in milliseconds
    * 
      * @param monitorPath Path of the monitor to read (required)
      * @return MonitorOutputV1
    * @throws ApiException if fails to make API call
    */
    public MonitorOutputV1 getMonitor(String monitorPath) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getMonitorWithHttpInfo(monitorPath);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Retrieve the current value of the specified monitor. All times are in milliseconds
    * 
      * @param monitorPath Path of the monitor to read (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorWithHttpInfo(String monitorPath) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getMonitorWithHeadersAndHttpInfo(monitorPath, localVarHeaderParams);
      
    }

    /**
    * Retrieve the current value of the specified monitor. All times are in milliseconds
    * 
      * @param monitorPath Path of the monitor to read (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorWithHeadersAndHttpInfo(String monitorPath, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'monitorPath' is set
      if (monitorPath == null) {
      throw new ApiException(400, "Missing the required parameter 'monitorPath' when calling getMonitor");
      }
    // create path and map variables
    String localVarPath = "/system/monitors/{monitorPath}"
      .replaceAll("\\{" + "monitorPath" + "\\}", apiClient.escapeString(monitorPath.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Retrieve the documentation for all available monitors
    * 
      * @return MonitorDefinitionsOutputV1
    * @throws ApiException if fails to make API call
    */
    public MonitorDefinitionsOutputV1 getMonitorDocumentation() throws ApiException {
        ApiClient.ApiResponse localVarResponse = getMonitorDocumentationWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Retrieve the documentation for all available monitors
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorDocumentationWithHttpInfo() throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getMonitorDocumentationWithHeadersAndHttpInfo(localVarHeaderParams);
      
    }

    /**
    * Retrieve the documentation for all available monitors
    * 
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorDocumentationWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/system/monitors/definitions";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Retrieve the paths of all available monitors
    * 
      * @return MonitorsOutputV1
    * @throws ApiException if fails to make API call
    */
    public MonitorsOutputV1 getMonitors() throws ApiException {
        ApiClient.ApiResponse localVarResponse = getMonitorsWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Retrieve the paths of all available monitors
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorsWithHttpInfo() throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getMonitorsWithHeadersAndHttpInfo(localVarHeaderParams);
      
    }

    /**
    * Retrieve the paths of all available monitors
    * 
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getMonitorsWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/system/monitors";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Update a gauge
    * 
      * @param body current value of the gauge (optional)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase postGaugeData(GaugeDatumV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = postGaugeDataWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Update a gauge
    * 
      * @param body current value of the gauge (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postGaugeDataWithHttpInfo(GaugeDatumV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return postGaugeDataWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Update a gauge
    * 
      * @param body current value of the gauge (optional)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postGaugeDataWithHeadersAndHttpInfo(GaugeDatumV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
    // create path and map variables
    String localVarPath = "/system/monitors/gauge";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Increment a meter
    * 
      * @param body monitor name and arguments (optional)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase postMeterData(MeterDatumV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = postMeterDataWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Increment a meter
    * 
      * @param body monitor name and arguments (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postMeterDataWithHttpInfo(MeterDatumV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return postMeterDataWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Increment a meter
    * 
      * @param body monitor name and arguments (optional)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postMeterDataWithHeadersAndHttpInfo(MeterDatumV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
    // create path and map variables
    String localVarPath = "/system/monitors/meter";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Post monitor data
    * 
      * @param body Dump of current monitor statistics (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase postMonitorData(MonitorInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = postMonitorDataWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Post monitor data
    * 
      * @param body Dump of current monitor statistics (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postMonitorDataWithHttpInfo(MonitorInputV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return postMonitorDataWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Post monitor data
    * 
      * @param body Dump of current monitor statistics (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postMonitorDataWithHeadersAndHttpInfo(MonitorInputV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
      // verify the required parameter 'body' is set
      if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling postMonitorData");
      }
    // create path and map variables
    String localVarPath = "/system/monitors";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    /**
    * Update a timer
    * 
      * @param body name of this timer (required)
      * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase postTimerData(TimerDatumV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = postTimerDataWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Update a timer
    * 
      * @param body name of this timer (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postTimerDataWithHttpInfo(TimerDatumV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return postTimerDataWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Update a timer
    * 
      * @param body name of this timer (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse postTimerDataWithHeadersAndHttpInfo(TimerDatumV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
      // verify the required parameter 'body' is set
      if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling postTimerData");
      }
    // create path and map variables
    String localVarPath = "/system/monitors/timer";

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy