Class OpenSearchConnector

java.lang.Object
ai.attackframework.tools.burp.utils.opensearch.OpenSearchConnector

public final class OpenSearchConnector extends Object
Factory/cache for OpenSearch clients.

Ownership: Clients are cached per base URL (and optional credentials) and reused. Do not close the returned client; lifecycle is managed here.

  • Method Summary

    Modifier and Type
    Method
    Description
    static org.opensearch.client.opensearch.OpenSearchClient
    getClient(String baseUrl)
    Returns a cached client for the given base URL, creating it on first use (no auth).
    static org.opensearch.client.opensearch.OpenSearchClient
    getClient(String baseUrl, String username, String password)
    Returns a cached client for the given base URL and optional basic-auth credentials.

    Methods inherited from class java.lang.Object

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

    • getClient

      public static org.opensearch.client.opensearch.OpenSearchClient getClient(String baseUrl)
      Returns a cached client for the given base URL, creating it on first use (no auth).
      Parameters:
      baseUrl - e.g., https://opensearch.url:9200
      Returns:
      shared client
      Throws:
      OpenSearchClientBuildException - when the client cannot be constructed
    • getClient

      public static org.opensearch.client.opensearch.OpenSearchClient getClient(String baseUrl, String username, String password)
      Returns a cached client for the given base URL and optional basic-auth credentials. When both username and password are non-null and non-empty, basic auth is configured.
      Parameters:
      baseUrl - e.g., https://opensearch.url:9200
      username - optional; null or empty to skip auth
      password - optional; null or empty to skip auth
      Returns:
      shared client
      Throws:
      OpenSearchClientBuildException - when the client cannot be constructed