right_aws 1.9.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +164 -13
- data/Manifest.txt +28 -1
- data/README.txt +12 -10
- data/Rakefile +56 -29
- data/lib/acf/right_acf_interface.rb +343 -172
- data/lib/acf/right_acf_invalidations.rb +144 -0
- data/lib/acf/right_acf_origin_access_identities.rb +230 -0
- data/lib/acf/right_acf_streaming_interface.rb +229 -0
- data/lib/acw/right_acw_interface.rb +248 -0
- data/lib/as/right_as_interface.rb +698 -0
- data/lib/awsbase/right_awsbase.rb +755 -115
- data/lib/awsbase/support.rb +2 -78
- data/lib/awsbase/version.rb +9 -0
- data/lib/ec2/right_ec2.rb +274 -1294
- data/lib/ec2/right_ec2_ebs.rb +514 -0
- data/lib/ec2/right_ec2_images.rb +444 -0
- data/lib/ec2/right_ec2_instances.rb +797 -0
- data/lib/ec2/right_ec2_monitoring.rb +70 -0
- data/lib/ec2/right_ec2_placement_groups.rb +108 -0
- data/lib/ec2/right_ec2_reserved_instances.rb +243 -0
- data/lib/ec2/right_ec2_security_groups.rb +496 -0
- data/lib/ec2/right_ec2_spot_instances.rb +422 -0
- data/lib/ec2/right_ec2_tags.rb +139 -0
- data/lib/ec2/right_ec2_vpc.rb +598 -0
- data/lib/ec2/right_ec2_vpc2.rb +382 -0
- data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
- data/lib/elb/right_elb_interface.rb +573 -0
- data/lib/emr/right_emr_interface.rb +728 -0
- data/lib/iam/right_iam_access_keys.rb +71 -0
- data/lib/iam/right_iam_groups.rb +195 -0
- data/lib/iam/right_iam_interface.rb +341 -0
- data/lib/iam/right_iam_mfa_devices.rb +67 -0
- data/lib/iam/right_iam_users.rb +251 -0
- data/lib/rds/right_rds_interface.rb +1657 -0
- data/lib/right_aws.rb +30 -13
- data/lib/route_53/right_route_53_interface.rb +641 -0
- data/lib/s3/right_s3.rb +108 -41
- data/lib/s3/right_s3_interface.rb +349 -118
- data/lib/sdb/active_sdb.rb +388 -54
- data/lib/sdb/right_sdb_interface.rb +323 -64
- data/lib/sns/right_sns_interface.rb +286 -0
- data/lib/sqs/right_sqs.rb +1 -2
- data/lib/sqs/right_sqs_gen2.rb +73 -17
- data/lib/sqs/right_sqs_gen2_interface.rb +146 -73
- data/lib/sqs/right_sqs_interface.rb +12 -22
- data/right_aws.gemspec +91 -0
- data/test/README.mdown +39 -0
- data/test/acf/test_right_acf.rb +11 -19
- data/test/awsbase/test_helper.rb +2 -0
- data/test/awsbase/test_right_awsbase.rb +11 -0
- data/test/ec2/test_right_ec2.rb +32 -1
- data/test/elb/test_helper.rb +2 -0
- data/test/elb/test_right_elb.rb +43 -0
- data/test/rds/test_helper.rb +2 -0
- data/test/rds/test_right_rds.rb +120 -0
- data/test/route_53/fixtures/a_record.xml +18 -0
- data/test/route_53/fixtures/alias_record.xml +18 -0
- data/test/route_53/test_helper.rb +2 -0
- data/test/route_53/test_right_route_53.rb +141 -0
- data/test/s3/test_right_s3.rb +176 -42
- data/test/s3/test_right_s3_stubbed.rb +6 -4
- data/test/sdb/test_active_sdb.rb +120 -19
- data/test/sdb/test_batch_put_attributes.rb +54 -0
- data/test/sdb/test_right_sdb.rb +71 -16
- data/test/sns/test_helper.rb +2 -0
- data/test/sns/test_right_sns.rb +153 -0
- data/test/sqs/test_right_sqs.rb +0 -6
- data/test/sqs/test_right_sqs_gen2.rb +104 -49
- data/test/ts_right_aws.rb +1 -0
- metadata +181 -22
data/right_aws.gemspec
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
#-- -*- mode: ruby; encoding: utf-8 -*-
|
2
|
+
# Copyright: Copyright (c) 2010 RightScale, Inc.
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# 'Software'), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
18
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
19
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
20
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
21
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "lib", "awsbase", "version"))
|
26
|
+
|
27
|
+
Gem::Specification.new do |spec|
|
28
|
+
spec.name = 'right_aws'
|
29
|
+
spec.rubyforge_project = 'rightaws'
|
30
|
+
spec.version = RightAws::VERSION::STRING
|
31
|
+
spec.authors = ['RightScale, Inc.']
|
32
|
+
spec.email = 'support@rightscale.com'
|
33
|
+
spec.summary = 'Interface classes for the Amazon EC2, SQS, and S3 Web Services'
|
34
|
+
spec.rdoc_options = ['--main', 'README.txt', '--title', '']
|
35
|
+
spec.extra_rdoc_files = ['README.txt']
|
36
|
+
spec.required_ruby_version = '>= 1.8.7'
|
37
|
+
spec.require_path = 'lib'
|
38
|
+
|
39
|
+
spec.add_dependency('right_http_connection', '>= 1.2.5')
|
40
|
+
#spec.requirements << "uuidtools >= 1.0.7 if you want to use ActiveSdb"
|
41
|
+
spec.requirements << "libxml-ruby >= 0.5.2.0 is encouraged"
|
42
|
+
|
43
|
+
spec.add_development_dependency('rake')
|
44
|
+
spec.add_development_dependency('rcov')
|
45
|
+
|
46
|
+
spec.summary = 'The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, SDB, and CloudFront.'
|
47
|
+
spec.description = <<-EOF
|
48
|
+
== DESCRIPTION:
|
49
|
+
|
50
|
+
The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, SDB, and CloudFront.
|
51
|
+
These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon.
|
52
|
+
The RightScale AWS gems comprise:
|
53
|
+
|
54
|
+
- RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud) and the
|
55
|
+
associated EBS (Elastic Block Store)
|
56
|
+
- RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service)
|
57
|
+
- RightAws::Sqs and RightAws::SqsInterface -- interface to first-generation Amazon SQS (Simple Queue Service) (API version 2007-05-01)
|
58
|
+
- RightAws::SqsGen2 and RightAws::SqsGen2Interface -- interface to second-generation Amazon SQS (Simple Queue Service) (API version 2008-01-01)
|
59
|
+
- RightAws::SdbInterface and RightAws::ActiveSdb -- interface to Amazon SDB (SimpleDB)
|
60
|
+
- RightAws::AcfInterface -- interface to Amazon CloudFront, a content distribution service
|
61
|
+
|
62
|
+
== FEATURES:
|
63
|
+
|
64
|
+
- Full programmmatic access to EC2, EBS, S3, SQS, SDB, and CloudFront.
|
65
|
+
- Complete error handling: all operations check for errors and report complete
|
66
|
+
error information by raising an AwsError.
|
67
|
+
- Persistent HTTP connections with robust network-level retry layer using
|
68
|
+
RightHttpConnection). This includes socket timeouts and retries.
|
69
|
+
- Robust HTTP-level retry layer. Certain (user-adjustable) HTTP errors returned
|
70
|
+
by Amazon's services are classified as temporary errors.
|
71
|
+
These errors are automaticallly retried using exponentially increasing intervals.
|
72
|
+
The number of retries is user-configurable.
|
73
|
+
- Fast REXML-based parsing of responses (as fast as a pure Ruby solution allows).
|
74
|
+
- Uses libxml (if available) for faster response parsing.
|
75
|
+
- Support for large S3 list operations. Buckets and key subfolders containing
|
76
|
+
many (> 1000) keys are listed in entirety. Operations based on list (like
|
77
|
+
bucket clear) work on arbitrary numbers of keys.
|
78
|
+
- Support for streaming GETs from S3, and streaming PUTs to S3 if the data source is a file.
|
79
|
+
- Support for single-threaded usage, multithreaded usage, as well as usage with multiple
|
80
|
+
AWS accounts.
|
81
|
+
- Support for both first- and second-generation SQS (API versions 2007-05-01
|
82
|
+
and 2008-01-01). These versions of SQS are not compatible.
|
83
|
+
- Support for signature versions 0 and 1 on SQS, SDB, and EC2.
|
84
|
+
- Interoperability with any cloud running Eucalyptus (http://eucalyptus.cs.ucsb.edu)
|
85
|
+
- Test suite (requires AWS account to do "live" testing).
|
86
|
+
EOF
|
87
|
+
|
88
|
+
candidates = Dir.glob('{lib,test}/**/*') + ['History.txt', 'Manifest.txt', 'README.txt', 'Rakefile', 'right_aws.gemspec']
|
89
|
+
spec.files = candidates.sort
|
90
|
+
spec.test_files = Dir.glob('test/**/*')
|
91
|
+
end
|
data/test/README.mdown
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Notes and tips for developers
|
2
|
+
|
3
|
+
## Setting up credentials for testing
|
4
|
+
|
5
|
+
Before you can run any tests, you need to set up credentials (API key and secret) that
|
6
|
+
will be used when talking to AWS. The credentials are loaded in `test/test_credentials.rb`
|
7
|
+
and are expected to be found in `~/.rightscale/testcredentials.rb` and look like this:
|
8
|
+
|
9
|
+
TestCredentials.aws_access_key_id= 'AAAAAAAAAAAAAAAAAAAA'
|
10
|
+
TestCredentials.aws_secret_access_key= 'asdfasdfsadf'
|
11
|
+
TestCredentials.account_number= '???'
|
12
|
+
|
13
|
+
If you prefer to store your secret key in the OS X keychain, you can do this:
|
14
|
+
|
15
|
+
def secret_access_key_from_keychain (key_id)
|
16
|
+
dump = `security -q find-generic-password -a "#{key_id}" -g 2>&1`
|
17
|
+
dump[/password: "(.*)"/, 1]
|
18
|
+
end
|
19
|
+
|
20
|
+
TestCredentials.aws_access_key_id= 'AAAAAAAAAAAAAAAAAAAA'
|
21
|
+
TestCredentials.aws_secret_access_key= secret_access_key_from_keychain(TestCredentials.aws_access_key_id)
|
22
|
+
TestCredentials.account_number= '???'
|
23
|
+
|
24
|
+
## Running tests
|
25
|
+
|
26
|
+
There is no test suite that runs all tests. Each module is tested separately. E.g.,
|
27
|
+
to run the Load Balancer tests, run `rake testelb`. Run `rake -T` for a full list.
|
28
|
+
|
29
|
+
Some tests need to launch services on AWS to have something to test. This means two things:
|
30
|
+
|
31
|
+
1. Running all the tests will cost you money.
|
32
|
+
2. You will need to shut down some services separately once you are done, or things
|
33
|
+
will keep running and cost you money.
|
34
|
+
|
35
|
+
As an example, the ELB and Route 53 tests need a load balancer for testing. Starting a load balancer
|
36
|
+
for every test would make every test case cost as much as running the LB for one hour, so it makes
|
37
|
+
more sense to leave it running until it's no longer needed.
|
38
|
+
|
39
|
+
The ELB tests contain instructions for shutting down the load balancer.
|
data/test/acf/test_right_acf.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
|
-
class
|
3
|
+
class TestAcf < Test::Unit::TestCase
|
4
4
|
|
5
5
|
RIGHT_OBJECT_TEXT = 'Right test message'
|
6
6
|
|
@@ -9,7 +9,7 @@ class TestS3 < Test::Unit::TestCase
|
|
9
9
|
def setup
|
10
10
|
@acf= Rightscale::AcfInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
|
11
11
|
@s3 = Rightscale::S3.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
|
12
|
-
@bucket_name = "right-acf-awesome-test-bucket-
|
12
|
+
@bucket_name = "right-acf-awesome-test-bucket-xxx1"
|
13
13
|
@bucket_domain = "#{@bucket_name}.s3.amazonaws.com"
|
14
14
|
end
|
15
15
|
|
@@ -27,13 +27,18 @@ class TestS3 < Test::Unit::TestCase
|
|
27
27
|
@acf.create_distribution("right-cloudfront-awesome-test-bucket-not-exist", "Mustn't to be born", true)
|
28
28
|
end
|
29
29
|
# a bucket is not a domain naming complied guy
|
30
|
-
bucket_name = '
|
30
|
+
bucket_name = 'right_cloudfront_awesome_test_bucket_BAD_XXX'
|
31
31
|
@s3.bucket(bucket_name, :create)
|
32
32
|
assert_raise(Rightscale::AwsError) do
|
33
33
|
@acf.create_distribution(bucket_name, "Mustn't to be born", true)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def test_02_x_delete_bad_bucket
|
38
|
+
bucket_name = 'right_cloudfront_awesome_test_bucket_BAD_XXX'
|
39
|
+
@s3.bucket(bucket_name, false).delete
|
40
|
+
end
|
41
|
+
|
37
42
|
def test_03_create
|
38
43
|
comment = 'WooHoo!!!'
|
39
44
|
# create a test bucket
|
@@ -69,8 +74,8 @@ class TestS3 < Test::Unit::TestCase
|
|
69
74
|
end
|
70
75
|
# change a config
|
71
76
|
config[:enabled] = false
|
72
|
-
config[:cnames] << '
|
73
|
-
config[:cnames] << '
|
77
|
+
config[:cnames] << 'xxx1.myawesomesite.com'
|
78
|
+
config[:cnames] << 'xxx2.myawesomesite.com'
|
74
79
|
# set config
|
75
80
|
set_config_result = nil
|
76
81
|
assert_nothing_raised do
|
@@ -83,7 +88,7 @@ class TestS3 < Test::Unit::TestCase
|
|
83
88
|
new_config = @acf.get_distribution_config(old[:aws_id])
|
84
89
|
end
|
85
90
|
assert !new_config[:enabled]
|
86
|
-
assert_equal new_config[:cnames].sort, ['
|
91
|
+
assert_equal new_config[:cnames].sort, ['xxx1.myawesomesite.com', 'xxx2.myawesomesite.com']
|
87
92
|
assert_not_equal config[:e_tag], new_config[:e_tag]
|
88
93
|
|
89
94
|
# try to update the old config again (must fail because ETAG has changed)
|
@@ -92,19 +97,6 @@ class TestS3 < Test::Unit::TestCase
|
|
92
97
|
end
|
93
98
|
end
|
94
99
|
|
95
|
-
def test_07_caching
|
96
|
-
# enable caching
|
97
|
-
@acf.params[:cache] = true
|
98
|
-
# list distributions
|
99
|
-
@acf.list_distributions
|
100
|
-
# list the distributions again - cache should hit
|
101
|
-
assert_raise(Rightscale::AwsNoChange) do
|
102
|
-
@acf.list_distributions
|
103
|
-
end
|
104
|
-
# disable caching
|
105
|
-
@acf.params[:cache] = true
|
106
|
-
end
|
107
|
-
|
108
100
|
def test_08_delete_distribution
|
109
101
|
# we need ETAG so use get_distribution
|
110
102
|
distribution = @acf.get_distribution(get_test_distribution[:aws_id])
|
data/test/ec2/test_right_ec2.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
require 'pp'
|
3
2
|
|
4
3
|
class TestEc2 < Test::Unit::TestCase
|
5
4
|
|
@@ -72,5 +71,37 @@ class TestEc2 < Test::Unit::TestCase
|
|
72
71
|
# check that the request has correct signature version
|
73
72
|
assert ec2.last_request.path.include?('SignatureVersion=0')
|
74
73
|
end
|
74
|
+
|
75
|
+
def test_11_regions
|
76
|
+
regions = nil
|
77
|
+
assert_nothing_raised do
|
78
|
+
regions = @ec2.describe_regions
|
79
|
+
end
|
80
|
+
# check we got more that 0 regions
|
81
|
+
assert regions.size > 0
|
82
|
+
# check an access to regions
|
83
|
+
regions.each do |region|
|
84
|
+
regional_ec2 = Rightscale::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :region => region)
|
85
|
+
# do we have a correct endpoint server?
|
86
|
+
assert_equal "#{region}.ec2.amazonaws.com", regional_ec2.params[:server]
|
87
|
+
# get a list of images from every region
|
88
|
+
images = nil
|
89
|
+
assert_nothing_raised do
|
90
|
+
images = regional_ec2.describe_regions
|
91
|
+
end
|
92
|
+
# every region must have images
|
93
|
+
assert images.size > 0
|
94
|
+
end
|
95
|
+
end
|
75
96
|
|
97
|
+
def test_12_endpoint_url
|
98
|
+
ec2 = Rightscale::Ec2.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :endpoint_url => 'a://b.c:0/d/', :region => 'z')
|
99
|
+
# :endpoint_url has a priority hence :region should be ommitted
|
100
|
+
assert_equal 'a', ec2.params[:protocol]
|
101
|
+
assert_equal 'b.c', ec2.params[:server]
|
102
|
+
assert_equal '/d/', ec2.params[:service]
|
103
|
+
assert_equal 0, ec2.params[:port]
|
104
|
+
assert_nil ec2.params[:region]
|
105
|
+
end
|
106
|
+
|
76
107
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestElb < Test::Unit::TestCase
|
4
|
+
|
5
|
+
STDOUT.sync = true
|
6
|
+
BALANCER_NAME = 'right-aws-test-lb'
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@elb = Rightscale::ElbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :logger => Logger.new('/dev/null'))
|
10
|
+
|
11
|
+
unless @elb.describe_load_balancers.detect { |lb| lb[:load_balancer_name] == BALANCER_NAME }
|
12
|
+
@elb.create_load_balancer(BALANCER_NAME, %w[us-east-1b], [])
|
13
|
+
end
|
14
|
+
@lb = @elb.describe_load_balancers.detect { |lb| lb[:load_balancer_name] == BALANCER_NAME }
|
15
|
+
end
|
16
|
+
|
17
|
+
# At the end of the day when you want to shut down the test balancer:
|
18
|
+
# * Uncomment this method.
|
19
|
+
# * Comment out all test except one.
|
20
|
+
# * Run this test file.
|
21
|
+
#
|
22
|
+
# def teardown
|
23
|
+
# @elb.delete_load_balancer BALANCER_NAME
|
24
|
+
# end
|
25
|
+
|
26
|
+
def test_00_describe_load_balancers
|
27
|
+
items = @elb.describe_load_balancers
|
28
|
+
assert items.is_a?(Array)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_description
|
32
|
+
assert_match /^#{BALANCER_NAME}-\d+\.us-east-1\.elb\.amazonaws\.com$/, @lb[:dns_name]
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_description_has_canonical_hosted_zone_name
|
36
|
+
assert_match /^#{BALANCER_NAME}-\d+\.us-east-1\.elb\.amazonaws\.com$/, @lb[:canonical_hosted_zone_name]
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_description_has_canonical_hosted_zone_name_id
|
40
|
+
assert_match /^[A-Z0-9]+$/, @lb[:canonical_hosted_zone_name_id]
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestRds < Test::Unit::TestCase
|
4
|
+
|
5
|
+
STDOUT.sync = true
|
6
|
+
|
7
|
+
TEST_SG_NAME = 'RightRdsSGTest0123456789'
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@rds = Rightscale::RdsInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :logger => Logger.new('/dev/null'))
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_00_instances
|
14
|
+
assert_nothing_raised do
|
15
|
+
items = @rds.describe_db_instances
|
16
|
+
assert items.is_a?(Array)
|
17
|
+
end
|
18
|
+
#
|
19
|
+
assert_nothing_raised do
|
20
|
+
@rds.describe_db_instances do |response|
|
21
|
+
assert response.is_a?(Hash)
|
22
|
+
assert response[:db_instances].is_a?(Array)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_10_security_groups
|
28
|
+
assert_nothing_raised do
|
29
|
+
items = @rds.describe_db_security_groups
|
30
|
+
assert items.is_a?(Array)
|
31
|
+
end
|
32
|
+
#
|
33
|
+
assert_nothing_raised do
|
34
|
+
@rds.describe_db_security_groups do |response|
|
35
|
+
assert response.is_a?(Hash)
|
36
|
+
assert response[:db_security_groups].is_a?(Array)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_11_remove_security_group
|
42
|
+
@rds.delete_db_security_group rescue nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_12_create_security_group
|
46
|
+
sg = nil
|
47
|
+
assert_nothing_raised do
|
48
|
+
sg = @rds.create_db_security_group(TEST_SG_NAME, 'sg-description')
|
49
|
+
end
|
50
|
+
assert sg.is_a?(Hash)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_13_authorize
|
54
|
+
assert_nothing_raised do
|
55
|
+
sg = @rds.authorize_db_security_group_ingress(TEST_SG_NAME, :cidrip => '131.0.0.1/8')
|
56
|
+
assert sg.is_a?(Hash)
|
57
|
+
assert_equal 1, sg[:ip_ranges].size
|
58
|
+
end
|
59
|
+
assert_nothing_raised do
|
60
|
+
sg = @rds.authorize_db_security_group_ingress(TEST_SG_NAME, :ec2_security_group_owner => '826693181925',
|
61
|
+
:ec2_security_group_name => 'default' )
|
62
|
+
assert sg.is_a?(Hash)
|
63
|
+
assert_equal 1, sg[:ec2_security_groups].size
|
64
|
+
end
|
65
|
+
sleep 30
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_14_revoke
|
69
|
+
assert_nothing_raised do
|
70
|
+
sg = @rds.revoke_db_security_group_ingress(TEST_SG_NAME, :cidrip => '131.0.0.1/8')
|
71
|
+
assert sg.is_a?(Hash)
|
72
|
+
end
|
73
|
+
assert_nothing_raised do
|
74
|
+
sg = @rds.revoke_db_security_group_ingress(TEST_SG_NAME, :ec2_security_group_owner => '826693181925',
|
75
|
+
:ec2_security_group_name => 'default' )
|
76
|
+
assert sg.is_a?(Hash)
|
77
|
+
end
|
78
|
+
sleep 30
|
79
|
+
#
|
80
|
+
sg = @rds.describe_db_security_groups(TEST_SG_NAME).first
|
81
|
+
assert_equal 0, sg[:ip_ranges].size
|
82
|
+
assert_equal 0, sg[:ec2_security_groups].size
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_15_delete_security_group
|
86
|
+
assert_nothing_raised do
|
87
|
+
@rds.delete_db_security_group(TEST_SG_NAME)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
def test_20_db_snapshots
|
93
|
+
assert_nothing_raised do
|
94
|
+
items = @rds.describe_db_snapshots
|
95
|
+
assert items.is_a?(Array)
|
96
|
+
end
|
97
|
+
#
|
98
|
+
assert_nothing_raised do
|
99
|
+
@rds.describe_db_snapshots do |response|
|
100
|
+
assert response.is_a?(Hash)
|
101
|
+
assert response[:db_snapshots].is_a?(Array)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_30_events
|
107
|
+
assert_nothing_raised do
|
108
|
+
items = @rds.describe_events
|
109
|
+
assert items.is_a?(Array)
|
110
|
+
end
|
111
|
+
#
|
112
|
+
assert_nothing_raised do
|
113
|
+
@rds.describe_events do |response|
|
114
|
+
assert response.is_a?(Hash)
|
115
|
+
assert response[:events].is_a?(Array)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2011-05-05/">
|
3
|
+
<ChangeBatch>
|
4
|
+
<Changes>
|
5
|
+
<Change>
|
6
|
+
<Action>CREATE</Action>
|
7
|
+
<ResourceRecordSet>
|
8
|
+
<Name>host.right-aws.example.com.</Name>
|
9
|
+
<Type>A</Type>
|
10
|
+
<TTL>600</TTL>
|
11
|
+
<ResourceRecords>
|
12
|
+
<ResourceRecord><Value>10.0.0.1</Value></ResourceRecord>
|
13
|
+
</ResourceRecords>
|
14
|
+
</ResourceRecordSet>
|
15
|
+
</Change>
|
16
|
+
</Changes>
|
17
|
+
</ChangeBatch>
|
18
|
+
</ChangeResourceRecordSetsRequest>
|