aws-sdk 1.6.9 → 1.7.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.rdoc +1 -1
- data/lib/aws.rb +8 -0
- data/lib/aws/api_config/CloudSearch-2011-02-01.yml +681 -0
- data/lib/aws/api_config/DynamoDB-2011-12-05.yml +4 -0
- data/lib/aws/api_config/EMR-2009-03-31.yml +18 -0
- data/lib/aws/api_config/ElastiCache-2012-03-09.yml +777 -0
- data/lib/aws/api_config/ElasticBeanstalk-2010-12-01.yml +823 -0
- data/lib/aws/api_config/RDS-2012-07-31.yml +1621 -0
- data/lib/aws/cloud_search.rb +31 -0
- data/lib/aws/cloud_search/client.rb +558 -0
- data/lib/aws/cloud_search/config.rb +18 -0
- data/lib/aws/cloud_search/errors.rb +22 -0
- data/lib/aws/cloud_search/request.rb +23 -0
- data/lib/aws/cloud_watch/alarm.rb +1 -1
- data/lib/aws/cloud_watch/metric.rb +3 -3
- data/lib/aws/core.rb +18 -3
- data/lib/aws/core/configuration.rb +11 -0
- data/lib/aws/core/inflection.rb +1 -0
- data/lib/aws/core/service_interface.rb +1 -1
- data/lib/aws/dynamo_db/batch_get.rb +19 -12
- data/lib/aws/dynamo_db/client.rb +27 -1
- data/lib/aws/dynamo_db/config.rb +2 -0
- data/lib/aws/dynamo_db/item_collection.rb +2 -2
- data/lib/aws/dynamo_db/table.rb +8 -2
- data/lib/aws/ec2/reserved_instances.rb +3 -0
- data/lib/aws/ec2/reserved_instances_offering.rb +3 -1
- data/lib/aws/elastic_beanstalk.rb +48 -0
- data/lib/aws/elastic_beanstalk/client.rb +867 -0
- data/lib/aws/elastic_beanstalk/config.rb +18 -0
- data/lib/aws/elastic_beanstalk/errors.rb +22 -0
- data/lib/aws/elastic_beanstalk/request.rb +23 -0
- data/lib/aws/elasticache.rb +48 -0
- data/lib/aws/elasticache/client.rb +758 -0
- data/lib/aws/elasticache/config.rb +18 -0
- data/lib/aws/elasticache/errors.rb +22 -0
- data/lib/aws/elasticache/request.rb +23 -0
- data/lib/aws/emr/client.rb +30 -6
- data/lib/aws/emr/job_flow.rb +10 -0
- data/lib/aws/rds.rb +69 -0
- data/lib/aws/rds/client.rb +1592 -0
- data/lib/aws/rds/config.rb +18 -0
- data/lib/aws/rds/db_instance.rb +201 -0
- data/lib/aws/rds/db_instance_collection.rb +75 -0
- data/lib/aws/rds/db_snapshot.rb +163 -0
- data/lib/aws/rds/db_snapshot_collection.rb +89 -0
- data/lib/aws/rds/errors.rb +22 -0
- data/lib/aws/rds/request.rb +23 -0
- data/lib/aws/s3/bucket_tag_collection.rb +1 -1
- data/lib/aws/s3/client.rb +4 -2
- data/lib/aws/s3/errors.rb +0 -1
- data/lib/aws/s3/object_collection.rb +40 -22
- data/lib/aws/s3/object_version.rb +7 -2
- data/lib/aws/s3/request.rb +1 -1
- data/lib/aws/s3/s3_object.rb +35 -11
- data/lib/aws/version.rb +1 -1
- metadata +33 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
AWS::Core::Configuration.module_eval do
|
15
|
+
|
16
|
+
add_service 'RDS', 'rds', 'rds.us-east-1.amazonaws.com'
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
|
15
|
+
module AWS
|
16
|
+
class RDS
|
17
|
+
|
18
|
+
# @attr_reader [String] db_instance_class
|
19
|
+
#
|
20
|
+
# @attr_reader [String] engine
|
21
|
+
#
|
22
|
+
# @attr_reader [String] db_instance_status
|
23
|
+
#
|
24
|
+
# @attr_reader [String] master_username
|
25
|
+
#
|
26
|
+
# @attr_reader [String] db_name
|
27
|
+
#
|
28
|
+
# @attr_reader [String] endpoint_address
|
29
|
+
#
|
30
|
+
# @attr_reader [Integer] endpoint_port
|
31
|
+
#
|
32
|
+
# @attr_reader [Integer] allocated_storage
|
33
|
+
#
|
34
|
+
# @attr_reader [Time] creation_date_time
|
35
|
+
#
|
36
|
+
# @attr_reader [String] preferred_backup_window
|
37
|
+
#
|
38
|
+
# @attr_reader [Integer] backup_retention_period
|
39
|
+
#
|
40
|
+
# @attr_reader [String] availability_zone_name
|
41
|
+
#
|
42
|
+
# @attr_reader [String] preferred_maintenance_window
|
43
|
+
#
|
44
|
+
# @attr_reader [Time] latest_restorable_time
|
45
|
+
#
|
46
|
+
# @attr_reader [Boolean] multi_az
|
47
|
+
#
|
48
|
+
# @attr_reader [String] engine_version
|
49
|
+
#
|
50
|
+
# @attr_reader [Boolean] auto_minor_version_upgrade
|
51
|
+
#
|
52
|
+
# @attr_reader [String] read_replica_source_db_instance_identifier
|
53
|
+
#
|
54
|
+
# @attr_reader [Array<String>] read_replica_db_instance_identifiers
|
55
|
+
#
|
56
|
+
# @attr_reader [String] license_model
|
57
|
+
#
|
58
|
+
# @attr_reader [String] character_set_name
|
59
|
+
#
|
60
|
+
class DBInstance < Core::Resource
|
61
|
+
|
62
|
+
# @param [String] db_instance_id
|
63
|
+
# @param [Hash] options
|
64
|
+
def initialize db_instance_id, options = {}
|
65
|
+
@db_instance_identifier = db_instance_id
|
66
|
+
super
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [String]
|
70
|
+
attr_reader :db_instance_identifier
|
71
|
+
|
72
|
+
alias_method :id, :db_instance_identifier
|
73
|
+
|
74
|
+
alias_method :db_instance_id, :db_instance_identifier
|
75
|
+
|
76
|
+
attribute :allocated_storage, :static => true, :alias => :size
|
77
|
+
|
78
|
+
attribute :auto_minor_version_upgrade
|
79
|
+
|
80
|
+
attribute :availability_zone_name,
|
81
|
+
:from => :availability_zone,
|
82
|
+
:static => true
|
83
|
+
|
84
|
+
attribute :backup_retention_period, :static => true
|
85
|
+
|
86
|
+
attribute :character_set_name, :static => true
|
87
|
+
|
88
|
+
attribute :creation_date_time,
|
89
|
+
:from => :instance_create_time,
|
90
|
+
:static => true,
|
91
|
+
:alias => :created_at
|
92
|
+
|
93
|
+
attribute :db_instance_class, :static => true
|
94
|
+
|
95
|
+
attribute :db_instance_status, :alias => :status
|
96
|
+
|
97
|
+
attribute :db_name, :static => true, :alias => :name
|
98
|
+
|
99
|
+
attribute :endpoint_address,
|
100
|
+
:from => [:endpoint, :address],
|
101
|
+
:static => true
|
102
|
+
|
103
|
+
attribute :endpoint_port,
|
104
|
+
:from => [:endpoint, :port],
|
105
|
+
:static => true
|
106
|
+
|
107
|
+
attribute :engine, :static => true
|
108
|
+
|
109
|
+
attribute :engine_version, :static => true
|
110
|
+
|
111
|
+
attribute :latest_restorable_time
|
112
|
+
|
113
|
+
attribute :license_model
|
114
|
+
|
115
|
+
attribute :master_username, :static => true
|
116
|
+
|
117
|
+
attribute :multi_az, :static => true, :alias => :multi_az?
|
118
|
+
|
119
|
+
attribute :preferred_backup_window, :static => true
|
120
|
+
|
121
|
+
attribute :preferred_maintenance_window, :static => true
|
122
|
+
|
123
|
+
attribute :read_replica_db_instance_identifiers, :static => true
|
124
|
+
|
125
|
+
attribute :read_replica_source_db_instance_identifier, :static => true
|
126
|
+
|
127
|
+
populates_from(:create_db_instance) do |resp|
|
128
|
+
resp.data if resp.data[:db_instance_identifier] == id
|
129
|
+
end
|
130
|
+
|
131
|
+
populates_from(:describe_db_instances) do |resp|
|
132
|
+
resp.data[:db_instances].find{|j| j[:db_instance_identifier] == id }
|
133
|
+
end
|
134
|
+
|
135
|
+
# Modifies the database instance.
|
136
|
+
# @note You do not need to set +:db_instance_identifier+.
|
137
|
+
# @see Client#modify_db_instance
|
138
|
+
# @param (see Client#modify_db_instance)
|
139
|
+
def modify options = {}
|
140
|
+
client.modify_db_instance(options.merge(:db_instance_identifier => id))
|
141
|
+
end
|
142
|
+
|
143
|
+
# @return [DBSnapshotCollection]
|
144
|
+
def snapshots
|
145
|
+
DBSnapshotCollection.new(:config => config).db_instance(self)
|
146
|
+
end
|
147
|
+
|
148
|
+
# @return [DBSnapshot]
|
149
|
+
def create_snapshot db_snapshot_id
|
150
|
+
|
151
|
+
options = {}
|
152
|
+
options[:db_snapshot_identifier] = db_snapshot_id
|
153
|
+
options[:db_instance_identifier] = db_instance_identifier
|
154
|
+
resp = client.create_db_snapshot(options)
|
155
|
+
|
156
|
+
DBSnapshot.new_from(:create_db_snapshot, resp,
|
157
|
+
resp[:db_snapshot_identifier], :config => config)
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
# Reboots this databse instance.
|
162
|
+
# @param [Hash] options
|
163
|
+
# @option options [Boolean] :force_failover When +true+, the reboot will be
|
164
|
+
# conducted through a MultiAZ failover. Constraint: You cannot
|
165
|
+
# specify +true+ if the instance is not configured for MultiAZ.
|
166
|
+
# @return [nil]
|
167
|
+
def reboot options = {}
|
168
|
+
client.reboot_db_instance(options.merge(:db_instance_identifier => id))
|
169
|
+
nil
|
170
|
+
end
|
171
|
+
|
172
|
+
# Terminates (deletes) this database instance.
|
173
|
+
# @return [nil]
|
174
|
+
def delete options = {}
|
175
|
+
client.delete_db_instance(options.merge(:db_instance_identifier => id))
|
176
|
+
nil
|
177
|
+
end
|
178
|
+
|
179
|
+
# @return [Boolean] Returns +true+ if the db instance exists.
|
180
|
+
def exists?
|
181
|
+
begin
|
182
|
+
get_resource
|
183
|
+
true
|
184
|
+
rescue AWS::RDS::Errors::DBInstanceNotFound
|
185
|
+
false
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
protected
|
190
|
+
|
191
|
+
def resource_identifiers
|
192
|
+
[[:db_instance_identifier, id]]
|
193
|
+
end
|
194
|
+
|
195
|
+
def get_resource attr = nil
|
196
|
+
client.describe_db_instances(:db_instance_identifier => id)
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
|
15
|
+
require 'date'
|
16
|
+
require 'time'
|
17
|
+
|
18
|
+
module AWS
|
19
|
+
class RDS
|
20
|
+
class DBInstanceCollection
|
21
|
+
|
22
|
+
include Core::Collection::WithLimitAndNextToken
|
23
|
+
|
24
|
+
# @param [String] db_instance_id The DB instance identifier.
|
25
|
+
# This should be a lowercase string.
|
26
|
+
# @return [DBInstance] Returns a {DBInstance} with the given ID.
|
27
|
+
def [] db_instance_id
|
28
|
+
DBInstance.new(db_instance_id.to_s.downcase, :config => config)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates a database instance. See {Client#create_db_instance}
|
32
|
+
# for documentation on the accepted (and required) options.
|
33
|
+
# @param [String] db_instance_id The DB instance identifier.
|
34
|
+
# This should be a lowercase string.
|
35
|
+
# @param [Hash] options
|
36
|
+
# @option (see Client#create_db_instance)
|
37
|
+
# @return [DBInstance]
|
38
|
+
def create db_instance_id, options = {}
|
39
|
+
|
40
|
+
options[:db_instance_identifier] = db_instance_id
|
41
|
+
|
42
|
+
resp = client.create_db_instance(options)
|
43
|
+
|
44
|
+
DBInstance.new_from(:create_db_instance, resp,
|
45
|
+
resp[:db_instance_identifier], :config => config)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def _each_item marker, max_records, options = {}, &block
|
52
|
+
|
53
|
+
options[:marker] = marker if marker
|
54
|
+
options[:max_records] = [[20,max_records].max,100].min if max_records
|
55
|
+
|
56
|
+
response = client.describe_db_instances(options)
|
57
|
+
response.data[:db_instances].each do |details|
|
58
|
+
|
59
|
+
db_instance = DBInstance.new_from(
|
60
|
+
:describe_db_instances,
|
61
|
+
details,
|
62
|
+
details[:db_instance_identifier],
|
63
|
+
:config => config)
|
64
|
+
|
65
|
+
yield(db_instance)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
response.data[:marker]
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class RDS
|
16
|
+
|
17
|
+
# @attr_reader [Integer] allocated_storage
|
18
|
+
#
|
19
|
+
# @attr_reader [String] availability_zone_name
|
20
|
+
#
|
21
|
+
# @attr_reader [String] db_instance_id
|
22
|
+
#
|
23
|
+
# @attr_reader [String] engine
|
24
|
+
#
|
25
|
+
# @attr_reader [String] engine_version
|
26
|
+
#
|
27
|
+
# @attr_reader [String] license_model
|
28
|
+
#
|
29
|
+
# @attr_reader [String] master_username
|
30
|
+
#
|
31
|
+
# @attr_reader [String] port
|
32
|
+
#
|
33
|
+
# @attr_reader [Integer] vpc_id
|
34
|
+
#
|
35
|
+
# @attr_reader [String] snapshot_type
|
36
|
+
#
|
37
|
+
# @attr_reader [String] status
|
38
|
+
#
|
39
|
+
# @attr_reader [Time] created_at
|
40
|
+
#
|
41
|
+
# @attr_reader [Time] instance_create_time
|
42
|
+
#
|
43
|
+
class DBSnapshot < Core::Resource
|
44
|
+
|
45
|
+
# @param [String] db_snapshot_id
|
46
|
+
# @param [Hash] options
|
47
|
+
def initialize db_snapshot_id, options = {}
|
48
|
+
@db_snapshot_identifier = db_snapshot_id
|
49
|
+
super
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [String]
|
53
|
+
attr_reader :db_snapshot_identifier
|
54
|
+
|
55
|
+
alias_method :id, :db_snapshot_identifier
|
56
|
+
|
57
|
+
alias_method :db_snapshot_id, :db_snapshot_identifier
|
58
|
+
|
59
|
+
attribute :allocated_storage, :static => true, :alias => :size
|
60
|
+
|
61
|
+
attribute :availability_zone_name,
|
62
|
+
:from => :availability_zone,
|
63
|
+
:static => true
|
64
|
+
|
65
|
+
attribute :db_instance_id,
|
66
|
+
:from => :db_instance_identifier,
|
67
|
+
:static => true,
|
68
|
+
:alias => :db_instance_identifier
|
69
|
+
|
70
|
+
attribute :engine, :static => true
|
71
|
+
|
72
|
+
attribute :engine_version, :static => true
|
73
|
+
|
74
|
+
attribute :license_model, :static => true
|
75
|
+
|
76
|
+
attribute :master_username, :static => true
|
77
|
+
|
78
|
+
attribute :port, :static => true
|
79
|
+
|
80
|
+
attribute :vpc_id, :static => true
|
81
|
+
|
82
|
+
attribute :snapshot_type, :static => true, :alias => :type
|
83
|
+
|
84
|
+
attribute :status, :alias => :db_snapshot_status
|
85
|
+
|
86
|
+
attribute :created_at,
|
87
|
+
:from => :snapshot_create_time,
|
88
|
+
:static => true, :alias => :created_at
|
89
|
+
|
90
|
+
attribute :instance_create_time, :static => true
|
91
|
+
|
92
|
+
populates_from(:create_db_snapshot, :copy_db_snapshot) do |resp|
|
93
|
+
resp.data if resp[:db_snapshot_identifier] == id
|
94
|
+
end
|
95
|
+
|
96
|
+
populates_from(:describe_db_snapshots) do |resp|
|
97
|
+
resp.data[:db_snapshots].find{|s| s[:db_snapshot_identifier] == id }
|
98
|
+
end
|
99
|
+
|
100
|
+
# @return [DBInstance]
|
101
|
+
def db_instance
|
102
|
+
DBInstance.new(db_instance_id, :config => config)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Copies this database snapshot.
|
106
|
+
# @param [String] new_snapshot_id
|
107
|
+
# @return [DBSnapshot]
|
108
|
+
def copy new_snapshot_id
|
109
|
+
|
110
|
+
options = {}
|
111
|
+
options[:source_db_snapshot_identifier] = id
|
112
|
+
options[:target_db_snapshot_identifier] = new_snapshot_id
|
113
|
+
resp = client.copy_db_snapshot(options)
|
114
|
+
|
115
|
+
DBSnapshot.new_from(:copy_db_snapshot, resp,
|
116
|
+
resp[:db_snapshot_identifier], :config => config)
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deletes this database snapshot.
|
121
|
+
# @return [nil]
|
122
|
+
def delete
|
123
|
+
client.delete_db_snapshot(:db_snapshot_identifier => db_snapshot_identifier)
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
127
|
+
# Restores the database instance from this snapshot. You may optionally
|
128
|
+
# specify the db instance id if you wish to restore to a different db.
|
129
|
+
#
|
130
|
+
# @param (see Client#restore_db_instance_from_db_snapshot)
|
131
|
+
# @option (see Client#restore_db_instance_from_db_snapshot)
|
132
|
+
def restore_instance options = {}
|
133
|
+
options[:db_snapshot_identifier] = db_snapshot_identifier
|
134
|
+
options[:db_instance_identifier] ||= db_instance_id
|
135
|
+
client.restore_db_instance_from_db_snapshot(options)
|
136
|
+
nil
|
137
|
+
end
|
138
|
+
|
139
|
+
# @return [Boolean] Returns +true+ if the db snapshot exists.
|
140
|
+
def exists?
|
141
|
+
begin
|
142
|
+
get_resource
|
143
|
+
true
|
144
|
+
rescue AWS::RDS::Errors::DBSnapshotNotFound
|
145
|
+
false
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
protected
|
150
|
+
|
151
|
+
def resource_identifiers
|
152
|
+
[[:db_snapshot_identifier, id]]
|
153
|
+
end
|
154
|
+
|
155
|
+
def get_resource attr = nil
|
156
|
+
options = {}
|
157
|
+
options[:db_snapshot_identifier] = db_snapshot_identifier
|
158
|
+
client.describe_db_snapshots(options)
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|