Method: AwsEc2Instances#fetch_from_api

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

#fetch_from_apiObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/resources/aws/aws_ec2_instances.rb', line 29

def fetch_from_api
  backend = BackendFactory.create(inspec_runner)
  @table = []
  pagination_opts = {}
  loop do
    api_result = backend.describe_instances(pagination_opts)
    @table += unpack_describe_instances_response(api_result.reservations)
    break unless api_result.next_token
    pagination_opts = { next_token: api_result.next_token }
  end
end