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

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

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



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

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



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

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



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

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