-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customization of GetSecretValueRequest (#77)
- Loading branch information
1 parent
fba2e43
commit 5a81fc3
Showing
8 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Sample7 | ||
{ | ||
internal class Program | ||
{ | ||
private static void Main(string[] _) | ||
{ | ||
var builder = new ConfigurationBuilder(); | ||
|
||
/* | ||
Uses default credentials | ||
Uses default region | ||
Uses options to customize the GetSecretValueRequest (e.g. specify VersionStage) | ||
*/ | ||
|
||
builder.AddSecretsManager(configurator: options => | ||
{ | ||
options.ConfigureSecretValueRequest = (request, context) => request.VersionStage = "AWSCURRENT"; | ||
}); | ||
|
||
var configuration = builder.Build(); | ||
|
||
Console.WriteLine("Hello World!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Kralizek.Extensions.Configuration.AWSSecretsManager\Kralizek.Extensions.Configuration.AWSSecretsManager.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<IsPackable>false</IsPackable> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
</Project> |
30 changes: 30 additions & 0 deletions
30
src/Kralizek.Extensions.Configuration.AWSSecretsManager/Internal/SecretValueContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Amazon.SecretsManager.Model; | ||
|
||
namespace Kralizek.Extensions.Configuration.Internal | ||
{ | ||
/// <summary> | ||
/// A secret context when making a request to get a secret value. | ||
/// </summary> | ||
public class SecretValueContext | ||
{ | ||
public SecretValueContext(SecretListEntry secret) | ||
{ | ||
_ = secret ?? throw new ArgumentNullException(nameof(secret)); | ||
|
||
Name = secret.Name; | ||
VersionsToStages = secret.SecretVersionsToStages; | ||
} | ||
|
||
/// <summary> | ||
/// The secret name. | ||
/// </summary> | ||
public string Name { get; private set; } | ||
|
||
/// <summary> | ||
/// A list of all the secret's currently assigned SecretVersionStage staging levels and SecretVersionId attached to each one. | ||
/// </summary> | ||
public Dictionary<string, List<string>> VersionsToStages { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters