예제 #1
0
 public FunctionAction(FunctionSettings settings,
                       IAmazonIdentityManagementService iamClient,
                       IAmazonSimpleEmailService sesClient,
                       ILambdaContext context)
 {
     _settings  = settings;
     _iamClient = iamClient;
     _sesClient = sesClient;
     _context   = context;
 }
예제 #2
0
        /// <summary>
        /// Constructs an instance with preconfigured client(s).
        /// This variation of the constructor can be used for testing and invocation
        /// outside of the Lambda execution environment.
        /// </summary>
        /// <param name="iamClient"></param>
        public Function(
            IAmazonIdentityManagementService iamClient,
            IAmazonSimpleEmailService sesClient)
        {
            _iamClient = iamClient;
            _sesClient = sesClient;

            _config = new ConfigurationBuilder()
                      .AddEnvironmentVariables(EnvVarsConfigPrefix)
                      .AddJsonFile("appsettings.json", optional: true)
                      .Build();
            System.Console.WriteLine("GOT CONFIG: "
                                     + Newtonsoft.Json.JsonConvert.SerializeObject(
                                         _config, Newtonsoft.Json.Formatting.Indented));

            _settings = _config.Get <FunctionSettings>();
            System.Console.WriteLine("GOT SETTINGS: "
                                     + Newtonsoft.Json.JsonConvert.SerializeObject(
                                         _settings, Newtonsoft.Json.Formatting.Indented));
        }