TenantManager class

Defines the tenant manager used to help manage tenant related operations. This includes:

  • The ability to create, update, list, get and delete tenants for the underlying project.
  • Getting a TenantAwareAuth instance for running Auth related operations (user management, provider configuration management, token verification, email link generation, etc) in the context of a specified tenant.

Signature:

exportdeclareclassTenantManager

Methods

MethodModifiersDescription
authForTenant(tenantId)Returns a TenantAwareAuth instance bound to the given tenant ID.
createTenant(tenantOptions)Creates a new tenant. When creating new tenants, tenants that use separate billing and quota will require their own project and must be defined as full_service.
deleteTenant(tenantId)Deletes an existing tenant.
getTenant(tenantId)Gets the tenant configuration for the tenant corresponding to a given tenantId.
listTenants(maxResults, pageToken)Retrieves a list of tenants (single batch only) with a size of maxResults starting from the offset as specified by pageToken. This is used to retrieve all the tenants of a specified project in batches.
updateTenant(tenantId, tenantOptions)Updates an existing tenant configuration.

TenantManager.authForTenant()

Returns a TenantAwareAuth instance bound to the given tenant ID.

Signature:

authForTenant(tenantId:string):TenantAwareAuth;

Parameters

ParameterTypeDescription
tenantIdstringThe tenant ID whose TenantAwareAuth instance is to be returned.

Returns:

TenantAwareAuth

The TenantAwareAuth instance corresponding to this tenant identifier.

TenantManager.createTenant()

Creates a new tenant. When creating new tenants, tenants that use separate billing and quota will require their own project and must be defined as full_service.

Signature:

createTenant(tenantOptions:CreateTenantRequest):Promise<Tenant>;

Parameters

ParameterTypeDescription
tenantOptionsCreateTenantRequestThe properties to set on the new tenant configuration to be created.

Returns:

Promise<Tenant>

A promise fulfilled with the tenant configuration corresponding to the newly created tenant.

TenantManager.deleteTenant()

Deletes an existing tenant.

Signature:

deleteTenant(tenantId:string):Promise<void>;

Parameters

ParameterTypeDescription
tenantIdstringThe tenantId corresponding to the tenant to delete.

Returns:

Promise<void>

An empty promise fulfilled once the tenant has been deleted.

TenantManager.getTenant()

Gets the tenant configuration for the tenant corresponding to a given tenantId.

Signature:

getTenant(tenantId:string):Promise<Tenant>;

Parameters

ParameterTypeDescription
tenantIdstringThe tenant identifier corresponding to the tenant whose data to fetch.

Returns:

Promise<Tenant>

A promise fulfilled with the tenant configuration to the provided tenantId.

TenantManager.listTenants()

Retrieves a list of tenants (single batch only) with a size of maxResults starting from the offset as specified by pageToken. This is used to retrieve all the tenants of a specified project in batches.

Signature:

listTenants(maxResults?:number,pageToken?:string):Promise<ListTenantsResult>;

Parameters

ParameterTypeDescription
maxResultsnumberThe page size, 1000 if undefined. This is also the maximum allowed limit.
pageTokenstringThe next page token. If not specified, returns tenants starting without any offset.

Returns:

Promise<ListTenantsResult>

A promise that resolves with a batch of downloaded tenants and the next page token.

TenantManager.updateTenant()

Updates an existing tenant configuration.

Signature:

updateTenant(tenantId:string,tenantOptions:UpdateTenantRequest):Promise<Tenant>;

Parameters

ParameterTypeDescription
tenantIdstringThe tenantId corresponding to the tenant to delete.
tenantOptionsUpdateTenantRequestThe properties to update on the provided tenant.

Returns:

Promise<Tenant>

A promise fulfilled with the update tenant data.