Get an Astra DB admin
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 instead.
The Astra DB Admin class name varies by client:
-
Python:
AstraDBAdmin -
TypeScript:
AstraAdmin -
Java:
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
-
Python
-
TypeScript
-
Java
-
curl
Returns an AstraDBAdmin object that can perform administrative actions.
Returns an AstraAdmin object that can perform administrative actions.
Returns an AstraDBAdmin object that can perform administrative actions.
This method has no literal equivalent in HTTP. Instead, you provide an application token with sufficient permissions to perform the requested operations.
Parameters
-
Python
-
TypeScript
-
Java
-
curl
Use the get_admin method from the DataAPIClient class.
Method signature
get_admin(
*,
token: str | TokenProvider,
spawn_api_options: APIOptions,
) -> AstraDBAdmin
| Name | Type | Summary |
|---|---|---|
|
|
Optional. The token used by the resulting admin object. The token should have sufficient permissions to perform the desired downstream operations. Default: The token used by the object that called this method. |
|
Optional.
A complete or partial specification of the If |
Use the admin method, which belongs to the DataAPIClient class.
Method signature
admin(options?: AdminOptions): AstraAdmin
Parameters:
| Name | Type | Summary |
|---|---|---|
|
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 or token. |
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. |
This method has no literal equivalent in HTTP. Instead, you provide an application token with sufficient permissions to perform the requested operations.
Examples
The following examples demonstrate how to get an Astra DB admin.
-
Python
-
TypeScript
-
Java
-
curl
from astrapy import DataAPIClient
# Get an admin object
client = DataAPIClient("APPLICATION_TOKEN")
admin = client.get_admin()
import { DataAPIClient } from "@datastax/astra-db-ts";
// Get an admin object
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.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();
}
}
This method has no literal equivalent in HTTP. Instead, you provide an application token with sufficient permissions to perform the requested operations.
Client reference
-
Python
-
TypeScript
-
Java
-
curl
For more information, see the client reference.
For more information, see the client reference.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.