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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAstraDBAdmin(AdminOptions 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, DatabaseDefinition definition, CreateDatabaseOptions options) 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.booleandatabaseExists(String name) Return true if the database exists.booleandatabaseExists(UUID id) Return true if the database exists.booleandropDatabase(@NonNull String databaseName) Delete a Database if exists from its name.booleandropDatabase(@NonNull UUID databaseId) Delete a Database if exists from its identifier.Find all available regions for vector databases.getDatabase(UUID databaseId) Access the database functions.getDatabase(UUID databaseId, DatabaseOptions dbOptions) Access the database functions.getDatabase(UUID databaseId, String keyspace) Access the database functions.getDatabaseAdmin(String databaseEndpoint) Access the database administration functions.getDatabaseAdmin(UUID databaseId) Access the database administration functions.getDatabaseInfo(@NonNull UUID id) Find database information from its id.List available database names.List active databases with vector enabled in current organization.Lists all PCU (Processing Capacity Units) groups in the organization.listPCUGroups(com.dtsx.astra.sdk.db.domain.CloudProviderType cloudProvider, String region) Lists PCU (Processing Capacity Units) groups filtered by cloudProvider provider and region.booleanPCUGroupExists(UUID PCUGroupId) Checks if a PCU group exists by its identifier.booleanPCUGroupExists(UUID PCUGroupId, com.dtsx.astra.sdk.db.domain.CloudProviderType cloudProvider, String region) Checks if a PCU group exists by its identifier, optionally filtered by cloudProvider provider and region.
-
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:
-
-
Constructor Details
-
AstraDBAdmin
Initialization with an authentication token and target environment, Use this constructor for testing purpose.- Parameters:
options- options for client
-
-
Method Details
-
findAvailableRegions
public List<AstraAvailableRegionInfo> findAvailableRegions(AstraFindAvailableRegionsOptions options) Find all available regions for vector databases. This method will return all regions, including the ones that are not enabled for the current organization.- Parameters:
options- options to filter the regions, such as onlyOrgEnabledRegions- Returns:
- list of available regions
-
listPCUGroups
public List<PCUGroupDefinition> listPCUGroups(com.dtsx.astra.sdk.db.domain.CloudProviderType cloudProvider, String region) Lists PCU (Processing Capacity Units) groups filtered by cloudProvider provider and region. PCU groups manage compute resources for databases across cloudProvider providers and regions.- Parameters:
cloudProvider- cloudProvider provider to filter by (AWS, GCP, AZURE), or null for all providersregion- cloudProvider region to filter by (e.g., "us-east-1"), or null for all regions- Returns:
- list of PCU groups matching the specified filters
-
listPCUGroups
Lists all PCU (Processing Capacity Units) groups in the organization. This is a convenience method that returns all PCU groups without filtering.- Returns:
- list of all PCU groups
-
PCUGroupExists
Checks if a PCU group exists by its identifier. This is a convenience method that checks existence without filtering by cloud or region.- Parameters:
PCUGroupId- PCU group UUID to check- Returns:
- true if the PCU group exists, false otherwise
-
PCUGroupExists
public boolean PCUGroupExists(UUID PCUGroupId, com.dtsx.astra.sdk.db.domain.CloudProviderType cloudProvider, String region) Checks if a PCU group exists by its identifier, optionally filtered by cloudProvider provider and region.- Parameters:
PCUGroupId- PCU group UUID to checkcloudProvider- cloudProvider provider to filter by (AWS, GCP, AZURE), or null for all providersregion- cloudProvider region to filter by (e.g., "us-east-1"), or null for all regions- Returns:
- true if the PCU group exists and matches the filters, false otherwise
-
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
-
createDatabase
public DatabaseAdmin createDatabase(String name, DatabaseDefinition definition, CreateDatabaseOptions options) Create new database with a name on free tier. The database name should not exist in the tenant.- Parameters:
name- unique name for the databasedefinition- definition of the database- 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 identifierdbOptions- target keyspace name- Returns:
- database client
-
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 administration functions.- Parameters:
databaseId- database identifier- Returns:
- database client
-
getDatabaseAdmin
Access the database administration functions.- Parameters:
databaseEndpoint- database endpoint- Returns:
- database client
-