Method: AwsSnsTopics#fetch_from_api

Defined in:
lib/resources/aws/aws_sns_topics.rb

#fetch_from_apiObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/resources/aws/aws_sns_topics.rb', line 25

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  @table = []
  pagination_opts = nil
  catch_aws_errors do
    loop do
      api_result = backend.list_topics(pagination_opts)
      @table += api_result.topics.map(&:to_h)
      break if api_result.next_token.nil?

      pagination_opts = { next_token: api_result.next_token }
    end
  end
end