Package com.dtsx.astra.sdk
Class AstraDBAdmin
java.lang.Object
com.dtsx.astra.sdk.AstraDBAdmin
Client for AstraDB at organization level (crud for databases).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default timeout for initiating connection.static final String
Default keyspace name if not provided by user.static final CloudProviderType
Default cloud provider if not provided by user.static final String
Default region if not provided by user.static final String
Header name used to hold the Astra Token. -
Constructor Summary
ConstructorDescriptionDefault initialization, the token is retrieved from environment variableASTRA_DB_APPLICATION_TOKEN
or from file~/.astrarc
, sectiondefault
, keyASTRA_DB_APPLICATION_TOKEN
.AstraDBAdmin
(String token) Initialization with an authentification token, defaulting to production environment.AstraDBAdmin
(String token, AstraEnvironment env) Initialization with an authentification token and target environment, Use this constructor for testing purpose. -
Method Summary
Modifier and TypeMethodDescriptioncreateDatabase
(@NonNull String name) Create new database with a name on free tier.createDatabase
(@NonNull String name, @NonNull CloudProviderType cloud, @NonNull String cloudRegion) Create new database with a name on the specified cloud provider and region.Access the database functions.Access the database functions.boolean
deleteDatabaseById
(@NonNull UUID databaseId) Delete a Database if exists from its nameboolean
deleteDatabaseByName
(@NonNull String name) Delete a Database if exists from its nameList active databases with vector enabled in current organization.findDatabaseById
(@NonNull UUID id) Find a database from its id.findDatabaseByName
(String name) Retrieve list of all Databases of the account and filter on nameio.stargate.sdk.data.DataApiClient
getDataApiClient
(@NonNull String databaseName) Access database functions.io.stargate.sdk.data.DataApiClient
getDataApiClient
(@NonNull UUID databaseId) Access database functions.Access the devops client.boolean
isDatabaseExists
(String name) Check if a database exists.
-
Field Details
-
CONNECT_TIMEOUT_SECONDS
public static final int CONNECT_TIMEOUT_SECONDSDefault timeout for initiating connection.- See Also:
-
FREE_TIER_CLOUD
Default cloud provider if not provided by user. (free-tier) -
FREE_TIER_CLOUD_REGION
Default region if not provided by user. (free-tier)- See Also:
-
TOKEN_HEADER_PARAM
Header name used to hold the Astra Token.- See Also:
-
DEFAULT_KEYSPACE
Default keyspace name if not provided by user.- See Also:
-
-
Constructor Details
-
AstraDBAdmin
public AstraDBAdmin()Default initialization, the token is retrieved from environment variableASTRA_DB_APPLICATION_TOKEN
or from file~/.astrarc
, sectiondefault
, keyASTRA_DB_APPLICATION_TOKEN
. -
AstraDBAdmin
Initialization with an authentification token, defaulting to production environment.- Parameters:
token
- authentication token
-
AstraDBAdmin
Initialization with an authentification token and target environment, Use this constructor for testing purpose.- Parameters:
token
- authentication tokenenv
- target Astra environment
-
-
Method Details
-
findAllDatabases
List active databases with vector enabled in current organization.- Returns:
- active databases list
-
createDatabase
Create new database with a name on free tier. The database name should not exist in the tenant.- Parameters:
name
- database name- Returns:
- database identifier
-
createDatabase
public UUID createDatabase(@NonNull @NonNull String name, @NonNull @NonNull CloudProviderType cloud, @NonNull @NonNull String cloudRegion) Create new database with a name on the specified cloud provider and region. If the database with same name already exists it will be resumed if not active. The method will wait for the database to be active.- Parameters:
name
- database namecloud
- cloud providercloudRegion
- cloud region- Returns:
- database identifier
-
deleteDatabaseByName
Delete a Database if exists from its name- Parameters:
name
- database name- Returns:
- if the db has been deleted
-
deleteDatabaseById
Delete a Database if exists from its name- Parameters:
databaseId
- database identifier- Returns:
- if the db has been deleted
-
findDatabaseByName
Retrieve list of all Databases of the account and filter on name- Parameters:
name
- a database name- Returns:
- list of db matching the criteria
-
isDatabaseExists
Check if a database exists.- Parameters:
name
- a database name- Returns:
- if the database exists
-
findDatabaseById
Find a database from its id.- Parameters:
id
- a database name- Returns:
- list of db matching the criteria
-
database
Access the database functions.- Parameters:
databaseName
- database name- Returns:
- database client
-
database
Access the database functions.- Parameters:
databaseId
- database identifier- Returns:
- database client
-
getDataApiClient
Access database functions.- Parameters:
databaseName
- database name- Returns:
- database client
-
getDataApiClient
Access database functions.- Parameters:
databaseId
- database identifier- Returns:
- database client
-
getDevopsApiClient
Access the devops client.- Returns:
- devops client.
-