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 aTenantAwareAuth 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 aTenantAwareAuth 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 asfull_service.
deleteTenant(tenantId)Deletes an existing tenant.
getTenant(tenantId)Gets the tenant configuration for the tenant corresponding to a giventenantId.
listTenants(maxResults, pageToken)Retrieves a list of tenants (single batch only) with a size ofmaxResults starting from the offset as specified bypageToken. 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 aTenantAwareAuth instance bound to the given tenant ID.

Signature:

authForTenant(tenantId:string):TenantAwareAuth;

Parameters

ParameterTypeDescription
tenantIdstringThe tenant ID whoseTenantAwareAuth instance is to be returned.

Returns:

TenantAwareAuth

TheTenantAwareAuth 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 asfull_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
tenantIdstringThetenantId 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 giventenantId.

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 providedtenantId.

TenantManager.listTenants()

Retrieves a list of tenants (single batch only) with a size ofmaxResults starting from the offset as specified bypageToken. 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
tenantIdstringThetenantId 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.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-07-29 UTC.