Get an Astra DB admin (Java)
The Data API clients use the Astra DB Admin class to perform administrative operations like creating and dropping databases.
To perform administrative actions within a specific database, see Get a database admin (Java) instead.
The Astra DB Admin class name varies by client.
The Java client uses AstraDBAdmin.
|
You need an application token with permission to create and configure databases, such as the Organization Administrator role. For more information, see Get endpoint and token. |
Result
Returns an AstraDBAdmin object that can perform administrative actions.
Parameters
Use the getAdmin method from the com.datastax.astra.client.DataAPIClient class.
Method signature
AstraDBAdmin getAdmin()
AstraDBAdmin getAdmin(String superToken)
AstraDBAdmin getAdmin(AdminOptions adminOptions)
| Name | Type | Summary |
|---|---|---|
|
|
Optional. The token used by the resulting admin object. The token should have sufficient permissions to perform the desired downstream operations. If not specified, the resulting object will use the token used by the object that called this method. |
|
Optional. A specification of options to override the inherited defaults. Use this to customize the interaction of the client with the admin object. For example, you can change the default timeouts. |
Examples
The following examples demonstrate how to get an Astra DB admin.
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.admin.AstraDBAdmin;
public class Example {
public static void main(String[] args) {
// Get an admin object
DataAPIClient client = new DataAPIClient("APPLICATION_TOKEN");
AstraDBAdmin admin = client.getAdmin();
}
}
Client reference
For more information, see the client reference.