public SystemsManagerProcessor(SystemsManagerConfigurationSource source)
 {
     Source = source;
     Source.ParameterProcessor = Source.ParameterProcessor ??
                                 (IsSecretsManagerPath(Source.Path)
             ? new JsonParameterProcessor()
             : new DefaultParameterProcessor());
 }
        public SystemsManagerConfigurationProviderTests()
        {
            _systemsManagerProcessorMock = new Mock <ISystemsManagerProcessor>();
            var source = new SystemsManagerConfigurationSource
            {
                AwsOptions = new AWSOptions(),
                Path       = Path
            };

            _provider = new SystemsManagerConfigurationProvider(source, _systemsManagerProcessorMock.Object);
        }
Esempio n. 3
0
        public void BuildSuccessTest()
        {
            var source = new SystemsManagerConfigurationSource
            {
                AwsOptions = new AWSOptions(),
                Path       = "/temp/"
            };
            var builder = new ConfigurationBuilder();

            var result = source.Build(builder);

            Assert.IsType <SystemsManagerConfigurationProvider>(result);
        }
        /// <summary>
        /// Adds an <see cref="IConfigurationProvider"/> that reads configuration values from AWS Systems Manager Parameter variables with a specified path.
        /// </summary>
        /// <param name="builder">The <see cref="IConfigurationBuilder"/> to add to.</param>
        /// <param name="configureSource">Configures the source.</param>
        /// <exception cref="ArgumentNullException"><see cref="configureSource"/> cannot be null</exception>
        /// <exception cref="ArgumentNullException"><see cref="configureSource"/>.<see cref="SystemsManagerConfigurationSource.Path"/> cannot be null</exception>
        /// <exception cref="ArgumentException"><see cref="configureSource"/>.<see cref="SystemsManagerConfigurationSource.Path"/> does not support Secrets Manager prefix (/aws/reference/secretsmanager/)</exception>
        /// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
        public static IConfigurationBuilder AddSystemsManager(this IConfigurationBuilder builder, Action <SystemsManagerConfigurationSource> configureSource)
        {
            if (configureSource == null)
            {
                throw new ArgumentNullException(nameof(configureSource));
            }

            var source = new SystemsManagerConfigurationSource();

            configureSource(source);

            if (string.IsNullOrWhiteSpace(source.Path))
            {
                throw new ArgumentNullException(nameof(source.Path));
            }
            if (source.AwsOptions != null)
            {
                return(builder.Add(source));
            }

            source.AwsOptions = builder.GetAwsOptions();
            return(builder.Add(source));
        }
Esempio n. 5
0
 public SystemsManagerProcessor(SystemsManagerConfigurationSource source)
 {
     Source = source;
     Source.ParameterProcessor = Source.ParameterProcessor ?? new DefaultParameterProcessor();
 }
Esempio n. 6
0
 public ConfigurationProvider(SystemsManagerConfigurationSource source)
 {
     _reloadAfter = source.ReloadAfter;
     _provider    = new SystemsManagerConfigurationProvider(source);
 }
        public void FiltersInitializedTest()
        {
            var source = new SystemsManagerConfigurationSource();

            Assert.NotNull(source.Filters);
        }