Module: Cumulus::CloudFront

Defined in:
lib/cloudfront/Commands.rb,
lib/cloudfront/CloudFront.rb,
lib/cloudfront/loader/Loader.rb,
lib/cloudfront/manager/Manager.rb,
lib/cloudfront/models/OriginDiff.rb,
lib/cloudfront/models/OriginConfig.rb,
lib/cloudfront/models/CustomHeaderDiff.rb,
lib/cloudfront/models/CustomOriginDiff.rb,
lib/cloudfront/models/DistributionDiff.rb,
lib/cloudfront/models/CacheBehaviorDiff.rb,
lib/cloudfront/models/CustomHeaderConfig.rb,
lib/cloudfront/models/CustomOriginConfig.rb,
lib/cloudfront/models/DistributionConfig.rb,
lib/cloudfront/models/InvalidationConfig.rb,
lib/cloudfront/models/OriginSslProtocols.rb,
lib/cloudfront/models/CacheBehaviorConfig.rb,
lib/cloudfront/models/OriginSslProtocolsDiff.rb

Defined Under Namespace

Modules: CacheBehaviorChange, CustomHeaderChange, CustomOriginChange, DistributionChange, Loader, OriginChange, OriginSslProtocolsChange Classes: CacheBehaviorConfig, CacheBehaviorDiff, Commands, CustomHeaderConfig, CustomHeaderDiff, CustomOriginConfig, CustomOriginDiff, DistributionConfig, DistributionDiff, InvalidationConfig, Manager, OriginConfig, OriginDiff, OriginSslProtocols, OriginSslProtocolsDiff

Constant Summary collapse

@@client =
Aws::CloudFront::Client.new(Configuration.instance.client)

Class Method Summary collapse

Class Method Details

.get_aws(cname) ⇒ Object

Public: Static method that will get a distribution from AWS by its cname.

cname - the cname of the distribution to get

Returns the Aws::CloudFront::Types::DistributionSummary



15
16
17
18
19
20
21
22
# File 'lib/cloudfront/CloudFront.rb', line 15

def get_aws(cname)
  if cname_distributions[cname].nil?
    puts "No CloudFront distribution named #{cname}"
    exit
  else
    cname_distributions[cname]
  end
end

.id_distributionsObject

Public: Provides a mapping of cloudfront distribution configs to their id. Lazily loads resources.

Returns the distribution configs mapped to their ids



27
28
29
# File 'lib/cloudfront/CloudFront.rb', line 27

def id_distributions
  @full_distributions ||= Hash[distributions.map { |dist| [dist.id, dist] }]
end

.load_distribution_config(distribution_id) ⇒ Object

Public: Load the full config for a distribution from AWS

Returns an Aws::CloudFront::Types::GetDistributionConfigResult



34
35
36
37
38
# File 'lib/cloudfront/CloudFront.rb', line 34

def load_distribution_config(distribution_id)
  @@client.get_distribution_config({
    id: distribution_id
  }).data
end