class Awspec::Type::CloudfrontDistribution

Constants

STATUSES

Public Instance Methods

has_custom_response_error_code?(error_code, response_page_path: nil, response_code: nil, error_caching_min_ttl: nil) click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 50
def has_custom_response_error_code?(error_code,
                                    response_page_path: nil,
                                    response_code: nil,
                                    error_caching_min_ttl: nil)
  return false unless [error_code, domain_name].any?

  resource_via_client.custom_error_responses.items.find do |error|
    next false if !error_code.nil? && error.error_code != error_code
    next false if !response_page_path.nil? && error.response_page_path != response_page_path
    next false if !response_code.nil? && error.response_code != response_code.to_s
    next false if !error_caching_min_ttl.nil? && error.error_caching_min_ttl != error_caching_min_ttl

    true
  end
end
has_origin?(origin_id, domain_name: nil, origin_path: nil, origin_access_identity: nil) click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 23
def has_origin?(origin_id,
                domain_name: nil,
                origin_path: nil,
                origin_access_identity: nil)
  return false unless [origin_id, domain_name].any?

  resource_via_client.origins.items.find do |origin|
    next false if !origin_id.nil? && origin.id != origin_id
    next false if !domain_name.nil? && origin.domain_name != domain_name
    next false if !origin_path.nil? && origin.origin_path != origin_path
    next false if !origin_access_identity.nil? && \
                  origin.s3_origin_config.origin_access_identity != origin_access_identity

    true
  end
end
has_origin_domain_name?(domain_name) click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 40
def has_origin_domain_name?(domain_name)
  has_origin?(nil, domain_name: domain_name)
end
has_origin_domain_name_and_path?(domain_name_and_path) click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 44
def has_origin_domain_name_and_path?(domain_name_and_path)
  domain_name = domain_name_and_path.gsub(%r{/.*\z}, '')
  origin_path = domain_name_and_path.gsub(%r{\A[^/]*}, '')
  has_origin?(nil, domain_name: domain_name, origin_path: origin_path)
end
id() click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 9
def id
  @id ||= resource_via_client.id if resource_via_client
end
resource_via_client() click to toggle source
# File lib/awspec/type/cloudfront_distribution.rb, line 5
def resource_via_client
  @resource_via_client ||= find_cloudfront_distribution(@display_name)
end