Class AstraClient

java.lang.Object
com.datastax.astra.sdk.AstraClient
All Implemented Interfaces:
Closeable, AutoCloseable

public class AstraClient extends Object implements Closeable
Public interface to interact with ASTRA APIs.
Author:
Cedrick LUNVEN (@clunven)
  • Field Details

    • SECURE_CONNECT

      public static final String SECURE_CONNECT
      Cloud Secure bundle file prefix, scb_dbId_dbRegion.zip
      See Also:
    • stargateClient

      protected io.stargate.sdk.StargateClient stargateClient
      Access to all Stargate sub Api (rest, graphQL, doc, gRPC).
    • astraClientConfig

      protected AstraClientConfig astraClientConfig
      Keep some information related to Astra Settings.
    • currentDatabaseRegion

      protected String currentDatabaseRegion
      Hold a reference on current region used for the Fail-over.
  • Constructor Details

    • AstraClient

      public AstraClient(String token)
      Create a client with the token on
      Parameters:
      token - current token
    • AstraClient

      public AstraClient(String dbId, String dbRegion, String token)
      Simple initialization.
      Parameters:
      dbId - database id
      dbRegion - database region
      token - current token
    • AstraClient

      public AstraClient(AstraClientConfig config)
      Initialization through builder.
      Parameters:
      config - configuration extracted from builder
  • Method Details

    • apiStargateDocument

      public io.stargate.sdk.doc.StargateDocumentApiClient apiStargateDocument()
      Document Api.
      Returns:
      ApiDocumentClient
    • apiStargateData

      public io.stargate.sdk.rest.StargateRestApiClient apiStargateData()
      Rest Api.
      Returns:
      ApiRestClient
    • apiStargateGraphQL

      public io.stargate.sdk.gql.StargateGraphQLApiClient apiStargateGraphQL()
      GraphQL Api.
      Returns:
      ApiGraphQLClient
    • apiStargateGrpc

      public io.stargate.sdk.grpc.StargateGrpcApiClient apiStargateGrpc()
      Integration with grpc Api in Stargate.
      Returns:
      grpc Stargate API.
    • apiDevops

      public AstraDevopsApiClient apiDevops()
      Devops API
      Returns:
      ApiDevopsClient
    • apiDevopsDatabases

      public AstraDbClient apiDevopsDatabases()
      Devops API
      Returns:
      ApiDevopsClient
    • apiDevopsStreaming

      public AstraStreamingClient apiDevopsStreaming()
      Devops API Streaming
      Returns:
      ApiDevopsClient
    • cqlSession

      public com.datastax.oss.driver.api.core.CqlSession cqlSession()
      CQL API
      Returns:
      CqlSession
    • getToken

      public Optional<String> getToken()
      Give access to token.
      Returns:
      token value
    • getConfig

      public AstraClientConfig getConfig()
      Getter to the configuration, it should not be changed.
      Returns:
      initial configuration
    • useRegion

      public void useRegion(String region)
      Change region the application is working on.
      Parameters:
      region - new region
    • builder

      public static AstraClientConfig builder()
      Builder Pattern
      Returns:
      AstraClientBuilder
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • getStargateClient

      public io.stargate.sdk.StargateClient getStargateClient()
      Getter accessor for attribute 'stargateClient'.
      Returns:
      current value of 'stargateClient'