Class SuiteApiClient

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    
    public final class SuiteApiClient
     implements AutoCloseable
                        

    Class that simplifies making calls to VMware Aria Operations' Suite API

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer getMaxConnections() Sets the maximum number of concurrent connections allowed.
      final Unit setMaxConnections(Integer maxConnections)
      final SuiteApiConnectionInfo getConnectionInfo() Connection and credential information for connecting to the SuiteAPI
      final JsonObject get(String endpoint) Performs a GET operation on the given endpoint.
      final JsonObject getAsync(String endpoint) A Kotlin suspend method that performs a GET operation on the given endpoint.
      final HttpResponse getRawResponse(String endpoint) Performs a GET operation on the given endpoint.
      final HttpResponse getRawResponseAsync(String endpoint) A Kotlin suspend method that performs a GET operation on the given endpoint.
      final JsonObject getPaged(String endpoint, String pagedArrayKey, Integer pageSize) A method that performs a paged GET operation on the given endpoint.
      final JsonObject getPaged(String endpoint, String pagedArrayKey) A method that performs a paged GET operation on the given endpoint.
      final JsonObject getPagedAsync(String endpoint, String pagedArrayKey, Integer pageSize) A Kotlin suspend method that performs a paged GET operation on the given endpoint.
      final JsonObject getPagedAsync(String endpoint, String pagedArrayKey) A Kotlin suspend method that performs a paged GET operation on the given endpoint.
      final JsonObject post(String endpoint, JsonObject jsonBody) A method that performs a POST operation on the given endpoint.
      final JsonObject postAsync(String endpoint, JsonObject jsonBody) A Kotlin suspend method that performs a POST operation on the given endpoint.
      final HttpResponse postRawResponse(String endpoint, JsonObject jsonBody) A method that performs a POST operation on the given endpoint.
      final HttpResponse postRawResponseAsync(String endpoint, JsonObject jsonBody) A Kotlin suspend method that performs a POST operation on the given endpoint.
      final JsonObject postPaged(String endpoint, JsonObject jsonBody, String pagedArrayKey, Integer pageSize) A method that performs a paged POST operation on the given endpoint.
      final JsonObject postPaged(String endpoint, JsonObject jsonBody, String pagedArrayKey) A method that performs a paged POST operation on the given endpoint.
      final JsonObject postPagedAsync(String endpoint, JsonObject jsonBody, String pagedArrayKey, Integer pageSize) A Kotlin suspend method that performs a paged POST operation on the given endpoint.
      final JsonObject postPagedAsync(String endpoint, JsonObject jsonBody, String pagedArrayKey) A Kotlin suspend method that performs a paged POST operation on the given endpoint.
      final Unit delete(String endpoint) A method that performs a DELETE operation on the given endpoint.
      final Unit deleteAsync(String endpoint) A Kotlin suspend method that performs a DELETE operation on the given endpoint.
      final List<Object> queryForResources(JsonObject query) Query for resources using the Suite API, and convert the responses to SDK Objects.
      Unit close() Releases the token if present and closes any features of the client that require closing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMaxConnections

         final Integer getMaxConnections()

        Sets the maximum number of concurrent connections allowed. The default value is 10. Note: Any existing connections when this method is called will not be bound by the new limit.

      • get

         final JsonObject get(String endpoint)

        Performs a GET operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        Returns:

        A JsonObject containing the content as a json object. Throws if the response code is not 2xx.

      • getAsync

         final JsonObject getAsync(String endpoint)

        A Kotlin suspend method that performs a GET operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        Returns:

        A JsonObject containing the content as a json object. Throws if the response code is not 2xx.

      • getRawResponse

         final HttpResponse getRawResponse(String endpoint)

        Performs a GET operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to perform a get request on
      • getRawResponseAsync

         final HttpResponse getRawResponseAsync(String endpoint)

        A Kotlin suspend method that performs a GET operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        Returns:

        An HttpResponse containing the return code and content

      • getPaged

        @JvmOverloads() final JsonObject getPaged(String endpoint, String pagedArrayKey, Integer pageSize)

        A method that performs a paged GET operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all of paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        pageSize - The number of elements to return with each page
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • getPaged

        @JvmOverloads() final JsonObject getPaged(String endpoint, String pagedArrayKey)

        A method that performs a paged GET operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all of paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • getPagedAsync

        @JvmOverloads() final JsonObject getPagedAsync(String endpoint, String pagedArrayKey, Integer pageSize)

        A Kotlin suspend method that performs a paged GET operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all of paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        pageSize - The number of elements to return with each page
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • getPagedAsync

        @JvmOverloads() final JsonObject getPagedAsync(String endpoint, String pagedArrayKey)

        A Kotlin suspend method that performs a paged GET operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all of paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • post

         final JsonObject post(String endpoint, JsonObject jsonBody)

        A method that performs a POST operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        jsonBody - A json object containing the payload of the POST request.
        Returns:

        A JsonObject containing the content as a json object. Throws if the response code is not 2xx.

      • postAsync

         final JsonObject postAsync(String endpoint, JsonObject jsonBody)

        A Kotlin suspend method that performs a POST operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        jsonBody - A json object containing the payload of the POST request.
        Returns:

        A JsonObject containing the content as a json object. Throws if the response code is not 2xx.

      • postRawResponse

         final HttpResponse postRawResponse(String endpoint, JsonObject jsonBody)

        A method that performs a POST operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        jsonBody - A json object containing the payload of the POST request.
        Returns:

        An HttpResponse containing the return code and content

      • postRawResponseAsync

         final HttpResponse postRawResponseAsync(String endpoint, JsonObject jsonBody)

        A Kotlin suspend method that performs a POST operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
        jsonBody - A json object containing the payload of the POST request.
        Returns:

        An HttpResponse containing the return code and content

      • postPaged

        @JvmOverloads() final JsonObject postPaged(String endpoint, JsonObject jsonBody, String pagedArrayKey, Integer pageSize)

        A method that performs a paged POST operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all the paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        pageSize - The number of elements to return with each page
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • postPaged

        @JvmOverloads() final JsonObject postPaged(String endpoint, JsonObject jsonBody, String pagedArrayKey)

        A method that performs a paged POST operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all the paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • postPagedAsync

        @JvmOverloads() final JsonObject postPagedAsync(String endpoint, JsonObject jsonBody, String pagedArrayKey, Integer pageSize)

        A Kotlin suspend method that performs a paged POST operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all the paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        pageSize - The number of elements to return with each page
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • postPagedAsync

        @JvmOverloads() final JsonObject postPagedAsync(String endpoint, JsonObject jsonBody, String pagedArrayKey)

        A Kotlin suspend method that performs a paged POST operation on the given endpoint. After the first GET operation succeeds, subsequent GET requests will be done concurrently (with a max of maxConnections concurrent requests) until all the paged data has been retrieved.

        Parameters:
        endpoint - The API endpoint to call
        pagedArrayKey - The key on each returned json object to combine.
        Returns:

        A JsonObject containing the content as a json object. The object will contain the key pagedArrayKey that contains all the paged data combined into a single array.

      • delete

         final Unit delete(String endpoint)

        A method that performs a DELETE operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
      • deleteAsync

         final Unit deleteAsync(String endpoint)

        A Kotlin suspend method that performs a DELETE operation on the given endpoint.

        Parameters:
        endpoint - The API endpoint to call
      • queryForResources

         final List<Object> queryForResources(JsonObject query)

        Query for resources using the Suite API, and convert the responses to SDK Objects.

        Note that not all information from the query is returned. For example, the query returns health statuses of each object, but those are not present in the resulting Objects. If information other than the Object itself is needed, you will need to call the endpoint and process the results manually.

        Parameters:
        query - : json of the resourceQuery, as defined in the SuiteAPI docs: https://[aria-ops-hostname]/suite-api/doc/swagger-ui.
        Returns:

        list of sdk Objects representing each of the returned objects.

      • close

         Unit close()

        Releases the token if present and closes any features of the client that require closing