Tenants

Import the tenant resource module and instantiate the tenant-service client

[ ]:
from typing import Any

from peak.resources import tenants

client: tenants.Tenant = tenants.get_client()

List all available instance-options

Possible field values

Entity type

The entity type of the resource for which we want to fetch the instances. The possible values are: workflow, webapp, api-deployment, workspace, and feed.

[ ]:
instance_options: dict[str, Any] = client.list_instance_options(
    entity_type="workflow",
)

"""
The instance options will be returned in the following format:

{
  "data": [
    {
      "cpu": 125,
      "gpu": null,
      "gpuMemory": null,
      "id": 20,
      "instanceClass": "Genaeral Purpose",
      "memory": 125,
      "name": "Pico (0.125CPU, 0.125GB RAM)",
      "provider": "k8s",
      "providerInstanceId": null
    }
  ]
}
"""

Get Credentails for a Data Store

Possible field values

Data Store Type

The data_store_type of the data store for which to get the credentials. Currently, the only allowed value is - data-warehouse. The default value for data_store_type is data-warehouse.

[ ]:
credentials: dict[str, Any] = client.get_credentials()

"""
The credentials will be returned in the following format for the respective type of the data warehouse type:

Redshift
{
  "connectionString": "postgresql://good-user:<password>@a-good-redshift-host.com:5439/good-db",
  "iamRole": "arn:aws:iam::<account>:role/<role>,arn:aws:iam::<account>:role/<role>",
  "port": "5439",
  "schema": "publish",
  "user": "good-user",
  "authType": "basic",
  "database": "good-db",
  "host": "a-good-redshift-host.com",
  "password": "<password>",
  "dataWarehouseType": "amazon_redshift"
}

Snowflake (Basic Auth)
{
  "application": "good_app",
  "connectionString": "snowflake://user:<password>@host/database",
  "integration": "integration",
  "port": 443,
  "role": "role_name",
  "schema": "schema",
  "user": "user",
  "warehouse": "warehouse",
  "authType": "basic",
  "database": "dabase",
  "host": "host",
  "password": "<password>",
  "dataWarehouseType": "snowflake"
}

Snowflake (OAuth)
{
  "application": "application",
  "connectionString": "snowflake://host/database?authenticator=OAUTH&token=<generated-access-token>",
  "integration": "integration_name",
  "port": 443,
  "role": "role_name",
  "schema": "schema",
  "warehouse": "warehouse",
  "accessToken": "<generated-access-token>",
  "authType": "oauth",
  "database": "database",
  "host": "host",
  "dataWarehouseType": "snowflake"
}
"""