Class: Fog::CDN::AWS::Invalidation
- Defined in:
- lib/fog/aws/models/cdn/invalidation.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
- #distribution ⇒ Object
-
#initialize(new_attributes = {}) ⇒ Invalidation
constructor
A new instance of Invalidation.
- #ready? ⇒ Boolean
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(new_attributes = {}) ⇒ Invalidation
Returns a new instance of Invalidation.
16 17 18 19 |
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 16 def initialize(new_attributes={}) new_attributes[:caller_reference] ||= Time.now.utc.to_i.to_s super(invalidation_to_attributes(new_attributes)) end |
Instance Method Details
#destroy ⇒ Object
38 39 40 41 |
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 38 def destroy # invalidations can't be removed, but tests are requiring they do :) true end |
#distribution ⇒ Object
21 22 23 |
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 21 def distribution @distribution end |
#ready? ⇒ Boolean
25 26 27 28 |
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 25 def ready? requires :id, :status status == 'Completed' end |
#save ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/fog/aws/models/cdn/invalidation.rb', line 30 def save requires :paths, :caller_reference raise "Submitted invalidation cannot be submitted again" if persisted? response = service.post_invalidation(distribution.identity, paths, caller_reference) merge_attributes(invalidation_to_attributes(response.body)) true end |