Note: we handle connection caching for all of our SDKs.
Client
The Client
class is the main entry point for interacting with the Fortress platform. Here is a link to the Github
Initialization
const client = new Fortress(apiKey, organizationId);
Tenant actions
Tenant actions are the main way used to interact with tenant data on the Fortress platform. This is the way to guarantee that data only comes from a specific tenant. Fortress will ensure tenant isolation using this method. Once a tenant is connected, all queries will only return that tenant’s data.
Connect to a tenant
fortress.connectTenant(tenantId: string) -> Promise<Connection>
Create a tenant
fortress.createTenant(tenantId: string, aliasName: string, databaseId: string, isolationLevel: string, platform: string) -> Promise<void>
- Important Note: alias_name is an optional name that you can give a specific tenant to make interacting with them easier. If it is not included in this function, the alias_name for a tenant will be just the tenant_id
- Important Note: database_id is an optional field that takes in a string. If it is included, then the tenant will be added to an existing database. If not, a new database would automatically be created for the tenant.
- Important Note: isolation_level can be either ‘shared’ or ‘dedicated’
- Important Note: platform can be either ‘aws’ or ‘managed’
Delete a tenant
fortress.deleteTenant(tenantId: string) -> Promise<void>
- Important Note: Deleting a tenant using this will just remove the connection to the database but will not delete the data. We are working on this feature soon!
List tenants
fortress.listTenants() -> Promise<Tenant[]>
Database actions
Database actions are used to interact with the entire database on the Fortress platform.
Create a database
fortress.createDatabase(alias: string, platform: string) -> Promise<string>
- Important Note: The platform can be either ‘aws’ or ‘managed’
Delete a database
fortress.deleteDatabase(databaseId: string) -> Promise<void>
- Important Note: Deleting a database will delete all the data inside of it, but will not delete the tenant objects that are attached to it.
List databases
fortress.listDatabases() -> Promise<Database[]>
Responses are generated using AI and may contain mistakes.