configure-s3-website 1.7.3 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Rakefile +0 -5
- data/changelog.md +4 -0
- data/configure-s3-website.gemspec +4 -8
- data/lib/configure-s3-website.rb +1 -0
- data/lib/configure-s3-website/cloudfront_client.rb +1 -1
- data/lib/configure-s3-website/config_source/file_config_source.rb +6 -1
- data/lib/configure-s3-website/endpoint_helper.rb +26 -0
- data/lib/configure-s3-website/http_helper.rb +0 -23
- data/lib/configure-s3-website/s3_client.rb +71 -137
- data/lib/configure-s3-website/version.rb +1 -1
- data/spec/cloudfront_client_spec.rb +44 -27
- data/spec/config_source/file_config_source_spec.rb +6 -6
- data/spec/s3_client_spec.rb +116 -91
- data/spec/sample_files/_config_file_EU.yml +4 -0
- data/spec/xml_helper_spec.rb +5 -5
- metadata +15 -122
- data/features/cassettes/cucumber_tags/apply-configs-on-cf-dist.yml +0 -172
- data/features/cassettes/cucumber_tags/bucket-does-not-exist-in-tokyo.yml +0 -159
- data/features/cassettes/cucumber_tags/bucket-does-not-exist.yml +0 -159
- data/features/cassettes/cucumber_tags/bucket-exists.yml +0 -78
- data/features/cassettes/cucumber_tags/create-cf-dist.yml +0 -137
- data/features/cassettes/cucumber_tags/redirects.yml +0 -203
- data/features/config_file.feature +0 -57
- data/features/configure_bucket.feature +0 -64
- data/features/create_cloudfront_dist.feature +0 -232
- data/features/modify_cloudfront_dist.feature +0 -19
- data/features/step_definitions/steps.rb +0 -80
- data/features/support/env.rb +0 -22
- data/features/support/sample_config_files/apply_configs_on_cf_dist.yml +0 -8
- data/features/support/sample_config_files/config_with_cloudfront_distribution_id.yml +0 -4
- data/features/support/sample_config_files/create_cf_dist.yml +0 -3
- data/features/support/sample_config_files/create_cf_dist_with_custom_configs.yml +0 -7
- data/features/support/sample_config_files/endpoint_tokyo.yml +0 -4
- data/features/support/sample_config_files/redirects.yml +0 -10
- data/features/support/sample_config_files/s3_config_with_existing_bucket.yml +0 -3
- data/features/support/sample_config_files/s3_config_with_non-existing_bucket.yml +0 -3
- data/features/support/vcr.rb +0 -15
- data/spec/endpoint_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1520dfada65dc18e62434f4374df69305fc87b01
|
4
|
+
data.tar.gz: 65ca8ec93209289f9039628f3db2ae40f9306267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86f7290d8c4f61887eb05d8b0d1a623b8031ef279879d503277231beae3983ac64a9b763ecd740cb8bbd4395a6317921021b51341ab82577827794e60509f46
|
7
|
+
data.tar.gz: 5b0d6d7a2bcf29909210afbd006facb81519a770ebae665bad370528a8bde4886e5565a838401c7c0dafb2b0c912f18fc615f91d06fb5fc3bb82b0f9ea04f665
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/changelog.md
CHANGED
@@ -10,18 +10,14 @@ spec = Gem::Specification.new do |s|
|
|
10
10
|
s.bindir = 'bin'
|
11
11
|
|
12
12
|
s.add_dependency 'deep_merge', '~> 1.0.0'
|
13
|
+
s.add_dependency 'aws-sdk', '~> 2'
|
13
14
|
|
14
|
-
s.add_development_dependency 'rspec', '~>
|
15
|
-
s.add_development_dependency 'rspec-expectations', '~>
|
16
|
-
s.add_development_dependency 'cucumber', '~> 1.2.0'
|
17
|
-
s.add_development_dependency 'aruba', '~> 0.4.0'
|
15
|
+
s.add_development_dependency 'rspec', '~> 3'
|
16
|
+
s.add_development_dependency 'rspec-expectations', '~> 3'
|
18
17
|
s.add_development_dependency 'rake', '~> 0.9.0'
|
19
|
-
s.add_development_dependency 'vcr', '~> 2.3.0'
|
20
|
-
s.add_development_dependency 'webmock', '~> 1.8.0'
|
21
|
-
s.add_development_dependency 'json', '~> 1.7.7'
|
22
18
|
|
23
19
|
s.files = `git ls-files`.split("\n")
|
24
|
-
s.test_files = `git ls-files -- {
|
20
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
25
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
22
|
s.require_paths = ["lib"]
|
27
23
|
end
|
data/lib/configure-s3-website.rb
CHANGED
@@ -3,6 +3,7 @@ require 'configure-s3-website/s3_client'
|
|
3
3
|
require 'configure-s3-website/cloudfront_client'
|
4
4
|
require 'configure-s3-website/xml_helper'
|
5
5
|
require 'configure-s3-website/http_helper'
|
6
|
+
require 'configure-s3-website/endpoint_helper'
|
6
7
|
require 'configure-s3-website/runner'
|
7
8
|
require 'configure-s3-website/cli'
|
8
9
|
require 'configure-s3-website/config_source/config_source'
|
@@ -113,7 +113,7 @@ module ConfigureS3Website
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def self.distribution_config_xml(config_source, custom_cf_settings)
|
116
|
-
domain_name = "#{config_source.s3_bucket_name}.#{
|
116
|
+
domain_name = "#{config_source.s3_bucket_name}.#{EndpointHelper.s3_website_hostname(config_source.s3_endpoint)}"
|
117
117
|
%|
|
118
118
|
<DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-07-01/">
|
119
119
|
<Origins>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ConfigureS3Website
|
2
|
+
class EndpointHelper
|
3
|
+
def self.s3_website_hostname(region)
|
4
|
+
if old_regions.include?(region)
|
5
|
+
"s3-website-#{region}.amazonaws.com"
|
6
|
+
else
|
7
|
+
"s3-website.#{region}.amazonaws.com"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def self.old_regions
|
14
|
+
[
|
15
|
+
'us-east-1',
|
16
|
+
'us-west-1',
|
17
|
+
'us-west-2',
|
18
|
+
'ap-southeast-1',
|
19
|
+
'ap-southeast-2',
|
20
|
+
'ap-northeast-1',
|
21
|
+
'eu-west-1',
|
22
|
+
'sa-east-1'
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,20 +1,5 @@
|
|
1
1
|
module ConfigureS3Website
|
2
2
|
class HttpHelper
|
3
|
-
def self.call_s3_api(path, method, body, config_source)
|
4
|
-
endpoint = Endpoint.by_config_source(config_source)
|
5
|
-
date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
|
6
|
-
digest = create_s3_digest(path, method, config_source, date)
|
7
|
-
self.call_api(
|
8
|
-
path,
|
9
|
-
method,
|
10
|
-
body,
|
11
|
-
config_source,
|
12
|
-
endpoint.hostname,
|
13
|
-
digest,
|
14
|
-
date
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
3
|
def self.call_cloudfront_api(path, method, body, config_source, headers = {})
|
19
4
|
date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
|
20
5
|
digest = create_cloudfront_digest(config_source, date)
|
@@ -55,14 +40,6 @@ module ConfigureS3Website
|
|
55
40
|
end
|
56
41
|
end
|
57
42
|
|
58
|
-
def self.create_s3_digest(path, method, config_source, date)
|
59
|
-
digest = OpenSSL::Digest.new('sha1')
|
60
|
-
method_string = method.to_s.match(/Net::HTTP::(\w+)/)[1].upcase
|
61
|
-
can_string = "#{method_string}\n\n\n#{date}\n#{path}"
|
62
|
-
hmac = OpenSSL::HMAC.digest(digest, config_source.s3_secret_access_key, can_string)
|
63
|
-
signature = Base64.encode64(hmac).strip
|
64
|
-
end
|
65
|
-
|
66
43
|
def self.create_cloudfront_digest(config_source, date)
|
67
44
|
digest = Base64.encode64(
|
68
45
|
OpenSSL::HMAC.digest(
|
@@ -3,6 +3,7 @@ require 'openssl'
|
|
3
3
|
require 'digest/sha1'
|
4
4
|
require 'digest/md5'
|
5
5
|
require 'net/https'
|
6
|
+
require 'aws-sdk'
|
6
7
|
|
7
8
|
module ConfigureS3Website
|
8
9
|
class S3Client
|
@@ -11,8 +12,7 @@ module ConfigureS3Website
|
|
11
12
|
begin
|
12
13
|
enable_website_configuration(config_source)
|
13
14
|
make_bucket_readable_to_everyone(config_source)
|
14
|
-
|
15
|
-
rescue NoSuchBucketError
|
15
|
+
rescue Aws::S3::Errors::NoSuchBucket
|
16
16
|
create_bucket(config_source)
|
17
17
|
retry
|
18
18
|
end
|
@@ -20,157 +20,91 @@ module ConfigureS3Website
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
def self.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
</IndexDocument>
|
29
|
-
<ErrorDocument>
|
30
|
-
<Key>#{config_source.error_document || "error.html"}</Key>
|
31
|
-
</ErrorDocument>
|
32
|
-
</WebsiteConfiguration>
|
33
|
-
|
|
34
|
-
HttpHelper.call_s3_api(
|
35
|
-
path = "/#{config_source.s3_bucket_name}/?website",
|
36
|
-
method = Net::HTTP::Put,
|
37
|
-
body = body,
|
38
|
-
config_source = config_source
|
39
|
-
)
|
40
|
-
puts "Bucket #{config_source.s3_bucket_name} now functions as a website"
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.make_bucket_readable_to_everyone(config_source)
|
44
|
-
policy_json = %|{
|
45
|
-
"Version":"2008-10-17",
|
46
|
-
"Statement":[{
|
47
|
-
"Sid":"PublicReadForGetBucketObjects",
|
48
|
-
"Effect":"Allow",
|
49
|
-
"Principal": { "AWS": "*" },
|
50
|
-
"Action":["s3:GetObject"],
|
51
|
-
"Resource":["arn:aws:s3:::#{config_source.s3_bucket_name}/*"]
|
52
|
-
}]
|
53
|
-
}|
|
54
|
-
HttpHelper.call_s3_api(
|
55
|
-
path = "/#{config_source.s3_bucket_name}/?policy",
|
56
|
-
method = Net::HTTP::Put,
|
57
|
-
body = policy_json,
|
58
|
-
config_source = config_source
|
23
|
+
def self.s3(config_source)
|
24
|
+
s3 = Aws::S3::Client.new(
|
25
|
+
region: config_source.s3_endpoint,
|
26
|
+
access_key_id: config_source.s3_access_key_id,
|
27
|
+
secret_access_key: config_source.s3_secret_access_key
|
59
28
|
)
|
60
|
-
puts "Bucket #{config_source.s3_bucket_name} is now readable to the whole world"
|
61
29
|
end
|
62
30
|
|
63
|
-
def self.
|
64
|
-
routing_rules =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
31
|
+
def self.enable_website_configuration(config_source)
|
32
|
+
routing_rules =
|
33
|
+
if config_source.routing_rules && config_source.routing_rules.is_a?(Array)
|
34
|
+
config_source.routing_rules.map { |rule|
|
35
|
+
Hash[
|
36
|
+
rule.map { |rule_key, rule_value|
|
37
|
+
[
|
38
|
+
rule_key.to_sym,
|
39
|
+
Hash[ # Assume that each rule value is a Hash
|
40
|
+
rule_value.map { |redirect_rule_key, redirect_rule_value|
|
41
|
+
[
|
42
|
+
redirect_rule_key.to_sym,
|
43
|
+
redirect_rule_key == "http_redirect_code" ?
|
44
|
+
redirect_rule_value.to_s
|
45
|
+
#redirect_rule_value.to_s # Permit numeric redirect values in the YAML config file. (The S3 API does not allow numeric redirect values, hence this block of code.)
|
46
|
+
:
|
47
|
+
redirect_rule_value
|
48
|
+
]
|
49
|
+
}
|
50
|
+
]
|
51
|
+
]
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
else
|
56
|
+
nil
|
84
57
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
58
|
+
s3(config_source).put_bucket_website({
|
59
|
+
bucket: config_source.s3_bucket_name,
|
60
|
+
website_configuration: {
|
61
|
+
index_document: {
|
62
|
+
suffix: config_source.index_document || "index.html"
|
63
|
+
},
|
64
|
+
error_document: {
|
65
|
+
key: config_source.error_document || "error.html"
|
66
|
+
},
|
67
|
+
routing_rules: routing_rules
|
68
|
+
}
|
69
|
+
})
|
70
|
+
puts "Bucket #{config_source.s3_bucket_name} now functions as a website"
|
71
|
+
if routing_rules && routing_rules.any?
|
96
72
|
puts "#{routing_rules.size} redirects configured for #{config_source.s3_bucket_name} bucket"
|
97
73
|
else
|
98
74
|
puts "No redirects to configure for #{config_source.s3_bucket_name} bucket"
|
99
75
|
end
|
100
76
|
end
|
101
77
|
|
102
|
-
def self.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
78
|
+
def self.make_bucket_readable_to_everyone(config_source)
|
79
|
+
s3(config_source).put_bucket_policy({
|
80
|
+
bucket: config_source.s3_bucket_name,
|
81
|
+
policy: %|{
|
82
|
+
"Version":"2008-10-17",
|
83
|
+
"Statement":[{
|
84
|
+
"Sid":"PublicReadForGetBucketObjects",
|
85
|
+
"Effect":"Allow",
|
86
|
+
"Principal": { "AWS": "*" },
|
87
|
+
"Action":["s3:GetObject"],
|
88
|
+
"Resource":["arn:aws:s3:::#{config_source.s3_bucket_name}/*"]
|
89
|
+
}]
|
90
|
+
}|
|
91
|
+
})
|
92
|
+
puts "Bucket #{config_source.s3_bucket_name} is now readable to the whole world"
|
93
|
+
end
|
113
94
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
95
|
+
def self.create_bucket(config_source)
|
96
|
+
s3(config_source).create_bucket({
|
97
|
+
bucket: config_source.s3_bucket_name,
|
98
|
+
create_bucket_configuration: {
|
99
|
+
location_constraint: config_source.s3_endpoint
|
100
|
+
}
|
101
|
+
})
|
120
102
|
puts "Created bucket %s in the %s Region" %
|
121
103
|
[
|
122
104
|
config_source.s3_bucket_name,
|
123
|
-
|
105
|
+
config_source.s3_endpoint
|
124
106
|
]
|
125
107
|
end
|
126
108
|
end
|
127
109
|
end
|
128
110
|
|
129
|
-
private
|
130
|
-
|
131
|
-
module ConfigureS3Website
|
132
|
-
class Endpoint
|
133
|
-
attr_reader :region, :location_constraint, :hostname, :website_hostname
|
134
|
-
|
135
|
-
def initialize(location_constraint)
|
136
|
-
raise InvalidS3LocationConstraintError unless
|
137
|
-
location_constraints.has_key?location_constraint
|
138
|
-
@region = location_constraints.fetch(location_constraint)[:region]
|
139
|
-
@hostname = location_constraints.fetch(location_constraint)[:endpoint]
|
140
|
-
@website_hostname = location_constraints.fetch(location_constraint)[:website_endpoint]
|
141
|
-
@location_constraint = location_constraint
|
142
|
-
end
|
143
|
-
|
144
|
-
# http://docs.amazonwebservices.com/general/latest/gr/rande.html#s3_region
|
145
|
-
def location_constraints
|
146
|
-
eu_west_1_region = {
|
147
|
-
:region => 'EU (Ireland)',
|
148
|
-
:website_endpoint => 's3-website-eu-west-1.amazonaws.com',
|
149
|
-
:endpoint => 's3-eu-west-1.amazonaws.com'
|
150
|
-
}
|
151
|
-
|
152
|
-
{
|
153
|
-
'' => { :region => 'US Standard', :endpoint => 's3.amazonaws.com', :website_endpoint => 's3-website-us-east-1.amazonaws.com' },
|
154
|
-
'us-west-2' => { :region => 'US West (Oregon)', :endpoint => 's3-us-west-2.amazonaws.com', :website_endpoint => 's3-website-us-west-2.amazonaws.com' },
|
155
|
-
'us-west-1' => { :region => 'US West (Northern California)', :endpoint => 's3-us-west-1.amazonaws.com', :website_endpoint => 's3-website-us-west-1.amazonaws.com' },
|
156
|
-
'EU' => eu_west_1_region,
|
157
|
-
'eu-west-1' => eu_west_1_region,
|
158
|
-
'eu-central-1' => { :region => 'EU (Frankfurt)', :endpoint => 's3.eu-central-1.amazonaws.com', :website_endpoint => 's3-website.eu-central-1.amazonaws.com' },
|
159
|
-
'ap-southeast-1' => { :region => 'Asia Pacific (Singapore)', :endpoint => 's3-ap-southeast-1.amazonaws.com', :website_endpoint => 's3-website-ap-southeast-1.amazonaws.com' },
|
160
|
-
'ap-southeast-2' => { :region => 'Asia Pacific (Sydney)', :endpoint => 's3-ap-southeast-2.amazonaws.com', :website_endpoint => 's3-website-ap-southeast-2.amazonaws.com' },
|
161
|
-
'ap-northeast-1' => { :region => 'Asia Pacific (Tokyo)', :endpoint => 's3-ap-northeast-1.amazonaws.com', :website_endpoint => 's3-website-ap-northeast-1.amazonaws.com' },
|
162
|
-
'sa-east-1' => { :region => 'South America (Sao Paulo)', :endpoint => 's3-sa-east-1.amazonaws.com', :website_endpoint => 's3-website-sa-east-1.amazonaws.com' }
|
163
|
-
}
|
164
|
-
end
|
165
|
-
|
166
|
-
def self.by_config_source(config_source)
|
167
|
-
endpoint = Endpoint.new(config_source.s3_endpoint || '')
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
class InvalidS3LocationConstraintError < StandardError
|
173
|
-
end
|
174
|
-
|
175
|
-
class NoSuchBucketError < StandardError
|
176
|
-
end
|
@@ -8,8 +8,8 @@ describe ConfigureS3Website::CloudFrontClient do
|
|
8
8
|
describe 'letting the user to override the default values' do
|
9
9
|
let(:config_source) {
|
10
10
|
mock = double('config_source')
|
11
|
-
mock.
|
12
|
-
mock.
|
11
|
+
allow(mock).to receive(:s3_bucket_name).and_return('test-bucket')
|
12
|
+
allow(mock).to receive(:s3_endpoint).and_return(nil)
|
13
13
|
mock
|
14
14
|
}
|
15
15
|
|
@@ -28,44 +28,61 @@ describe ConfigureS3Website::CloudFrontClient do
|
|
28
28
|
}
|
29
29
|
|
30
30
|
it 'allows the user to override default CloudFront settings' do
|
31
|
-
REXML::XPath.first(
|
31
|
+
expect(REXML::XPath.first(
|
32
32
|
distribution_config_xml,
|
33
33
|
'/DistributionConfig/DefaultCacheBehavior/MinTTL'
|
34
|
-
).get_text.to_s.
|
34
|
+
).get_text.to_s).to eq('987')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'retains the default values that are not overriden' do
|
38
|
-
REXML::XPath.first(
|
38
|
+
expect(REXML::XPath.first(
|
39
39
|
distribution_config_xml,
|
40
40
|
'/DistributionConfig/DefaultCacheBehavior/ViewerProtocolPolicy'
|
41
|
-
).get_text.to_s.
|
41
|
+
).get_text.to_s).to eq('allow-all')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
}
|
45
|
+
[
|
46
|
+
{ :region => 'us-east-1', :website_endpoint => 's3-website-us-east-1.amazonaws.com' },
|
47
|
+
{ :region => 'us-west-1', :website_endpoint => 's3-website-us-west-1.amazonaws.com' },
|
48
|
+
{ :region => 'us-west-2', :website_endpoint => 's3-website-us-west-2.amazonaws.com' },
|
49
|
+
{ :region => 'ap-south-1', :website_endpoint => 's3-website.ap-south-1.amazonaws.com' },
|
50
|
+
{ :region => 'ap-northeast-2', :website_endpoint => 's3-website.ap-northeast-2.amazonaws.com' },
|
51
|
+
{ :region => 'ap-southeast-1', :website_endpoint => 's3-website-ap-southeast-1.amazonaws.com' },
|
52
|
+
{ :region => 'ap-southeast-2', :website_endpoint => 's3-website-ap-southeast-2.amazonaws.com' },
|
53
|
+
{ :region => 'ap-northeast-1', :website_endpoint => 's3-website-ap-northeast-1.amazonaws.com' },
|
54
|
+
{ :region => 'eu-central-1', :website_endpoint => 's3-website.eu-central-1.amazonaws.com' },
|
55
|
+
{ :region => 'eu-west-1', :website_endpoint => 's3-website-eu-west-1.amazonaws.com' },
|
56
|
+
{ :region => 'sa-east-1', :website_endpoint => 's3-website-sa-east-1.amazonaws.com' },
|
57
|
+
].each { |conf|
|
58
|
+
region = conf[:region]
|
59
|
+
website_endpoint = conf[:website_endpoint]
|
60
|
+
describe "inferring //Origins/Items/Origin/DomainName (#{region})" do
|
61
|
+
let(:config_source) {
|
62
|
+
mock = double('config_source')
|
63
|
+
allow(mock).to receive(:s3_bucket_name).and_return('test-bucket')
|
64
|
+
allow(mock).to receive(:s3_endpoint).and_return(region)
|
65
|
+
mock
|
66
|
+
}
|
52
67
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
68
|
+
let(:distribution_config_xml) {
|
69
|
+
REXML::Document.new(
|
70
|
+
ConfigureS3Website::CloudFrontClient.send(
|
71
|
+
:distribution_config_xml,
|
72
|
+
config_source,
|
73
|
+
custom_distribution_config = {}
|
74
|
+
)
|
59
75
|
)
|
60
|
-
|
61
|
-
}
|
76
|
+
}
|
62
77
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
78
|
+
it "honors the endpoint of the S3 website (#{region})" do
|
79
|
+
expect(REXML::XPath.first(
|
80
|
+
distribution_config_xml,
|
81
|
+
'/DistributionConfig/Origins/Items/Origin/DomainName'
|
82
|
+
).get_text.to_s).to eq("test-bucket.#{website_endpoint}")
|
83
|
+
end
|
68
84
|
end
|
69
|
-
|
85
|
+
}
|
86
|
+
|
70
87
|
end
|
71
88
|
end
|