Class BaseOptions<T extends BaseOptions<T>>

java.lang.Object
com.datastax.astra.client.core.options.BaseOptions<T>
Type Parameters:
T - the sub-class implementing the command options
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
AdminOptions, AlterTableOptions, CollectionDeleteManyOptions, CollectionDeleteOneOptions, CollectionFindOneAndDeleteOptions, CollectionFindOneAndReplaceOptions, CollectionFindOneAndUpdateOptions, CollectionFindOneOptions, CollectionFindOptions, CollectionInsertManyOptions, CollectionInsertOneOptions, CollectionOptions, CollectionReplaceOneOptions, CollectionUpdateManyOptions, CountDocumentsOptions, CountRowsOptions, CreateCollectionOptions, CreateIndexOptions, CreateTableOptions, CreateVectorIndexOptions, DatabaseOptions, DropCollectionOptions, DropTableIndexOptions, DropTableOptions, EstimatedCountDocumentsOptions, EstimatedCountRowsOptions, ListCollectionOptions, ListIndexesOptions, ListTablesOptions, TableDeleteManyOptions, TableDeleteOneOptions, TableDistinctOptions, TableFindOneOptions, TableFindOptions, TableInsertManyOptions, TableInsertOneOptions, TableOptions, TableUpdateOneOptions, UpdateOneOptions

public class BaseOptions<T extends BaseOptions<T>> extends Object implements Cloneable
Options that will be provided to all commands for this collection.
  • Field Details

    • dataAPIClientOptions

      protected DataAPIClientOptions dataAPIClientOptions
      Token used
    • serializer

      protected DataAPISerializer serializer
      Serializer for the command.
    • token

      protected String token
      Token to use for authentication.
    • commandType

      protected CommandType commandType
      The command type will drive the timeout in used.
  • Constructor Details

    • BaseOptions

      public BaseOptions(String token, CommandType type, DataAPIClientOptions options)
      Return the HTTP Request Timeout based on the command type.
      Parameters:
      token - authentication token
      type - command type
      options - data api options
    • BaseOptions

      public BaseOptions(String token, CommandType type, DataAPISerializer serializer, DataAPIClientOptions options)
      Return the HTTP Request Timeout based on the command type.
      Parameters:
      token - authentication token
      type - command type
      serializer - serializer
      options - data api options
  • Method Details

    • token

      public T token(String token)
      Provide the token.
      Parameters:
      token - authentication token
      Returns:
      service key
    • serializer

      public T serializer(DataAPISerializer serializer)
      Provide the token.
      Parameters:
      serializer - serializer
      Returns:
      service key
    • commandType

      public T commandType(CommandType commandType)
      Provide the command type. The nature of the command will determine the timeout.
      Parameters:
      commandType - command Type
      Returns:
      service key
    • dataAPIClientOptions

      public T dataAPIClientOptions(DataAPIClientOptions options)
      Provide a fluent setter for the data API Client.
      Parameters:
      options - command Type
      Returns:
      service key
    • timeout

      public T timeout(long timeoutMillis)
      Provide the command type. The nature of the command will determine the timeout.
      Parameters:
      timeoutMillis - timeout for the request
      Returns:
      service key
    • timeout

      public T timeout(Duration duration)
      Provide the command type. The nature of the command will determine the timeout.
      Parameters:
      duration - timeout for the request
      Returns:
      service key
    • embeddingAuthProvider

      public T embeddingAuthProvider(EmbeddingHeadersProvider embeddingAuthProvider)
      Provide the embedding service API key.
      Parameters:
      embeddingAuthProvider - authentication provider
      Returns:
      service key
    • embeddingApiKey

      public T embeddingApiKey(String apiKey)
      Provide the embedding service API key.
      Parameters:
      apiKey - target api key
      Returns:
      service key
    • databaseAdditionalHeaders

      public T databaseAdditionalHeaders(Map<String,String> params)
      Provide the token.
      Parameters:
      params - additional headers
      Returns:
      service key
    • adminAdditionalHeaders

      public T adminAdditionalHeaders(Map<String,String> params)
      Provide the token.
      Parameters:
      params - additional headers
      Returns:
      service key
    • httpClientOptions

      public T httpClientOptions(HttpClientOptions options)
      Provide the token.
      Parameters:
      options - options to initialize the http client
      Returns:
      service key
    • timeoutOptions

      public T timeoutOptions(TimeoutOptions timeoutOptions)
      Provide the embedding service API key.
      Parameters:
      timeoutOptions - options of timeouts
      Returns:
      service key
    • registerObserver

      public T registerObserver(String name, CommandObserver observer)
      Allow to register a listener for the command.
      Parameters:
      name - name of the observer
      observer - observer to register
      Returns:
      instance of the command options
    • unregisterObserver

      public T unregisterObserver(String name)
      Remove a listener from the command.
      Parameters:
      name - name of the observer
      Returns:
      instance of the command options
    • getTimeout

      public long getTimeout(TimeoutOptions timeoutOptions, CommandType type)
      Request timeout based on the command type.
      Parameters:
      timeoutOptions - options of timeouts
      type - command type
      Returns:
      timeout
    • getRequestTimeout

      public long getRequestTimeout(TimeoutOptions timeoutOptions, CommandType type)
      Request timeout based on the command type.
      Parameters:
      timeoutOptions - options of timeouts
      type - command type
      Returns:
      timeout
    • timeout

      public T timeout(long timeoutMillis, CommandType commandType)
      Provide the command type. The nature of the command will determine the timeout.
      Parameters:
      timeoutMillis - timeout for the request
      commandType - command type
      Returns:
      service key
    • getDataAPIClientOptions

      public DataAPIClientOptions getDataAPIClientOptions()
      Gets dataAPIClientOptions
      Returns:
      value of dataAPIClientOptions
    • getTimeout

      public long getTimeout()
      Return the HTTP Request Timeout based on the command type
      Returns:
      value of token
    • getRequestTimeout

      public long getRequestTimeout()
      Return the HTTP Request Timeout based on the command type
      Returns:
      value of token
    • getToken

      public String getToken()
      Gets token
      Returns:
      value of token
    • getCommandType

      public CommandType getCommandType()
      Gets commandType
      Returns:
      value of commandType
    • getSerializer

      public DataAPISerializer getSerializer()
      Gets serializer
      Returns:
      value of serializer
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public T clone()
      Overrides:
      clone in class Object