Tenant
Tenants client module.
- peak.resources.tenants.get_client(session=None)
Returns a Tenant client, If no session is provided, a default session is used.
- class peak.resources.tenants.Tenant(session=None)
Tenant client class.
- Parameters:
session (Session) –
- get_credentials(data_store_type=None, warehouse_name=None, all_warehouses=False)
Retrieve credentials for a given data store type.
- REFERENCE:
- Parameters:
data_store_type (str) – The type of the data store. Allowed values are - data-warehouse. Default - data-warehouse
warehouse_name (str) – Optional name of the specific warehouse to retrieve credentials for. If not provided, returns credentials for the default warehouse.
all_warehouses (bool) – When True, the response includes a
warehouseMapfield containing all configured Snowflake warehouse labels and names. Defaults to False.
- Returns:
- a dictionary containing the credentials for the data store.
For Snowflake warehouses with
all_warehouses=True, the response includeswarehouse(str) for backward compatibility, andwarehouseMap(dict) mapping warehouse labels to names, e.g.{"default": "SMALL_WH", "large": "LARGE_WH"}.
- Return type:
Dict[str, Any]
Example:
creds = tenant.get_credentials(all_warehouses=True) # small job conn = snowflake.connect(..., warehouse=creds["warehouseMap"]["default"]) # large job conn = snowflake.connect(..., warehouse=creds["warehouseMap"]["large"])
- Raises:
BadRequestException – The given request parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given warehouse/data store does not exist.
InternalServerErrorException – The server failed to process the request.
- Parameters:
data_store_type (str | None) –
warehouse_name (str | None) –
all_warehouses (bool) –
- Return type:
Dict[str, Any]
- list_instance_options(entity_type)
Retrieve details of allowed instance options for a tenant.
- REFERENCE:
- Parameters:
entity_type (str) – The type of the entity. Allowed values are - api-deployment, data-bridge, webapp, workflow, workspace.
- Returns:
a dictionary containing the details of the allowed instance options of a tenant.
- Return type:
Dict[str, Any]
- Raises:
BadRequestException – The given request parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given image does not exist.
InternalServerErrorException – The server failed to process the request.
- list_warehouses()
Retrieve list of all data warehouses for the tenant.
- REFERENCE:
- Returns:
a dictionary containing the list of data warehouses with the following structure:
{ "dataStores": [ { "id": "warehouse-id", "name": "warehouse-name", "type": "data_warehouse", "variant": "snowflake" or "amazon_redshift", "status": "active" or "draft" or "failed", "metadata": { "isDefault": true or false, ... }, ... } ], "pageSize": 20 }
- Return type:
Dict[str, Any]
- Raises:
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – No warehouses found.
InternalServerErrorException – The server failed to process the request.