Class: Fog::CDN::AWS::Invalidations

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/aws/models/cdn/invalidations.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/models/cdn/invalidations.rb', line 17

def all(options = {})
  requires :distribution
  options[:max_items]  ||= max_items
  options.delete_if {|key, value| value.nil?}

  data = service.get_invalidation_list(distribution.identity, options).body

  merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextMarker', 'Marker'].include?(key)})

  load(data['InvalidationSummary'])
end

#get(invalidation_id) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/aws/models/cdn/invalidations.rb', line 29

def get(invalidation_id)
  requires :distribution

  data = service.get_invalidation(distribution.identity, invalidation_id).body

  if data
    invalidation = new(data)
  else
    nil
  end
rescue Excon::Errors::NotFound
  nil
end

#new(attributes = {}) ⇒ Object



43
44
45
46
# File 'lib/fog/aws/models/cdn/invalidations.rb', line 43

def new(attributes = {})
  requires :distribution
  super({ :distribution => distribution }.merge!(attributes))
end