The following packages are installed in my Visual Studio solution’s project:
Amazon.Extensions.Configuration.SystemsManager" Version="4.0.0"
Amazon.Lambda.APIGatewayEvents" Version="2.5.0"
Amazon.Lambda.Core" Version="2.1.0"
Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0"
AWSSDK.S3" Version="3.7.9.21"
AWSSDK.SecretsManager" Version="3.7.2.65"
AWSSDK.SecretsManager.Caching" Version="1.0.4"
Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.27"
Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.27"
Microsoft.Extensions.Configuration.Json" Version="3.1.27"
Microsoft.Extensions.DependencyInjection" Version="3.1.27"
Microsoft.Extensions.Logging" Version="3.1.27"
Microsoft.Extensions.Logging.Console" Version="3.1.27"
starkbank-ecdsa" Version="1.3.3"
Swashbuckle.AspNetCore" Version="6.3.0"
Let’s say that my AWS Cloud account has the following parameters:
/bible/OldTestament/Law/Genesis/Chapter1
/bible/OldTestament/Law/Genesis/Chapter2
/bible/OldTestament/Law/Genesis/Chapter3
….. /bible/OldTestament/Law/Exodus/Chapter1
/bible/OldTestament/Law/Exodus/Chapter2
….. /bible/NewTestament/Gospel/Mark/Chapter1
/bible/NEwTestament/Gospel/Mark/Chapter2
….. /bible/NewTestament/Gospel/John/Chapter1
/bible/NewTestament/Gospel/John/Chapter2
private GetParametersByPathResponse GetMyAppAWSParameters(string path)
{
GetParametersByPathRequest request = new GetParametersByPathRequest()
{
Path = path,
WithDecryption = false
};
return _ssm.GetParametersByPathAsync(request).Result;
}
The aforementioned method works with Paths that are just one-level up from the Leaf Node (i.e.,
path = /bible/OldTestament/Law/Genesis/
The returned response parameter list contains:
/bible/OldTestament/Law/Genesis/Chapter1
/bible/OldTestament/Law/Genesis/Chapter2
/bible/OldTestament/Law/Genesis/Chapter3
Or
path = /bible/NewTestament/Gospel/John/
The return response parameter list contains:
/bible/NewTestament/Gospel/John/Chapter1
/bible/NewTestament/Gospel/John/Chapter2
However, if I provide a shorter paths further up the hierarchy like the following:
path = /bible/OldTestament/Law/
Or
path = /bible/NewTestament/
Unfortunately The return response parameter list is empty
Essentially, I was trying to implement code that is flexible, intelligent & sophisticated enough to handle paths regardless of the hierarchy level. What code do I need to allow me to do this?
It works when I set Recursive to true.
private GetParametersByPathResponse GetMyAppAWSParameters(string
path)
{
GetParametersByPathRequest request = new GetParametersByPathRequest()
{
Path = path,
Recursive = true,
WithDecryption = false
};
return _ssm.GetParametersByPathAsync(request).Result;
}