module CloudFormationTool::CloudFormation::CloudFrontDistribution

Public Instance Methods

distribution() click to toggle source
# File lib/cloud_formation_tool/cloud_formation/cloud_front_distribution.rb, line 7
def distribution
  @__dist ||= awscdn.get_distribution(id: self.physical_resource_id).distribution
end
domain_names() click to toggle source
# File lib/cloud_formation_tool/cloud_formation/cloud_front_distribution.rb, line 11
def domain_names
  distribution.distribution_config.aliases.items.join(",")
end
invalidate(path_expression) click to toggle source
# File lib/cloud_formation_tool/cloud_formation/cloud_front_distribution.rb, line 15
def invalidate(path_expression)
  callerref = Time.now.strftime("%Y%m%d%H%M%S")
  awscdn.create_invalidation(
    distribution_id: self.physical_resource_id,
    invalidation_batch: {
      paths: { quantity: 1, items: [ path_expression ] },
      caller_reference: callerref
    }
  ).invalidation.tap do |i|
    i.extend(CloudFrontInvalidation)
    i.distribution_id = self.physical_resource_id
  end
end