StreamsConnection (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.rest

## Class StreamsConnection

- java.lang.Object
- - com.ibm.streamsx.rest.StreamsConnection

-     public class StreamsConnection
      extends java.lang.Object

  Connection to IBM Streams.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allowInsecureHosts(boolean allowInsecure)` This function is used to disable checking the trusted certificate chain and should never be used in production environments
    `static StreamsConnection` | `createInstance(java.lang.String userName, java.lang.String authToken, java.lang.String url)` Create a connection to IBM Streams REST API.
    `java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String>` | `getAuthenticator()`
    `Instance` | `getInstance(java.lang.String instanceId)` Gets a specific `instance` identified by the instanceId at this IBM Streams connection
    `java.util.List<Instance>` | `getInstances()` Gets a list of `instances` that are available to this IBM Streams connection
    `boolean` | `isVerify()`
    `static StreamsConnection` | `ofAuthenticator(java.lang.String url, java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String> authenticator)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### createInstance

          public static StreamsConnection createInstance(java.lang.String userName,
                                                         java.lang.String authToken,
                                                         java.lang.String url)

      Create a connection to IBM Streams REST API.
      Parameters:
        `userName` - String representing the user name to connect to the instance. If `null` user name defaults to value of the environment variable `STREAMS_USERNAME` if set, else the value of the Java system property `user.name`.
        `authToken` - String representing the password to connect to the instance. If `null` password defaults to value of the environment variable `STREAMS_PASSWORD` if set.
        `url` - String representing the root url to the REST API. If `null` password defaults to value of the environment variable `STREAMS_REST_URL` if set.
      Returns:
        a connection to IBM Streams

    - #### ofAuthenticator

          public static StreamsConnection ofAuthenticator(java.lang.String url,
                                                          java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String> authenticator)

    - #### getAuthenticator

          public java.util.function.Function<org.apache.http.client.fluent.Executor,java.lang.String> getAuthenticator()

    - #### allowInsecureHosts

          public boolean allowInsecureHosts(boolean allowInsecure)

      This function is used to disable checking the trusted certificate chain and should never be used in production environments
      Parameters:
        `allowInsecure` -
        - true - disables checking
        - false - enables checking (default)
      Returns:
        a boolean indicating the state of the connection after this method was called.
        - true - if checking is disabled
        - false - if checking is enabled

    - #### isVerify

          public final boolean isVerify()

    - #### getInstance

          public Instance getInstance(java.lang.String instanceId)
                               throws java.io.IOException

      Gets a specific `instance` identified by the instanceId at this IBM Streams connection
      Parameters:
        `instanceId` - name of the instance to be retrieved
      Returns:
        a single `Instance`
      Throws:
        `java.io.IOException`

    - #### getInstances

          public java.util.List<Instance> getInstances()
                                                throws java.io.IOException

      Gets a list of `instances` that are available to this IBM Streams connection
      Returns:
        List of `IBM Streams Instances` available to this connection
      Throws:
        `java.io.IOException`