aws 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +9 -75
- data/lib/acf/acf_interface.rb +6 -4
- data/lib/aws.rb +2 -1
- data/lib/awsbase/awsbase.rb +98 -65
- data/lib/awsbase/errors.rb +9 -5
- data/lib/awsbase/parsers.rb +226 -226
- data/lib/awsbase/utils.rb +255 -207
- data/lib/ec2/ec2.rb +243 -105
- data/lib/ec2/mon_interface.rb +2 -1
- data/lib/iam/iam.rb +31 -25
- data/lib/right_aws.rb +1 -1
- data/lib/s3/bucket.rb +7 -8
- data/lib/s3/grantee.rb +238 -238
- data/lib/s3/key.rb +281 -281
- data/lib/s3/s3.rb +2 -1
- data/lib/s3/s3_interface.rb +45 -35
- data/lib/sdb/active_sdb.rb +19 -22
- data/lib/sdb/sdb_interface.rb +4 -5
- data/lib/ses/ses.rb +123 -0
- data/lib/sqs/sqs.rb +5 -0
- data/lib/sqs/sqs_interface.rb +3 -3
- metadata +53 -104
- data/lib/awsbase/support.rb +0 -142
- data/test/acf/test_acf.rb +0 -148
- data/test/acf/test_helper.rb +0 -2
- data/test/ec2/test_ec2.rb +0 -205
- data/test/ec2/test_helper.rb +0 -2
- data/test/ec2/test_mon.rb +0 -17
- data/test/elb/test_elb.rb +0 -51
- data/test/http_connection.rb +0 -87
- data/test/iam/test_iam.rb +0 -36
- data/test/rds/test_rds.rb +0 -181
- data/test/s3/s3_test_base.rb +0 -23
- data/test/s3/test_helper.rb +0 -3
- data/test/s3/test_s3.rb +0 -162
- data/test/s3/test_s3_class.rb +0 -179
- data/test/s3/test_s3_rights.rb +0 -139
- data/test/s3/test_s3_stubbed.rb +0 -97
- data/test/sdb/test_active_sdb.rb +0 -338
- data/test/sdb/test_helper.rb +0 -3
- data/test/sdb/test_sdb.rb +0 -220
- data/test/sqs/test_helper.rb +0 -2
- data/test/sqs/test_sqs.rb +0 -232
- data/test/test_credentials.rb +0 -54
- data/test/ts_right_aws.rb +0 -13
data/lib/sqs/sqs.rb
CHANGED
@@ -70,6 +70,11 @@ module Aws
|
|
70
70
|
@interface = SqsInterface.new(aws_access_key_id, aws_secret_access_key, params)
|
71
71
|
end
|
72
72
|
|
73
|
+
def close_connection
|
74
|
+
@interface.close_connection
|
75
|
+
end
|
76
|
+
|
77
|
+
|
73
78
|
# Retrieves a list of queues.
|
74
79
|
# Returns an +array+ of +Queue+ instances.
|
75
80
|
#
|
data/lib/sqs/sqs_interface.rb
CHANGED
@@ -118,7 +118,7 @@ module Aws
|
|
118
118
|
"Version" => API_VERSION}
|
119
119
|
service_hash.update(param)
|
120
120
|
service_params = signed_service_params(@aws_secret_access_key, service_hash, :get, @params[:server], service)
|
121
|
-
request = Net::HTTP::Get.new("#{
|
121
|
+
request = Net::HTTP::Get.new("#{Utils.URLencode(service)}?#{service_params}")
|
122
122
|
# prepare output hash
|
123
123
|
{:request => request,
|
124
124
|
:server => @params[:server],
|
@@ -138,7 +138,7 @@ module Aws
|
|
138
138
|
service_hash.update(param)
|
139
139
|
#
|
140
140
|
service_params = signed_service_params(@aws_secret_access_key, service_hash, :post, @params[:server], service)
|
141
|
-
request = Net::HTTP::Post.new(
|
141
|
+
request = Net::HTTP::Post.new(Utils::URLencode(service))
|
142
142
|
request['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'
|
143
143
|
request.body = service_params
|
144
144
|
# prepare output hash
|
@@ -384,7 +384,7 @@ module Aws
|
|
384
384
|
#
|
385
385
|
def pop_message(queue_url)
|
386
386
|
messages = pop_messages(queue_url)
|
387
|
-
messages.
|
387
|
+
messages.nil? ? nil : messages[0]
|
388
388
|
rescue
|
389
389
|
on_exception
|
390
390
|
end
|
metadata
CHANGED
@@ -1,71 +1,61 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.5
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 2.5.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Travis Reeder
|
9
9
|
- Chad Arimura
|
10
10
|
- RightScale
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
|
15
|
+
date: 2011-05-08 00:00:00 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
18
|
name: uuidtools
|
19
|
-
requirement: &27101172 !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
|
-
requirements:
|
22
|
-
- - ! '>='
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '0'
|
25
|
-
type: :runtime
|
26
19
|
prerelease: false
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: http_connection
|
30
|
-
requirement: &27100884 !ruby/object:Gem::Requirement
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
31
21
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "0"
|
36
26
|
type: :runtime
|
27
|
+
version_requirements: *id001
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: http_connection
|
37
30
|
prerelease: false
|
38
|
-
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: xml-simple
|
41
|
-
requirement: &27100596 !ruby/object:Gem::Requirement
|
31
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
32
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: "0"
|
47
37
|
type: :runtime
|
38
|
+
version_requirements: *id002
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: xml-simple
|
48
41
|
prerelease: false
|
49
|
-
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: activesupport
|
52
|
-
requirement: &27100308 !ruby/object:Gem::Requirement
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
43
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
58
48
|
type: :runtime
|
59
|
-
|
60
|
-
|
61
|
-
description: AWS Ruby Library for interfacing with Amazon Web Services including EC2,
|
62
|
-
S3, SQS, SimpleDB and most of their other services as well. By http://www.appoxy.com
|
49
|
+
version_requirements: *id003
|
50
|
+
description: AWS Ruby Library for interfacing with Amazon Web Services including EC2, S3, SQS, SimpleDB and most of their other services as well. By http://www.appoxy.com
|
63
51
|
email: travis@appoxy.com
|
64
52
|
executables: []
|
53
|
+
|
65
54
|
extensions: []
|
66
|
-
|
55
|
+
|
56
|
+
extra_rdoc_files:
|
67
57
|
- README.markdown
|
68
|
-
files:
|
58
|
+
files:
|
69
59
|
- lib/acf/acf_interface.rb
|
70
60
|
- lib/aws.rb
|
71
61
|
- lib/awsbase/aws_response_array.rb
|
@@ -74,7 +64,6 @@ files:
|
|
74
64
|
- lib/awsbase/errors.rb
|
75
65
|
- lib/awsbase/parsers.rb
|
76
66
|
- lib/awsbase/require_relative.rb
|
77
|
-
- lib/awsbase/support.rb
|
78
67
|
- lib/awsbase/utils.rb
|
79
68
|
- lib/ec2/ec2.rb
|
80
69
|
- lib/ec2/mon_interface.rb
|
@@ -89,76 +78,36 @@ files:
|
|
89
78
|
- lib/s3/s3_interface.rb
|
90
79
|
- lib/sdb/active_sdb.rb
|
91
80
|
- lib/sdb/sdb_interface.rb
|
81
|
+
- lib/ses/ses.rb
|
92
82
|
- lib/sqs/sqs.rb
|
93
83
|
- lib/sqs/sqs_interface.rb
|
94
84
|
- README.markdown
|
95
|
-
- test/acf/test_acf.rb
|
96
|
-
- test/acf/test_helper.rb
|
97
|
-
- test/ec2/test_ec2.rb
|
98
|
-
- test/ec2/test_helper.rb
|
99
|
-
- test/ec2/test_mon.rb
|
100
|
-
- test/elb/test_elb.rb
|
101
|
-
- test/http_connection.rb
|
102
|
-
- test/iam/test_iam.rb
|
103
|
-
- test/rds/test_rds.rb
|
104
|
-
- test/s3/s3_test_base.rb
|
105
|
-
- test/s3/test_helper.rb
|
106
|
-
- test/s3/test_s3.rb
|
107
|
-
- test/s3/test_s3_class.rb
|
108
|
-
- test/s3/test_s3_rights.rb
|
109
|
-
- test/s3/test_s3_stubbed.rb
|
110
|
-
- test/sdb/test_active_sdb.rb
|
111
|
-
- test/sdb/test_helper.rb
|
112
|
-
- test/sdb/test_sdb.rb
|
113
|
-
- test/sqs/test_helper.rb
|
114
|
-
- test/sqs/test_sqs.rb
|
115
|
-
- test/test_credentials.rb
|
116
|
-
- test/ts_right_aws.rb
|
117
|
-
has_rdoc: true
|
118
85
|
homepage: http://github.com/appoxy/aws/
|
119
86
|
licenses: []
|
87
|
+
|
120
88
|
post_install_message:
|
121
89
|
rdoc_options: []
|
122
|
-
|
90
|
+
|
91
|
+
require_paths:
|
123
92
|
- lib
|
124
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
94
|
none: false
|
126
|
-
requirements:
|
127
|
-
- -
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version:
|
130
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: "0"
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
100
|
none: false
|
132
|
-
requirements:
|
133
|
-
- -
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version:
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: "0"
|
136
105
|
requirements: []
|
106
|
+
|
137
107
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.7.2
|
139
109
|
signing_key:
|
140
110
|
specification_version: 3
|
141
111
|
summary: AWS Ruby Library for interfacing with Amazon Web Services. By http://www.appoxy.com
|
142
|
-
test_files:
|
143
|
-
|
144
|
-
- test/acf/test_helper.rb
|
145
|
-
- test/ec2/test_ec2.rb
|
146
|
-
- test/ec2/test_helper.rb
|
147
|
-
- test/ec2/test_mon.rb
|
148
|
-
- test/elb/test_elb.rb
|
149
|
-
- test/http_connection.rb
|
150
|
-
- test/iam/test_iam.rb
|
151
|
-
- test/rds/test_rds.rb
|
152
|
-
- test/s3/s3_test_base.rb
|
153
|
-
- test/s3/test_helper.rb
|
154
|
-
- test/s3/test_s3.rb
|
155
|
-
- test/s3/test_s3_class.rb
|
156
|
-
- test/s3/test_s3_rights.rb
|
157
|
-
- test/s3/test_s3_stubbed.rb
|
158
|
-
- test/sdb/test_active_sdb.rb
|
159
|
-
- test/sdb/test_helper.rb
|
160
|
-
- test/sdb/test_sdb.rb
|
161
|
-
- test/sqs/test_helper.rb
|
162
|
-
- test/sqs/test_sqs.rb
|
163
|
-
- test/test_credentials.rb
|
164
|
-
- test/ts_right_aws.rb
|
112
|
+
test_files: []
|
113
|
+
|
data/lib/awsbase/support.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
# If ActiveSupport is loaded, then great - use it. But we don't
|
2
|
-
# want a dependency on it, so if it's not present, define the few
|
3
|
-
# extensions that we want to use...
|
4
|
-
unless defined? ActiveSupport
|
5
|
-
# These are ActiveSupport-;like extensions to do a few handy things in the gems
|
6
|
-
# Derived from ActiveSupport, so the AS copyright notice applies:
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# Copyright (c) 2005 David Heinemeier Hansson
|
11
|
-
#
|
12
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
13
|
-
# a copy of this software and associated documentation files (the
|
14
|
-
# "Software"), to deal in the Software without restriction, including
|
15
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
16
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
17
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
18
|
-
# the following conditions:
|
19
|
-
#
|
20
|
-
# The above copyright notice and this permission notice shall be
|
21
|
-
# included in all copies or substantial portions of the Software.
|
22
|
-
#
|
23
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
25
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
26
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
27
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
28
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
29
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
30
|
-
#++
|
31
|
-
#
|
32
|
-
#
|
33
|
-
class String #:nodoc:
|
34
|
-
|
35
|
-
# Constantize tries to find a declared constant with the name specified
|
36
|
-
# in the string. It raises a NameError when the name is not in CamelCase
|
37
|
-
# or is not initialized.
|
38
|
-
#
|
39
|
-
# Examples
|
40
|
-
# "Module".constantize #=> Module
|
41
|
-
# "Class".constantize #=> Class
|
42
|
-
def constantize()
|
43
|
-
camel_cased_word = self
|
44
|
-
names = camel_cased_word.split('::')
|
45
|
-
names.shift if names.empty? || names.first.empty?
|
46
|
-
|
47
|
-
constant = Object
|
48
|
-
names.each do |name|
|
49
|
-
# constant = constant.const_get(name, false) || constant.const_missing(name)
|
50
|
-
if Module.method(:const_get).arity == 1
|
51
|
-
# ruby 1.8
|
52
|
-
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
53
|
-
else
|
54
|
-
# ruby 1.9
|
55
|
-
constant = constant.const_get(name, false) || constant.const_missing(name)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
constant
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
class Object #:nodoc:
|
65
|
-
# "", " ", nil, [], and {} are blank
|
66
|
-
def blank?
|
67
|
-
if respond_to?(:empty?) && respond_to?(:strip)
|
68
|
-
empty? or strip.empty?
|
69
|
-
elsif respond_to?(:empty?)
|
70
|
-
empty?
|
71
|
-
else
|
72
|
-
!self
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class NilClass #:nodoc:
|
78
|
-
def blank?
|
79
|
-
true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
class FalseClass #:nodoc:
|
84
|
-
def blank?
|
85
|
-
true
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
class TrueClass #:nodoc:
|
90
|
-
def blank?
|
91
|
-
false
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
class Array #:nodoc:
|
96
|
-
alias_method :blank?, :empty?
|
97
|
-
end
|
98
|
-
|
99
|
-
class Hash #:nodoc:
|
100
|
-
alias_method :blank?, :empty?
|
101
|
-
|
102
|
-
# Return a new hash with all keys converted to symbols.
|
103
|
-
def symbolize_keys
|
104
|
-
inject({}) do |options, (key, value)|
|
105
|
-
options[key.to_sym] = value
|
106
|
-
options
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Slice a hash to include only the given keys. This is useful for
|
111
|
-
# limiting an options hash to valid keys before passing to a method:
|
112
|
-
#
|
113
|
-
# def search(criteria = {})
|
114
|
-
# assert_valid_keys(:mass, :velocity, :time)
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# search(options.slice(:mass, :velocity, :time))
|
118
|
-
#
|
119
|
-
# If you have an array of keys you want to limit to, you should splat them:
|
120
|
-
#
|
121
|
-
# valid_keys = [:mass, :velocity, :time]
|
122
|
-
# search(options.slice(*valid_keys))
|
123
|
-
def slice(*keys)
|
124
|
-
keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
|
125
|
-
hash = self.class.new
|
126
|
-
keys.each { |k| hash[k] = self[k] if has_key?(k) }
|
127
|
-
hash
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
class String #:nodoc:
|
132
|
-
def blank?
|
133
|
-
empty? || strip.empty?
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
class Numeric #:nodoc:
|
138
|
-
def blank?
|
139
|
-
false
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
data/test/acf/test_acf.rb
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
require File.dirname(__FILE__) + '/../test_credentials.rb'
|
3
|
-
|
4
|
-
class TestAcf < Test::Unit::TestCase
|
5
|
-
|
6
|
-
RIGHT_OBJECT_TEXT = 'Right test message'
|
7
|
-
|
8
|
-
STDOUT.sync = true
|
9
|
-
|
10
|
-
def setup
|
11
|
-
TestCredentials.get_credentials
|
12
|
-
@acf= Aws::AcfInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
|
13
|
-
@s3 = Aws::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
|
14
|
-
@bucket_name = "right-acf-awesome-test-bucket-0001"
|
15
|
-
@bucket_domain = "#{@bucket_name}.s3.amazonaws.com"
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_01_list_distributions_part1
|
19
|
-
distributions = nil
|
20
|
-
assert_nothing_raised(Aws::AwsError) do
|
21
|
-
distributions = @acf.list_distributions
|
22
|
-
end
|
23
|
-
assert distributions.is_a?(Array)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_02_try_to_create_for_bad_bucket
|
27
|
-
# a bucket does not exist
|
28
|
-
assert_raise(Aws::AwsError) do
|
29
|
-
@acf.create_distribution("right-cloudfront-awesome-test-bucket-not-exist", "Mustn't to be born", true)
|
30
|
-
end
|
31
|
-
# a bucket is not a domain naming complied guy
|
32
|
-
bucket_name = 'right_cloudfront_awesome_test_bucket_BAD'
|
33
|
-
@s3.bucket(bucket_name, :create)
|
34
|
-
assert_raise(Aws::AwsError) do
|
35
|
-
@acf.create_distribution(bucket_name, "Mustn't to be born", true)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_03_create
|
40
|
-
comment = 'WooHoo!!!'
|
41
|
-
# create a test bucket
|
42
|
-
@s3.bucket(@bucket_name, :create)
|
43
|
-
# create a distribution
|
44
|
-
distribution = @acf.create_distribution(@bucket_domain, comment, true)
|
45
|
-
assert_equal comment, distribution[:comment]
|
46
|
-
assert distribution[:cnames].size == 0
|
47
|
-
assert distribution[:enabled]
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_04_list_distributions_part2
|
51
|
-
distributions = @acf.list_distributions
|
52
|
-
assert distributions.size > 0
|
53
|
-
end
|
54
|
-
|
55
|
-
def get_test_distribution
|
56
|
-
@acf.list_distributions.select{ |d| d[:origin] == @bucket_domain }.first
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_05_get_distribution
|
60
|
-
old = get_test_distribution
|
61
|
-
assert_nothing_raised do
|
62
|
-
@acf.get_distribution(old[:aws_id])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_06_get_and_set_config
|
67
|
-
config = nil
|
68
|
-
old = get_test_distribution
|
69
|
-
assert_nothing_raised do
|
70
|
-
config = @acf.get_distribution_config(old[:aws_id])
|
71
|
-
end
|
72
|
-
# change a config
|
73
|
-
config[:enabled] = false
|
74
|
-
config[:cnames] << 'x1.myawesomesite.com'
|
75
|
-
config[:cnames] << 'x2.myawesomesite.com'
|
76
|
-
# set config
|
77
|
-
set_config_result = nil
|
78
|
-
assert_nothing_raised do
|
79
|
-
set_config_result = @acf.set_distribution_config(old[:aws_id], config)
|
80
|
-
end
|
81
|
-
assert set_config_result
|
82
|
-
# reget the config and check
|
83
|
-
new_config = nil
|
84
|
-
assert_nothing_raised do
|
85
|
-
new_config = @acf.get_distribution_config(old[:aws_id])
|
86
|
-
end
|
87
|
-
assert !new_config[:enabled]
|
88
|
-
assert_equal new_config[:cnames].sort, ['x1.myawesomesite.com', 'x2.myawesomesite.com']
|
89
|
-
assert_not_equal config[:e_tag], new_config[:e_tag]
|
90
|
-
|
91
|
-
# try to update the old config again (must fail because ETAG has changed)
|
92
|
-
assert_raise(Aws::AwsError) do
|
93
|
-
@acf.set_distribution_config(old[:aws_id], config)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_07_caching
|
98
|
-
# enable caching
|
99
|
-
@acf.params[:cache] = true
|
100
|
-
# list distributions
|
101
|
-
@acf.list_distributions
|
102
|
-
# list the distributions again - cache should hit
|
103
|
-
assert_raise(Aws::AwsNoChange) do
|
104
|
-
@acf.list_distributions
|
105
|
-
end
|
106
|
-
# disable caching
|
107
|
-
@acf.params[:cache] = true
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_08_delete_distribution
|
111
|
-
# we need ETAG so use get_distribution
|
112
|
-
distribution = @acf.get_distribution(get_test_distribution[:aws_id])
|
113
|
-
# try to delete a distribution
|
114
|
-
# should fail because
|
115
|
-
if distribution[:status] == 'InProgress'
|
116
|
-
# should fail because the distribution is not deployed yet
|
117
|
-
assert_raise(Aws::AwsError) do
|
118
|
-
@acf.delete_distribution(distribution[:aws_id], distribution[:e_tag])
|
119
|
-
end
|
120
|
-
# wait for a deployed state
|
121
|
-
print "waiting up to 5 min while the distribution is being deployed: "
|
122
|
-
100.times do
|
123
|
-
print '.'
|
124
|
-
distribution = @acf.get_distribution(distribution[:aws_id])
|
125
|
-
if distribution[:status] == 'Deployed'
|
126
|
-
print ' done'
|
127
|
-
break
|
128
|
-
end
|
129
|
-
sleep 3
|
130
|
-
end
|
131
|
-
puts
|
132
|
-
end
|
133
|
-
|
134
|
-
# only disabled and deployed distribution can be deleted
|
135
|
-
assert_equal 'Deployed', distribution[:status]
|
136
|
-
assert !distribution[:enabled]
|
137
|
-
|
138
|
-
# delete the distribution
|
139
|
-
assert_nothing_raised do
|
140
|
-
@acf.delete_distribution(distribution[:aws_id], distribution[:e_tag])
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def test_09_drop_bucket
|
145
|
-
assert @s3.bucket(@bucket_name).delete
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|