Table of Contents

Class AwsSecretsManagerProvider

Namespace
Builvero.Infrastructure.Services
Assembly
Builvero.Infrastructure.dll

AWS Secrets Manager implementation of ISecretsProvider. Used only when BUILVERO_ENV=staging|production.

public sealed class AwsSecretsManagerProvider : ISecretsProvider
Inheritance
AwsSecretsManagerProvider
Implements
Inherited Members

Constructors

AwsSecretsManagerProvider(IAmazonSecretsManager, ILogger<AwsSecretsManagerProvider>)

Initializes a new instance of the AwsSecretsManagerProvider class.

public AwsSecretsManagerProvider(IAmazonSecretsManager secretsManager, ILogger<AwsSecretsManagerProvider> logger)

Parameters

secretsManager IAmazonSecretsManager

The AWS Secrets Manager client.

logger ILogger<AwsSecretsManagerProvider>

Logger for recording secret operations.

Methods

GetRequiredSecretAsync(string, CancellationToken)

Retrieves a secret value by name, throwing an exception if not found.

public Task<string> GetRequiredSecretAsync(string secretName, CancellationToken cancellationToken = default)

Parameters

secretName string

The name or identifier of the secret.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The secret value.

Exceptions

InvalidOperationException

Thrown when the secret is not found.

GetSecretAsync(string, CancellationToken)

Retrieves a secret value by name.

public Task<string?> GetSecretAsync(string secretName, CancellationToken cancellationToken = default)

Parameters

secretName string

The name or identifier of the secret.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The secret value, or null if not found.