Module: Fog::CDN::AWS::DistributionsHelper
- Included in:
- Distributions, StreamingDistributions
- Defined in:
- lib/fog/aws/models/cdn/distributions_helper.rb
Instance Method Summary collapse
Instance Method Details
#all(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/aws/models/cdn/distributions_helper.rb', line 9 def all( = {}) merge_attributes() data = list_distributions().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 |
#each_distribution ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/aws/models/cdn/distributions_helper.rb', line 28 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 |
#get(dist_id) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/fog/aws/models/cdn/distributions_helper.rb', line 20 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 |