Module: WolfCore::LambdaFunctionDataSource
- Defined in:
- lib/wolf_core/infrastructure/lambda_function_data_source.rb
Class Method Summary collapse
Class Method Details
.client ⇒ Object
15 16 17 |
# File 'lib/wolf_core/infrastructure/lambda_function_data_source.rb', line 15 def client @@client end |
.init ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/wolf_core/infrastructure/lambda_function_data_source.rb', line 5 def init client_config = { access_key_id: ENV.fetch('AWS_KEY_ID', nil), secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY', nil), region: ENV.fetch('AWS_REGION', nil) }.compact return if client_config.empty? @@client = Aws::Lambda::Client.new(client_config) end |
.invoke(function_name:, payload:) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/wolf_core/infrastructure/lambda_function_data_source.rb', line 19 def invoke(function_name:, payload:) parsed_payload = JSON.generate(payload) @@client.invoke({ function_name: function_name, invocation_type: 'Event', log_type: 'Tail', payload: parsed_payload }) end |