Module: Awspec::Helper::Finder::Cloudfront

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/cloudfront.rb

Instance Method Summary collapse

Instance Method Details

#find_cloudfront_distribution(id) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/awspec/helper/finder/cloudfront.rb', line 4

def find_cloudfront_distribution(id)
  selected = []
  res = cloudfront_client.list_distributions
  loop do
    selected += res.distribution_list.items.select do |item|
      item.id == id || item.domain_name == id
    end
    break unless res.distribution_list.is_truncated
    res = cloudfront_client.list_distributions({
                                                 marker: res.distribution_list.next_marker
                                               })
  end

  selected.single_resource(id)
end