# Secret Manager v1beta1 API - Class ServiceCollectionExtensions (3.0.0-beta07)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.0.0-beta07 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)
- [3.0.0-beta06](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/3.0.0-beta06/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)
- [2.0.0-beta05](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/2.0.0-beta05/Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions)

    public static class ServiceCollectionExtensions

Reference documentation and code samples for the Secret Manager v1beta1 API class ServiceCollectionExtensions.

Static class to provide extension methods to configure API clients.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ServiceCollectionExtensions

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Microsoft.Extensions.DependencyInjection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Microsoft.Extensions.DependencyInjection)

## Assembly

Google.Cloud.SecretManager.V1Beta1.dll

## Methods

### AddSecretManagerServiceClient(IServiceCollection, Action\<SecretManagerServiceClientBuilder\>)

    public static IServiceCollection AddSecretManagerServiceClient(this IServiceCollection services, Action<SecretManagerServiceClientBuilder> action = null)

Adds a singleton [SecretManagerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Google.Cloud.SecretManager.V1Beta1.SecretManagerServiceClient) to `services`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `services` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The service collection to add the client to. The services are used to configure the client when requested. |
| `action` | `https://learn.microsoft.com/dotnet/api/system.action-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Google.Cloud.SecretManager.V1Beta1.SecretManagerServiceClientBuilder` An optional action to invoke on the client builder. This is invoked before services from `services` are used. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` |   |

### AddSecretManagerServiceClient(IServiceCollection, Action\<IServiceProvider, SecretManagerServiceClientBuilder\>)

    public static IServiceCollection AddSecretManagerServiceClient(this IServiceCollection services, Action<IServiceProvider, SecretManagerServiceClientBuilder> action)

Adds a singleton [SecretManagerServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Google.Cloud.SecretManager.V1Beta1.SecretManagerServiceClient) to `services`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `services` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` The service collection to add the client to. The services are used to configure the client when requested. |
| `action` | `https://learn.microsoft.com/dotnet/api/system.action-2System.IServiceProviderhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1Beta1/latest/Google.Cloud.SecretManager.V1Beta1.SecretManagerServiceClientBuilder` An optional action to invoke on the client builder. This is invoked before services from `services` are used. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection` |   |