# FirebaseAdmin.Auth.Multitenancy.TenantManager

The tenant manager facilitates GCIP multitenancy related operations.

## Summary

This includes:

- Creating, updating, retrieving and deleting tenants in the underlying project.
- Obtaining [TenantAwareFirebaseAuth](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant-aware-firebase-auth.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant_aware_firebase_auth) instances for performing operations (user management, provider configuration management, token verification, email link generation, etc) in the context of a specified tenant.

<br />

### Inheritance

Inherits from: IDisposable

| ### Public functions ||
|---|---|
| `AuthForTenant(string tenantId)` | `TenantAwareFirebaseAuth` Gets a [TenantAwareFirebaseAuth](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant-aware-firebase-auth.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant_aware_firebase_auth) instance scoped to the specified tenant. |
| `CreateTenantAsync(TenantArgs args)` | `async Task< Tenant >` Creates a new tenant. |
| `CreateTenantAsync(TenantArgs args, CancellationToken cancellationToken)` | `async Task< Tenant >` Creates a new tenant. |
| `DeleteTenantAsync(string tenantId)` | `async Task` Deletes the tenant corresponding to the given *tenantId* . |
| `DeleteTenantAsync(string tenantId, CancellationToken cancellationToken)` | `async Task` Deletes the tenant corresponding to the given *tenantId* . |
| `GetTenantAsync(string tenantId)` | `async Task< Tenant >` Gets the [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant) corresponding to the given *tenantId* . |
| `GetTenantAsync(string tenantId, CancellationToken cancellationToken)` | `async Task< Tenant >` Gets the [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant) corresponding to the given *tenantId* . |
| `ListTenantsAsync(ListTenantsOptions options)` | `PagedAsyncEnumerable< TenantsPage, Tenant >` Gets an async enumerable to iterate or page through tenants starting from the specified page token. |
| `UpdateTenantAsync(string tenantId, TenantArgs args)` | `async Task< Tenant >` Updates an existing tenant. |
| `UpdateTenantAsync(string tenantId, TenantArgs args, CancellationToken cancellationToken)` | `async Task< Tenant >` Updates an existing tenant. |

## Public functions

### AuthForTenant

```
TenantAwareFirebaseAuth AuthForTenant(
  string tenantId
)
```
Gets a [TenantAwareFirebaseAuth](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant-aware-firebase-auth.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant_aware_firebase_auth) instance scoped to the specified tenant.


Details Parameters `tenantId` A tenant identifier string. Exceptions `ArgumentException` If the tenant ID argument is null, empty, or malformed. **Returns** An object that can be used to perform tenant-aware operations.

### CreateTenantAsync

```
async Task< Tenant > CreateTenantAsync(
  TenantArgs args
)
```
Creates a new tenant.


Details Parameters `args` Arguments that describe the new tenant configuration. Exceptions `ArgumentNullException` If *args* is null. `FirebaseAuthException` If an unexpected error occurs while creating the tenant. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).

### CreateTenantAsync

```
async Task< Tenant > CreateTenantAsync(
  TenantArgs args,
  CancellationToken cancellationToken
)
```
Creates a new tenant.


Details Parameters `args` Arguments that describe the new tenant configuration. `cancellationToken` A cancellation token to monitor the asynchronous operation. Exceptions `ArgumentNullException` If *args* is null. `FirebaseAuthException` If an unexpected error occurs while creating the tenant. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).

### DeleteTenantAsync

```
async Task DeleteTenantAsync(
  string tenantId
)
```
Deletes the tenant corresponding to the given *tenantId* .


Details Parameters `tenantId` A tenant identifier string. Exceptions `ArgumentException` If the tenant ID argument is null, empty, or malformed. `FirebaseAuthException` If a tenant cannot be found with the specified ID. **Returns** A task that completes when the tenant is deleted.

### DeleteTenantAsync

```
async Task DeleteTenantAsync(
  string tenantId,
  CancellationToken cancellationToken
)
```
Deletes the tenant corresponding to the given *tenantId* .


Details Parameters `tenantId` A tenant identifier string. `cancellationToken` A cancellation token to monitor the asynchronous operation. Exceptions `ArgumentException` If the tenant ID argument is null, empty, or malformed. `FirebaseAuthException` If a tenant cannot be found with the specified ID. **Returns** A task that completes when the tenant is deleted.

### GetTenantAsync

```
async Task< Tenant > GetTenantAsync(
  string tenantId
)
```
Gets the [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant) corresponding to the given *tenantId* .


Details Parameters `tenantId` A tenant identifier string. Exceptions `ArgumentException` If the tenant ID argument is null, empty, or malformed. `FirebaseAuthException` If a tenant cannot be found with the specified ID. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).

### GetTenantAsync

```
async Task< Tenant > GetTenantAsync(
  string tenantId,
  CancellationToken cancellationToken
)
```
Gets the [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant) corresponding to the given *tenantId* .


Details Parameters `tenantId` A tenant identifier string. `cancellationToken` A cancellation token to monitor the asynchronous operation. Exceptions `ArgumentException` If the tenant ID argument is null, empty, or malformed. `FirebaseAuthException` If a tenant cannot be found with the specified ID. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).

### ListTenantsAsync

```
PagedAsyncEnumerable< TenantsPage, Tenant > ListTenantsAsync(
  ListTenantsOptions options
)
```
Gets an async enumerable to iterate or page through tenants starting from the specified page token.

If the page token is null or unspecified, iteration starts from the first page. See [Page Streaming](https://googleapis.github.io/google-cloud-dotnet/docs/guides/page-streaming.html) for more details on how to use this API.


Details Parameters `options` The options to control the starting point and page size. Pass null to list from the beginning with default settings. **Returns** A PagedAsyncEnumerable{TenantsPage, Tenant} instance.

### UpdateTenantAsync

```
async Task< Tenant > UpdateTenantAsync(
  string tenantId,
  TenantArgs args
)
```
Updates an existing tenant.


Details Parameters `tenantId` ID of the tenant to be updated. `args` Properties to be updated in the tenant. Exceptions `ArgumentException` If *tenantId* is null, empty, or malformed, or if *args* does not contain any values. `ArgumentNullException` If *args* is null. `FirebaseAuthException` If an unexpected error occurs while updating the tenant. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).

### UpdateTenantAsync

```
async Task< Tenant > UpdateTenantAsync(
  string tenantId,
  TenantArgs args,
  CancellationToken cancellationToken
)
```
Updates an existing tenant.


Details Parameters `tenantId` ID of the tenant to be updated. `args` Properties to be updated in the tenant. `cancellationToken` A cancellation token to monitor the asynchronous operation. Exceptions `ArgumentException` If *tenantId* is null, empty, or malformed, or if *args* does not contain any values. `ArgumentNullException` If *args* is null. `FirebaseAuthException` If an unexpected error occurs while updating the tenant. **Returns** A task that completes with a [Tenant](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/auth/multitenancy/tenant.md.txt#class_firebase_admin_1_1_auth_1_1_multitenancy_1_1_tenant).