Package com.datastax.astra.client.admin
Class AstraDBAdmin
java.lang.Object
com.datastax.astra.client.admin.AstraDBAdmin
Main Client for AstraDB, it implements administration and Data Api Operations.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Default keyspace (same created by the ui).static final String
Deprecated.static final com.dtsx.astra.sdk.db.domain.CloudProviderType
Default cloud provider.static final String
Default region.static final String
Header name used to hold the Astra Token.static final Integer
Default timeout in seconds. -
Constructor Summary
ConstructorDescriptionAstraDBAdmin
(String token, com.dtsx.astra.sdk.utils.AstraEnvironment env, DataAPIOptions options) Initialization with an authentication token and target environment, Use this constructor for testing purpose. -
Method Summary
Modifier and TypeMethodDescriptioncreateDatabase
(String name) Create new database with a name on free tier.createDatabase
(String name, com.dtsx.astra.sdk.db.domain.CloudProviderType cloud, String cloudRegion) Create new database with a name on the specified cloud provider and region.createDatabase
(String name, com.dtsx.astra.sdk.db.domain.CloudProviderType cloud, String cloudRegion, boolean waitForDb) Create new database with a name on the specified cloud provider and region.boolean
databaseExists
(String name) Return true if the database exists.boolean
databaseExists
(UUID id) Return true if the database exists.boolean
dropDatabase
(@NonNull String databaseName) Delete a Database if exists from its name.boolean
dropDatabase
(@NonNull UUID databaseId) Delete a Database if exists from its identifier.getDatabase
(UUID databaseId) Access the database functions.getDatabase
(UUID databaseId, String keyspace) Access the database functions.getDatabaseAdmin
(UUID databaseId) Access the database functions.getDatabaseInfo
(@NonNull UUID id) Find database information from its id.List available database names.List active databases with vector enabled in current organization.
-
Field Details
-
WAIT_IN_SECONDS
Default timeout in seconds. -
FREE_TIER_CLOUD
public static final com.dtsx.astra.sdk.db.domain.CloudProviderType FREE_TIER_CLOUDDefault cloud provider. (free-tier) -
FREE_TIER_CLOUD_REGION
Default region. (free-tier)- See Also:
-
TOKEN_HEADER_PARAM
Header name used to hold the Astra Token.- See Also:
-
DEFAULT_NAMESPACE
Deprecated.Default keyspace (same created by the ui).- See Also:
-
DEFAULT_KEYSPACE
Default keyspace (same created by the ui).- See Also:
-
-
Constructor Details
-
AstraDBAdmin
public AstraDBAdmin(String token, com.dtsx.astra.sdk.utils.AstraEnvironment env, DataAPIOptions options) Initialization with an authentication token and target environment, Use this constructor for testing purpose.- Parameters:
token
- authentication tokenenv
- astra environmentoptions
- options for client
-
-
Method Details
-
listDatabaseNames
List available database names.- Returns:
- list of database names
-
listDatabases
List active databases with vector enabled in current organization.- Returns:
- active databases list
-
databaseExists
Return true if the database exists.- Parameters:
name
- database identifiers- Returns:
- if the database exits or not
-
databaseExists
Return true if the database exists.- Parameters:
id
- database identifiers- Returns:
- if the database exits or not
-
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 admin object
-
createDatabase
public DatabaseAdmin createDatabase(String name, com.dtsx.astra.sdk.db.domain.CloudProviderType cloud, String cloudRegion, boolean waitForDb) 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 regionwaitForDb
- if set to true, the method is blocking- Returns:
- database admin object
-
createDatabase
public DatabaseAdmin createDatabase(String name, com.dtsx.astra.sdk.db.domain.CloudProviderType cloud, 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 admin object
-
dropDatabase
Delete a Database if exists from its identifier.- Parameters:
databaseId
- database identifier- Returns:
- if the db has been deleted
-
dropDatabase
Delete a Database if exists from its name.- Parameters:
databaseName
- database name- Returns:
- if the database has been deleted
-
getDatabaseInfo
Find database information from its id.- Parameters:
id
- database identifier- Returns:
- the bean representing an Astra database
-
getDatabase
Access the database functions.- Parameters:
databaseId
- database identifierkeyspace
- target keyspace name- Returns:
- database client
-
getDatabase
Access the database functions.- Parameters:
databaseId
- database identifier- Returns:
- database client
-
getDatabaseAdmin
Access the database functions.- Parameters:
databaseId
- database identifier- Returns:
- database client
-