Module: Fog::CDN::AWS::DistributionHelper

Included in:
Distribution, StreamingDistribution
Defined in:
lib/fog/aws/models/cdn/distribution_helper.rb

Instance Method Summary collapse

Instance Method Details

#custom_origin?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/fog/aws/models/cdn/distribution_helper.rb', line 24

def custom_origin?
  requires :identity
  not custom_origin.nil?
end

#destroyObject



7
8
9
10
11
12
# File 'lib/fog/aws/models/cdn/distribution_helper.rb', line 7

def destroy
  requires :identity, :etag, :caller_reference
  raise "Distribution must be disabled to be deleted" unless disabled?
  delete_distribution(identity, etag)
  true
end

#disableObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fog/aws/models/cdn/distribution_helper.rb', line 46

def disable
  requires :identity
  reload if etag.nil? or caller_reference.nil?
  if enabled?
    self.enabled = false
    response = put_distribution_config(identity, etag, attributes_to_options)
    etag = response.headers['ETag']
    merge_attributes(response.body)
  end
  true
end

#disabled?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/fog/aws/models/cdn/distribution_helper.rb', line 19

def disabled?
  requires :identity
  not enabled? and ready?
end

#enableObject



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

def enable
  requires :identity
  reload if etag.nil? or caller_reference.nil?
  unless enabled?
    self.enabled = true
    response = put_distribution_config(identity, etag, attributes_to_options)
    etag = response.headers['ETag']
    merge_attributes(response.body)
  end
  true
end

#enabled?Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/fog/aws/models/cdn/distribution_helper.rb', line 14

def enabled?
  requires :identity
  !!enabled and ready?
end

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  requires :identity
  status == 'Deployed'
end