-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathAwsSystemManagerNamedApiConnectionDetailsReader.cs
34 lines (28 loc) · 1.37 KB
/
AwsSystemManagerNamedApiConnectionDetailsReader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: Apache-2.0
// Licensed to the Ed-Fi Alliance under one or more agreements.
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
using EdFi.Tools.ApiPublisher.Connections.Api.Configuration;
using EdFi.Tools.ApiPublisher.Core.Configuration;
using Microsoft.Extensions.Configuration;
namespace EdFi.Tools.ApiPublisher.ConfigurationStore.Aws
{
public class AwsSystemManagerNamedApiConnectionDetailsReader : INamedApiConnectionDetailsReader
{
public ApiConnectionDetails GetNamedApiConnectionDetails(
string apiConnectionName,
IConfigurationSection configurationStoreSection)
{
var awsOptions = configurationStoreSection.GetAWSOptions("awsParameterStore");
// Load named connection information from AWS Systems Manager
var config = new ConfigurationBuilder()
.AddSystemsManager(ConfigurationStoreHelper.Key(apiConnectionName), awsOptions)
.Build();
// Read the connection details from the configuration values
var connectionDetails = config.Get<ApiConnectionDetails>();
// Assign the connection name
connectionDetails.Name = apiConnectionName;
return connectionDetails;
}
}
}