Sha256: 10cf9864ff86b2a674e07dcd697a05b97eab2778630d48c28aed6141ca80ecb9

Contents?: true

Size: 1.24 KB

Versions: 36

Compression:

Stored size: 1.24 KB

Contents

module Fog
  module AWS
    class CDN
      module DistributionsHelper

        def all(options = {})
          merge_attributes(options)
          data = list_distributions(options).body
          merge_attributes('IsTruncated' => data['IsTruncated'], 'Marker' => data['Marker'], 'MaxItems' => data['MaxItems'])
          if summary = data['DistributionSummary']
            load(summary.map { |a| { 'DistributionConfig' => a } })
          else
            load((data['StreamingDistributionSummary'] || {}).map { |a| { 'StreamingDistributionConfig' => a }})
          end
        end

        def get(dist_id)
          response = get_distribution(dist_id)
          data = response.body.merge({'ETag' => response.headers['ETag']})
          new(data)
        rescue Excon::Errors::NotFound
          nil
        end

        def each_distribution
          if !block_given?
            self
          else
            subset = dup.all

            subset.each_distribution_this_page {|f| yield f}
            while subset.is_truncated
              subset = subset.all('Marker' => subset.marker, 'MaxItems' => 1000)
              subset.each_distribution_this_page {|f| yield f}
            end

            self
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.29.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.28.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.27.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.26.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.25.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.24.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.23.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.22.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.21.1 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.21.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.20.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.19.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.18.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.17.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.16.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.15.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.14.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.13.0 lib/fog/aws/models/cdn/distributions_helper.rb
fog-aws-3.12.0 lib/fog/aws/models/cdn/distributions_helper.rb