# ITenantEgressPolicyStore

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.itenantegresspolicystore/
> Summary: ITenantEgressPolicyStore: The store for per-tenant provider egress policies.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The store for per-tenant provider egress policies.

```csharp
public interface ITenantEgressPolicyStore
```

## Methods

### <a id="Tracon_ITenantEgressPolicyStore_DeleteAsync_System_String_System_Threading_CancellationToken_"></a> DeleteAsync\(string, CancellationToken\)

Deletes a tenant's policy, making the tenant unrestricted again.

```csharp
ValueTask<bool> DeleteAsync(string tenantId, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\>

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if a policy was found and deleted.

### <a id="Tracon_ITenantEgressPolicyStore_GetAsync_System_String_System_Threading_CancellationToken_"></a> GetAsync\(string, CancellationToken\)

Reads a tenant's policy.

```csharp
ValueTask<TenantEgressPolicy?> GetAsync(string tenantId, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[TenantEgressPolicy](/api/tracon.tenantegresspolicy/)?\>

The policy; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the tenant has none saved, which
means the tenant is unrestricted.

### <a id="Tracon_ITenantEgressPolicyStore_UpsertAsync_System_String_System_Collections_Generic_IReadOnlyList_System_String__System_Threading_CancellationToken_"></a> UpsertAsync\(string, IReadOnlyList<string\>, CancellationToken\)

Creates or replaces a tenant's policy.

```csharp
ValueTask<TenantEgressPolicy> UpsertAsync(string tenantId, IReadOnlyList<string> allowedProviders, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`allowedProviders` [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[string](https://learn.microsoft.com/dotnet/api/system.string)\>

The closed set of allowed provider names.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[TenantEgressPolicy](/api/tracon.tenantegresspolicy/)\>

The saved policy.
