class CloudFront

Collect CloudFront resources

Public Instance Methods

collect() click to toggle source

Returns an array of resources.

# File lib/aws_recon/collectors/cloudfront.rb, line 10
def collect
  resources = []

  #
  # list_distributions
  #
  @client.list_distributions.each_with_index do |response, page|
    log(response.context.operation_name, page)

    # get_distribution
    response.distribution_list.items.each do |dist|
      struct = OpenStruct.new(dist.to_h)
      struct.type = 'distribution'
      struct.details = @client
                       .get_distribution({ id: dist.id })
                       .distribution.to_h

      resources.push(struct.to_h)
    end
  end

  resources
end