SecretsManagerFacadeLib 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SecretsManagerFacadeLib --version 1.0.2
NuGet\Install-Package SecretsManagerFacadeLib -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SecretsManagerFacadeLib" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SecretsManagerFacadeLib --version 1.0.2
#r "nuget: SecretsManagerFacadeLib, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SecretsManagerFacadeLib as a Cake Addin
#addin nuget:?package=SecretsManagerFacadeLib&version=1.0.2

// Install SecretsManagerFacadeLib as a Cake Tool
#tool nuget:?package=SecretsManagerFacadeLib&version=1.0.2

SecretsManagerFacadeLib

Convenience lib that offers support to retrieve Aws Credentials and Aws Secrets Manager stored properties.
It uses client side caching (supported by official Aws cache lib) to prevent further http calls.

Usage

**1. Declare components in Startup.cs 😗*

services.AddSingleton(RegionEndpoint.SAEast1);  // inject the desired aws region
services.AddSingleton<ISecretsManagerClient, SecretsManagerClient>();  
services.AddSingleton<ISecretsManagerFacade, SecretsManagerFacade>();
services.AddSingleton<ICredentialsFacade<AwsCredentials>, AWSCredentialsFacade>();

**2. Inject the Facade client in your class 😗*

public SqsClient(ICredentialsFacade<AwsCredentials> credentialsFacade)
{
    _credentialsFacade = credentialsFacade;
}

3. Retrieve the desired credentials

For AwsCredentials
var awsCredentials = _credentialsFacade.GetCredentials();

Of course: you have to store the credentials in Aws Secrets Manager using a Json format, for example:

{
  "accountid": "YOUR-ACCOUNT-ID",
  "accesskey": "YOUR-ACCESS-KEY",
  "secretkey": "YOUR-SECRET-KEY",
  "region": "YOUR-REGION-ID"
}
For general string-based properties

Example: to retrieve a hypothetical ApiKey value (stored in plain string in Secrets Manager), you'll want your appsettings.json like this:

"MySection": {
    "SecretsManager": "YOUR-SECRET-ID"
}

Then call it in your code:

var MySection = _configuration.GetSection("MySection");
var SecretId = MySection["SecretsManager"];
var ApiKey = _credentialsFacade.GetStringProperty(SecretId);
For general object-based properties

Example: to retrieve a hypothetical object with username and password properties, you'll want your appsettings.json like this:

"Credentials": {
    "SecretsManager": "YOUR-SECRET-ID"
}

Then call it in your code:

var MyCredentialsSection = _configuration.GetSection("Credentials");
var SecretId = MySection["SecretsManager"];
var mySecretValue = _credentialsFacade.GetObjectProperty<T>(SecretId);

Again, you have to store the object in Aws Secrets Manager using a Json format. In this case:

{
  "username": "YOUR-USERNAME",
  "password": "YOUR-PASSWORD"
}

IMPORTANT

For Aws credentials, the section must be declared in appsettings.json like this:

"Aws": {
    "SecretsManager": "YOUR-SECRET-ID"
}

It works parsing hardcoded values too:

"Aws": {
    "AccountId": "YOUR-ACCOUNT-ID",
    "AccessKey": "YOUR-ACCESS-KEY",
    "SecretKey": "YOUR-SECRET-KEY",
    "Region": "YOUR-REGION-ID"
}

although, for security reasons, is strongly suggested that you use Secrets Manager stored property values.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 459 5/28/2021
1.0.2 509 7/10/2020
1.0.1 528 7/10/2020
1.0.0 438 6/10/2020