Module: AwsPublicIps::Checks::Cloudfront

Defined in:
lib/aws_public_ips/checks/cloudfront.rb

Class Method Summary collapse

Class Method Details

.runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/aws_public_ips/checks/cloudfront.rb', line 9

def self.run
  client = ::Aws::CloudFront::Client.new
  return [] unless ::AwsPublicIps::Utils.has_service?(client)

  # Cloudfront distrubtions are always public, they don't have a concept of VPC
  # No "coming up" problem here like with RDS/Redshift

  client.list_distributions.flat_map do |response|
    response.distribution_list.items.flat_map do |distribution|
      {
        id: distribution.id,
        hostname: distribution.domain_name,
        ip_addresses: ::AwsPublicIps::Utils.resolve_hostname(distribution.domain_name)
      }
    end
  end
end