Class: Fog::AWS::CDN::Distribution

Inherits:
Model
  • Object
show all
Includes:
DistributionHelper
Defined in:
lib/fog/aws/models/cdn/distribution.rb

Constant Summary collapse

CONFIG =

items part of DistributionConfig

[ :caller_reference, :origin,  :cname, :comment, :enabled, :logging, :trusted_signers, :default_root_object ]

Instance Method Summary collapse

Methods included from DistributionHelper

#custom_origin?, #destroy, #disable, #disabled?, #enable, #enabled?, #ready?

Constructor Details

#initialize(new_attributes = {}) ⇒ Distribution

Returns a new instance of Distribution.



30
31
32
# File 'lib/fog/aws/models/cdn/distribution.rb', line 30

def initialize(new_attributes = {})
  super(distribution_config_to_attributes(new_attributes))
end

Instance Method Details

#invalidationsObject



34
35
36
37
38
39
40
41
# File 'lib/fog/aws/models/cdn/distribution.rb', line 34

def invalidations
  @invalidations ||= begin
    Fog::AWS::CDN::Invalidations.new(
      :distribution => self,
      :service => service
    )
  end
end

#saveObject



43
44
45
46
47
48
49
50
# File 'lib/fog/aws/models/cdn/distribution.rb', line 43

def save
  requires_one :s3_origin, :custom_origin
  options = attributes_to_options
  response = identity ? put_distribution_config(identity, etag, options) : post_distribution(options)
  etag = response.headers['ETag']
  merge_attributes(response.body)
  true
end