Class DatabaseAdminAstra
Provides administrative operations for an Astra database, including keyspace management and embedding provider discovery. This class is used internally by the Astra client library to execute privileged actions against a specific database.
public class DatabaseAdminAstra : IDatabaseAdmin
- Inheritance
-
DatabaseAdminAstra
- Implements
- Inherited Members
Remarks
This implementation of IDatabaseAdmin supports synchronous and asynchronous methods for listing, creating, and dropping keyspaces, as well as querying embedding providers.
Properties
Id
The database Guid (as a string).
public string Id { get; }
Property Value
Methods
CreateKeyspace(string, CreateKeyspaceOptions)
Synchronous version of CreateKeyspaceAsync(string, CreateKeyspaceOptions)
public void CreateKeyspace(string keyspace, CreateKeyspaceOptions options = null)
Parameters
keyspacestringThe name of the keyspace to create.
optionsCreateKeyspaceOptionsOptional settings that influence request execution.
Examples
await admin.CreateKeyspaceAsync("myKeyspace");
Remarks
This method, by default, will wait for the operation to complete on the server side. Use the options' waitForCompletion attribute to control this behaviour.
CreateKeyspaceAsync(string, CreateKeyspaceOptions)
Creates a new keyspace with the specified name.
public Task CreateKeyspaceAsync(string keyspace, CreateKeyspaceOptions options = null)
Parameters
keyspacestringThe name of the keyspace to create.
optionsCreateKeyspaceOptionsOptional settings that influence request execution.
Returns
Examples
await admin.CreateKeyspaceAsync("myKeyspace");
Remarks
This method, by default, will wait for the operation to complete on the server side. Use the options' waitForCompletion attribute to control this behaviour.
DoesKeyspaceExist(string, DoesKeyspaceExistOptions)
Synchronous version of DoesKeyspaceExistAsync(string, DoesKeyspaceExistOptions).
public bool DoesKeyspaceExist(string keyspace, DoesKeyspaceExistOptions options = null)
Parameters
keyspacestringThe name of the keyspace to check.
optionsDoesKeyspaceExistOptionsOptional settings that influence request execution.
Returns
- bool
A task that resolves to
trueif the keyspace exists; otherwise,false.
Examples
bool exists = await admin.DoesKeyspaceExistAsync("myKeyspace");
bool exists = admin.DoesKeyspaceExist("myKeyspace");
DoesKeyspaceExistAsync(string, DoesKeyspaceExistOptions)
Checks whether a keyspace with the specified name exists.
public Task<bool> DoesKeyspaceExistAsync(string keyspace, DoesKeyspaceExistOptions options = null)
Parameters
keyspacestringThe name of the keyspace to check.
optionsDoesKeyspaceExistOptionsOptional settings that influence request execution.
Returns
Examples
bool exists = await admin.DoesKeyspaceExistAsync("myKeyspace");
DropKeyspace(string, DropKeyspaceOptions)
Synchronous version of DropKeyspaceAsync(string, DropKeyspaceOptions).
public void DropKeyspace(string keyspace, DropKeyspaceOptions options = null)
Parameters
keyspacestringThe name of the keyspace to drop.
optionsDropKeyspaceOptionsOptional settings that influence request execution.
Examples
await admin.DropKeyspaceAsync("myKeyspace", options);
DropKeyspaceAsync(string, DropKeyspaceOptions)
Drops the keyspace with the specified name.
public Task DropKeyspaceAsync(string keyspace, DropKeyspaceOptions options = null)
Parameters
keyspacestringThe name of the keyspace to drop.
optionsDropKeyspaceOptionsOptional settings that influence request execution.
Returns
Examples
await admin.DropKeyspaceAsync("myKeyspace", options);
FindEmbeddingProviders(FindEmbeddingProvidersOptions)
Synchronous version of FindEmbeddingProvidersAsync(FindEmbeddingProvidersOptions).
public FindEmbeddingProvidersResult FindEmbeddingProviders(FindEmbeddingProvidersOptions options = null)
Parameters
optionsFindEmbeddingProvidersOptionsOptional settings that influence request execution.
Returns
- FindEmbeddingProvidersResult
A FindEmbeddingProvidersResult containing the discovered providers.
Examples
var providers = await admin.FindEmbeddingProvidersAsync();
var providers = admin.FindEmbeddingProviders();
FindEmbeddingProvidersAsync(FindEmbeddingProvidersOptions)
Finds and returns available embedding providers for the current database.
public Task<FindEmbeddingProvidersResult> FindEmbeddingProvidersAsync(FindEmbeddingProvidersOptions options = null)
Parameters
optionsFindEmbeddingProvidersOptionsOptional settings that influence request execution.
Returns
- Task<FindEmbeddingProvidersResult>
A FindEmbeddingProvidersResult containing the discovered providers.
Examples
var providers = await admin.FindEmbeddingProvidersAsync();
FindRerankingProviders(FindRerankingProvidersOptions)
Synchronous version of FindRerankingProvidersAsync(FindRerankingProvidersOptions).
public FindRerankingProvidersResult FindRerankingProviders(FindRerankingProvidersOptions options = null)
Parameters
optionsFindRerankingProvidersOptionsOptional settings that influence request execution.
Returns
- FindRerankingProvidersResult
A FindRerankingProvidersResult containing the discovered providers.
Examples
var providers = await admin.FindRerankingProvidersAsync();
var providers = admin.FindRerankingProviders();
FindRerankingProvidersAsync(FindRerankingProvidersOptions)
Finds and returns available reranking providers for the current database.
public Task<FindRerankingProvidersResult> FindRerankingProvidersAsync(FindRerankingProvidersOptions options = null)
Parameters
optionsFindRerankingProvidersOptionsOptional settings that influence request execution.
Returns
- Task<FindRerankingProvidersResult>
A FindRerankingProvidersResult containing the discovered providers.
Examples
var providers = await admin.FindRerankingProvidersAsync();
GetAPIEndpoint()
Gets the API endpoint URL for the associated database.
public string GetAPIEndpoint()
Returns
- string
The API endpoint as a string.
Examples
string endpoint = admin.GetAPIEndpoint();
GetDatabase(GetDatabaseOptions)
Returns a Database instance for non-admin usage.
public Database GetDatabase(GetDatabaseOptions options = null)
Parameters
optionsGetDatabaseOptionsoptions for the returned database: useful to override timeouts and other behavior.
Returns
Examples
var database = admin.GetDatabase("myToken");
GetDatabase(string, GetDatabaseOptions)
Returns a Database instance for non-admin usage.
public Database GetDatabase(string token, GetDatabaseOptions options = null)
Parameters
tokenstringThe token that will be used by the database. Omit to keep using the current token.
optionsGetDatabaseOptionsoptions for the returned database: useful to override timeouts and other behavior.
Returns
Examples
var database = admin.GetDatabase("myToken");
ListKeyspaces(ListKeyspacesOptions)
Synchronous version of ListKeyspacesAsync(ListKeyspacesOptions).
public IEnumerable<string> ListKeyspaces(ListKeyspacesOptions options = null)
Parameters
optionsListKeyspacesOptionsOptional settings that influence request execution.
Returns
- IEnumerable<string>
A collection of keyspace names.
Examples
var keyspaces = await admin.ListKeyspacesAsync();
IEnumerable<string> keyspaces = admin.ListKeyspaces();
ListKeyspacesAsync(ListKeyspacesOptions)
Lists the names of all keyspaces in the database.
public Task<IEnumerable<string>> ListKeyspacesAsync(ListKeyspacesOptions options = null)
Parameters
optionsListKeyspacesOptionsOptional settings that influence request execution.
Returns
- Task<IEnumerable<string>>
A collection of keyspace names.
Examples
var keyspaces = await admin.ListKeyspacesAsync();