TenantManager

public final class TenantManager extends Object

This class can be used to perform a variety of tenant-related operations, including creating, updating, and listing tenants.

Public Method Summary

Tenant
createTenant(Tenant.CreateRequest request)
Creates a new tenant with the attributes contained in the specified Tenant.CreateRequest.
ApiFuture<Tenant>
createTenantAsync(Tenant.CreateRequest request)
Similar to createTenant(CreateRequest) but performs the operation asynchronously.
void
deleteTenant(String tenantId)
Deletes the tenant identified by the specified tenant ID.
ApiFuture<Void>
deleteTenantAsync(String tenantId)
Similar to deleteTenant(String) but performs the operation asynchronously.
synchronized TenantAwareFirebaseAuth
getAuthForTenant(String tenantId)
Tenant
getTenant(String tenantId)
Gets the tenant corresponding to the specified tenant ID.
ApiFuture<Tenant>
getTenantAsync(String tenantId)
Similar to getTenant(String) but performs the operation asynchronously.
ListTenantsPage
listTenants(String pageToken, int maxResults)
Gets a page of tenants starting from the specified pageToken.
ListTenantsPage
listTenants(String pageToken)
Gets a page of tenants starting from the specified pageToken.
ApiFuture<ListTenantsPage>
listTenantsAsync(String pageToken, int maxResults)
Similar to listTenants(String, int) but performs the operation asynchronously.
ApiFuture<ListTenantsPage>
listTenantsAsync(String pageToken)
Similar to listTenants(String) but performs the operation asynchronously.
Tenant
updateTenant(Tenant.UpdateRequest request)
Updates an existing user account with the attributes contained in the specified Tenant.UpdateRequest.
ApiFuture<Tenant>
updateTenantAsync(Tenant.UpdateRequest request)
Similar to updateTenant(UpdateRequest) but performs the operation asynchronously.

Inherited Method Summary

Public Methods

public Tenant createTenant (Tenant.CreateRequest request)

Creates a new tenant with the attributes contained in the specified Tenant.CreateRequest.

Parameters
request A non-null Tenant.CreateRequest instance.
Returns
  • A Tenant instance corresponding to the newly created tenant.
Throws
NullPointerException if the provided request is null.
FirebaseAuthException if an error occurs while creating the tenant.

public ApiFuture<Tenant> createTenantAsync (Tenant.CreateRequest request)

Similar to createTenant(CreateRequest) but performs the operation asynchronously.

Parameters
request A non-null Tenant.CreateRequest instance.
Returns
  • An ApiFuture which will complete successfully with a Tenant instance corresponding to the newly created tenant. If an error occurs while creating the tenant, the future throws a FirebaseAuthException.
Throws
NullPointerException if the provided request is null.

public void deleteTenant (String tenantId)

Deletes the tenant identified by the specified tenant ID.

Parameters
tenantId A tenant ID string.
Throws
IllegalArgumentException If the tenant ID string is null or empty.
FirebaseAuthException If an error occurs while deleting the tenant.

public ApiFuture<Void> deleteTenantAsync (String tenantId)

Similar to deleteTenant(String) but performs the operation asynchronously.

Parameters
tenantId A tenant ID string.
Returns
  • An ApiFuture which will complete successfully when the specified tenant account has been deleted. If an error occurs while deleting the tenant account, the future throws a FirebaseAuthException.
Throws
IllegalArgumentException If the tenant ID string is null or empty.

public synchronized TenantAwareFirebaseAuth getAuthForTenant (String tenantId)

public Tenant getTenant (String tenantId)

Gets the tenant corresponding to the specified tenant ID.

Parameters
tenantId A tenant ID string.
Returns
Throws
IllegalArgumentException If the tenant ID string is null or empty.
FirebaseAuthException If an error occurs while retrieving user data.

public ApiFuture<Tenant> getTenantAsync (String tenantId)

Similar to getTenant(String) but performs the operation asynchronously.

Parameters
tenantId A tenantId string.
Returns
  • An ApiFuture which will complete successfully with a Tenant instance If an error occurs while retrieving tenant data or if the specified tenant ID does not exist, the future throws a FirebaseAuthException.
Throws
IllegalArgumentException If the tenant ID string is null or empty.

public ListTenantsPage listTenants (String pageToken, int maxResults)

Gets a page of tenants starting from the specified pageToken.

Parameters
pageToken A non-empty page token string, or null to retrieve the first page of tenants.
maxResults Maximum number of tenants to include in the returned page. This may not exceed 1000.
Returns
Throws
IllegalArgumentException If the specified page token is empty, or max results value is invalid.
FirebaseAuthException If an error occurs while retrieving tenant data.

public ListTenantsPage listTenants (String pageToken)

Gets a page of tenants starting from the specified pageToken. Page size will be limited to 1000 tenants.

Parameters
pageToken A non-empty page token string, or null to retrieve the first page of tenants.
Returns
Throws
IllegalArgumentException If the specified page token is empty.
FirebaseAuthException If an error occurs while retrieving tenant data.

public ApiFuture<ListTenantsPage> listTenantsAsync (String pageToken, int maxResults)

Similar to listTenants(String, int) but performs the operation asynchronously.

Parameters
pageToken A non-empty page token string, or null to retrieve the first page of tenants.
maxResults Maximum number of tenants to include in the returned page. This may not exceed 1000.
Returns
  • An ApiFuture which will complete successfully with a ListTenantsPage instance. If an error occurs while retrieving tenant data, the future throws an exception.
Throws
IllegalArgumentException If the specified page token is empty, or max results value is invalid.

public ApiFuture<ListTenantsPage> listTenantsAsync (String pageToken)

Similar to listTenants(String) but performs the operation asynchronously.

Parameters
pageToken A non-empty page token string, or null to retrieve the first page of tenants.
Returns
  • An ApiFuture which will complete successfully with a ListTenantsPage instance. If an error occurs while retrieving tenant data, the future throws an exception.
Throws
IllegalArgumentException If the specified page token is empty.

public Tenant updateTenant (Tenant.UpdateRequest request)

Updates an existing user account with the attributes contained in the specified Tenant.UpdateRequest.

Parameters
request A non-null Tenant.UpdateRequest instance.
Returns
  • A Tenant instance corresponding to the updated user account.
Throws
NullPointerException if the provided update request is null.
FirebaseAuthException if an error occurs while updating the user account.

public ApiFuture<Tenant> updateTenantAsync (Tenant.UpdateRequest request)

Similar to updateTenant(UpdateRequest) but performs the operation asynchronously.

Parameters
request A non-null Tenant.UpdateRequest instance.
Returns
  • An ApiFuture which will complete successfully with a Tenant instance corresponding to the updated user account. If an error occurs while updating the user account, the future throws a FirebaseAuthException.