Class: CfFactory::CfCloudfrontDistribution
- Inherits:
-
Object
- Object
- CfFactory::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, #get_update_policy, #hash_to_string, #retrieve_attribute, #set_meta_data, #set_quotes
Constructor Details
Returns a new instance of CfCloudfrontDistribution.
7
8
9
10
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 7
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
32
33
34
35
36
37
38
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 32
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
24
25
26
27
28
29
30
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 24
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
40
41
42
43
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 40
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
45
46
47
48
49
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 45
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
16
17
18
19
20
21
22
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 16
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
55
56
57
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 55
def get_cf_attributes
result = super
end
|
#get_cf_properties ⇒ Object
59
60
61
62
63
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 59
def get_cf_properties
result = {}
result["DistributionConfig"] = @distribution.generate
result
end
|
#get_cf_type ⇒ Object
51
52
53
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 51
def get_cf_type
"AWS::CloudFront::Distribution"
end
|
12
13
14
|
# File 'lib/cf_factory/cloudfront/cf_cloudfront_distribution.rb', line 12
def set_tags(tag_list)
@tag_list = tag_list
end
|