Module: Awspec::Helper::Finder::Lambda
- Included in:
- Awspec::Helper::Finder
- Defined in:
- lib/awspec/helper/finder/lambda.rb
Instance Method Summary collapse
- #find_lambda(id) ⇒ Object
- #select_all_lambda_functions ⇒ Object
- #select_event_source_by_function_arn(function_arn) ⇒ Object
Instance Method Details
#find_lambda(id) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/awspec/helper/finder/lambda.rb', line 4 def find_lambda(id) selected = [] res = lambda_client.list_functions loop do selected += res.functions.select do |function| function.function_name == id || function.function_arn == id end (res.next_page? && res = res.next_page) || break end selected.single_resource(id) end |
#select_all_lambda_functions ⇒ Object
25 26 27 28 29 |
# File 'lib/awspec/helper/finder/lambda.rb', line 25 def select_all_lambda_functions res = lambda_client.list_functions.map do |responce| responce.functions end.flatten end |
#select_event_source_by_function_arn(function_arn) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/awspec/helper/finder/lambda.rb', line 18 def select_event_source_by_function_arn(function_arn) res = lambda_client.list_event_source_mappings({ function_name: function_arn }) res.event_source_mappings end |