Class: CfCloudfrontDistribution
- Inherits:
-
Object
- Object
- CfCloudfrontDistribution
show all
- Includes:
- CfBase
- Defined in:
- lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb
Class Method Summary
collapse
-
.create_domain_distribution(name, origin_domain, origin_id, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
-
.create_elb_distribution(name, elb, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
-
.create_multi_origin_distribution(name, origins, default_cache_behavior, cache_behaviors, distribution_options = {}) ⇒ Object
-
.create_multi_origin_distribution_old(name, origins, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
-
.create_s3_distribution(name, s3_bucket, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
Instance Method Summary
collapse
Methods included from CfBase
#generate, #generate_ref, #get_deletion_policy, #get_name, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes
Constructor Details
Returns a new instance of CfCloudfrontDistribution.
6
7
8
9
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 6
def initialize(name, distribution_details)
@name = name
@distribution = distribution_details
end
|
Class Method Details
.create_domain_distribution(name, origin_domain, origin_id, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 31
def self.create_domain_distribution(name, origin_domain, origin_id, origin_options = {}, cache_behaviour_options = {}, distribution_options = {})
custom_origin = CfCustomOriginConfig.new("http-only")
origin_config = CfOrigin.new(origin_domain,origin_id,custom_origin,origin_options)
default_cache_behavior = CfDefaultCacheBehavior.new(origin_config.id,CfForwardedValues.new(true),"allow-all", cache_behaviour_options)
distribution_details = CfDistributionConfig.new([origin_config],default_cache_behavior, true, distribution_options)
CfCloudfrontDistribution.new(name, distribution_details)
end
|
.create_elb_distribution(name, elb, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 23
def self.create_elb_distribution(name, elb, origin_options = {}, cache_behaviour_options = {}, distribution_options = {})
custom_origin = CfCustomOriginConfig.new("http-only")
origin_config = CfOrigin.new(elb.retrieve_attribute("DNSName"),elb.generate_ref,custom_origin,origin_options)
default_cache_behavior = CfDefaultCacheBehavior.new(origin_config.id,CfForwardedValues.new(true),"allow-all", cache_behaviour_options)
distribution_details = CfDistributionConfig.new([origin_config],default_cache_behavior, true, distribution_options)
CfCloudfrontDistribution.new(name, distribution_details)
end
|
.create_multi_origin_distribution(name, origins, default_cache_behavior, cache_behaviors, distribution_options = {}) ⇒ Object
39
40
41
42
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 39
def self.create_multi_origin_distribution(name, origins, default_cache_behavior, cache_behaviors, distribution_options = {})
distribution_details = CfDistributionConfig.new(origins,default_cache_behavior, true, distribution_options.merge({:cache_behaviors => cache_behaviors}))
CfCloudfrontDistribution.new(name, distribution_details)
end
|
.create_multi_origin_distribution_old(name, origins, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
44
45
46
47
48
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 44
def self.create_multi_origin_distribution_old(name, origins, cache_behaviour_options = {}, distribution_options = {})
default_cache_behavior = CfDefaultCacheBehavior.new("XXX was origin_config.id",CfForwardedValues.new(true),"allow-all", cache_behaviour_options)
distribution_details = CfDistributionConfig.new(origins,default_cache_behavior, true, distribution_options)
CfCloudfrontDistribution.new(name, distribution_details)
end
|
.create_s3_distribution(name, s3_bucket, origin_options = {}, cache_behaviour_options = {}, distribution_options = {}) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 15
def self.create_s3_distribution(name, s3_bucket, origin_options = {}, cache_behaviour_options = {}, distribution_options = {})
s3_origin = CfS3OriginConfig.new
origin_config = CfOrigin.new(s3_bucket.short_domain_name(),s3_bucket.generate_ref,s3_origin, origin_options)
default_cache_behavior = CfDefaultCacheBehavior.new(origin_config.id,CfForwardedValues.new(true),"allow-all", cache_behaviour_options)
distribution_details = CfDistributionConfig.new([origin_config],default_cache_behavior, true, distribution_options)
CfCloudfrontDistribution.new(name, distribution_details)
end
|
Instance Method Details
#get_cf_attributes ⇒ Object
54
55
56
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 54
def get_cf_attributes
result = super
end
|
#get_cf_properties ⇒ Object
58
59
60
61
62
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 58
def get_cf_properties
result = {}
result["DistributionConfig"] = @distribution.generate
result
end
|
#get_cf_type ⇒ Object
50
51
52
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 50
def get_cf_type
"AWS::CloudFront::Distribution"
end
|
11
12
13
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 11
def set_tags(tag_list)
@tag_list = tag_list
end
|