chore: deploy initial code base

This commit is contained in:
Thom Lamb
2026-05-12 10:34:30 -05:00
parent cce2961782
commit a81300a571
1829 changed files with 248331 additions and 1 deletions
@@ -0,0 +1,96 @@
using Amazon.SecretsManager.Extensions.Caching;
using Amazon.SecretsManager.Model;
using Microsoft.Extensions.Options;
using Strata.SnowflakeLib;
using Strata.SnowflakeLib.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.ExceptionServices;
namespace Strata.DecisionSupport.Biz.Test.Integration
{
public class SnowflakeTestConnectionStringBuilderFactory : ISnowflakeConnectionStringBuilderFactory
{
private readonly SecretsManagerCache _secretsManagerCache;
private readonly SnowflakeOptions _snowflakeOptions;
/// <summary>
/// Constructor that uses configuration values to generate the factory
/// </summary>
/// <param name="logger">logger to allow output of message to our centralized logging system</param>
/// <param name="secretsManagerCache">aws secrets manager cache injected during DI for faster lookup</param>
/// <param name="snowflakeOptions">The options class that holds configuration, forcing the consumer of the nuget to have certain settings</param>
/// <param name="claimsPrincipalAccessor">Claims accessor object to expose an interface to pull the identity and database information</param>
public SnowflakeTestConnectionStringBuilderFactory(
[NotNull] SecretsManagerCache secretsManagerCache,
//[NotNull]
IOptions<SnowflakeOptions> snowflakeOptions)
{
try
{
_secretsManagerCache = secretsManagerCache ?? throw new ArgumentNullException(nameof(secretsManagerCache));
_snowflakeOptions = snowflakeOptions?.Value ?? throw new ArgumentNullException(nameof(snowflakeOptions));
}
catch (Exception ex)
{
throw;
}
}
/// <summary>
/// Method to get a snowflake connection string through secrets manager.
/// </summary>
/// <param name="secretName">The aws secret name to lookup the snowflake connection string</param>
/// <returns>The connection string builder for the connection string stored at the awws secret name</returns>
public async Task<SnowflakeConnectionStringBuilder> CreateAsync(string secretName)
{
return await CreateAsync(secretName, Guid.Empty);
}
/// <summary>
/// Method to get a snowflake connection string through secrets manager.
/// </summary>
/// <param name="secretName">The aws secret name to lookup the snowflake connection string</param>
/// <param name="databaseGuid">The database guid used to make the connection</param>
/// <returns>The connection string builder for the connection string stored at the awws secret name</returns>
public async Task<SnowflakeConnectionStringBuilder> CreateAsync(string secretName, Guid databaseGuid)
{
SnowflakeConnectionStringBuilder builder = null;
try
{
var snowflakeConnectionString = await _secretsManagerCache.GetSecretString(secretName);
builder = new SnowflakeConnectionStringBuilder(snowflakeConnectionString)
{
URL = _snowflakeOptions.Url,
Account = _snowflakeOptions.Account,
// IgnoreCase = true,
// QueryPassthrough = true,
Timeout = (int)TimeSpan.FromHours(10).TotalSeconds,
// Other = "RetryStatusCodes=500"
DatabaseGuid = databaseGuid
};
}
catch (ResourceNotFoundException e)
{
ExceptionDispatchInfo.Capture(e).Throw();
}
catch (InvalidRequestException e)
{
ExceptionDispatchInfo.Capture(e).Throw();
}
catch (InvalidParameterException e)
{
ExceptionDispatchInfo.Capture(e).Throw();
}
catch (Exception e)
{
ExceptionDispatchInfo.Capture(e).Throw();
}
return builder;
}
}
}