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

# @param org_id [String] The organization ID.
# @param api_key [String] The API key.
# @return [Fortress] The Fortress client.

client = Fortress::Fortress.new('orgId', 'apiKey')

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

# @param id [String] The tenant ID.
# @return [PG::Connection] The connection to the tenant database.

client.connect_tenant('id')

Create a tenant in a database

# @param id [String] The tenant ID.
# @param tenant_alias [String] The tenant alias.
# @param database_id [String] The database ID. (optional)
# @param isolation_level [String] The isolation level.
# @param platform [String] The platform.
# @return [void]

client.create_tenant('id', 'tenant_alias', 'database_id', 'isolation_level', 'platform')
  • Important Note: if no database_id is provided, the tenant will be created in a new dedicated database.
  • Important Note: The isolation level can be either ‘shared’ or ‘dedicated’
  • Important Note: The platform can be either ‘aws’ or ‘managed’

List all tenants

# @return [Array<Tenant>] The list of tenants.

client.list_tenants

Delete a tenant

# @param id [String] The tenant ID.
# @return [void]

client.delete_tenant('id')
  • 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!

Database Actions

Database actions are used to interact with the entire database on the Fortress platform.

Create a database

# @param database_alias [String] The database alias.
# @param platform [String] The platform.
# @return [String] The database ID.
client.create_database('database_alias', 'platform')
  • Important Note: The platform can be either ‘aws’ or ‘managed’

List all databases

# @return [Array<Database>] The list of databases.
client.list_databases

Delete a database

# @param id [String] The database ID.

client.delete_database('id')
  • 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.