@fortress-js/node
Version:
The Fortress Backend SDK
55 lines (54 loc) • 2.12 kB
TypeScript
import { type Database, type Tenant } from "./client";
import type { Connection } from "./database";
export declare class Fortress {
private fortress;
private tenantConnectionCache;
/**
* Create a new Fortress client
* @param orgId The organization ID
* @param apiKey The API key
*/
constructor(orgId: string, apiKey: string);
/**
* Create a new database on the Fortress platform
* @param platform The cloud platform the database will be hosted on (aws or managed)
* @param alias Alias for the database (optional)
* @returns The ID of the created database
*/
createDatabase(platform: string, alias: string): Promise<string>;
/**
* Delete a database on the Fortress platform
* @param databaseId The ID of the database to delete
*/
deleteDatabase(databaseId: string): Promise<void>;
/**
* List all databases on the Fortress platform
* @returns An array of databases
*/
listDatabases(): Promise<Database[]>;
/**
* Connect to a tenant's database
* @param tenantId The ID of the tenant
* @returns A connection to the tenant's database
*/
connectTenant(tenantId: string): Promise<Connection>;
/**
* Create a new tenant on the Fortress platform
* @param tenantId The ID of the tenant
* @param isolationLevel The isolation level for the tenant's database (shared or dedicated)
* @param platform The cloud platform the tenant's database will be hosted on (aws or managed)
* @param alias Alias for the tenant's database (optional)
* @param databaseId The ID of the database to use for the tenant (optional)
*/
createTenant(tenantId: string, isolationLevel: string, platform: string, alias?: string, databaseId?: string): Promise<void>;
/**
* Delete a tenant on the Fortress platform
* @param tenantId The ID of the tenant to delete
*/
deleteTenant(tenantId: string): Promise<void>;
/**
* List all tenants on the Fortress platform
* @returns An array of tenants
*/
listTenants(): Promise<Tenant[]>;
}