amazon-ec2 0.9.7 → 0.9.8
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/.gitignore +0 -1
- data/README_dev.rdoc +1 -0
- data/VERSION +1 -1
- data/amazon-ec2.gemspec +2 -2
- data/lib/AWS.rb +1 -1
- data/lib/AWS/EC2/instances.rb +36 -0
- data/lib/AWS/RDS/rds.rb +21 -11
- metadata +3 -3
data/.gitignore
CHANGED
data/README_dev.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.8
|
data/amazon-ec2.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amazon-ec2}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Glenn Rempe"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-18}
|
13
13
|
s.description = %q{A Ruby library for accessing the Amazon Web Services EC2, ELB, RDS, Cloudwatch, and Autoscaling APIs.}
|
14
14
|
s.email = %q{glenn@rempe.us}
|
15
15
|
s.executables = ["ec2-gem-example.rb", "ec2-gem-profile.rb", "ec2sh", "setup.rb"]
|
data/lib/AWS.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
|
-
%w[ base64 cgi openssl digest/sha1 net/https rexml/document time ostruct ].each { |f| require f }
|
11
|
+
%w[ base64 cgi openssl digest/sha1 net/https net/http rexml/document time ostruct ].each { |f| require f }
|
12
12
|
|
13
13
|
begin
|
14
14
|
require 'xmlsimple' unless defined? XmlSimple
|
data/lib/AWS/EC2/instances.rb
CHANGED
@@ -228,7 +228,43 @@ module AWS
|
|
228
228
|
end
|
229
229
|
|
230
230
|
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
#
|
235
|
+
# A set of methods for querying amazon's ec2 meta-data service.
|
236
|
+
# Note : This can ONLY be run on an actual running EC2 instance.
|
237
|
+
#
|
238
|
+
# Example Class Method Usage :
|
239
|
+
# instance_id = AWS::EC2::Instance.local_instance_id
|
240
|
+
#
|
241
|
+
module Instance
|
242
|
+
|
243
|
+
EC2_META_URL_BASE = 'http://169.254.169.254/latest/meta-data/'
|
244
|
+
|
245
|
+
#
|
246
|
+
# Returns the current instance-id when called from a host within EC2.
|
247
|
+
#
|
248
|
+
def self.local_instance_id
|
249
|
+
Net::HTTP.get URI.parse(EC2_META_URL_BASE + 'instance-id')
|
250
|
+
end
|
251
|
+
|
252
|
+
#
|
253
|
+
# Returns a hash of all available instance meta data.
|
254
|
+
#
|
255
|
+
def self.local_instance_meta_data
|
256
|
+
meta_data = {}
|
257
|
+
|
258
|
+
Net::HTTP.get(URI.parse(EC2_META_URL_BASE)).split("\n").each do |meta_type|
|
259
|
+
meta_data.merge!({meta_type => Net::HTTP.get(URI.parse(EC2_META_URL_BASE + meta_type)) })
|
260
|
+
end
|
261
|
+
|
262
|
+
return meta_data
|
263
|
+
end
|
264
|
+
|
231
265
|
end
|
266
|
+
|
267
|
+
|
232
268
|
end
|
233
269
|
end
|
234
270
|
|
data/lib/AWS/RDS/rds.rb
CHANGED
@@ -462,25 +462,35 @@ module AWS
|
|
462
462
|
# DB Snapshot was created.
|
463
463
|
#
|
464
464
|
# @option options [String] :source_db_instance_identifier the identifier of the source DB Instance from which to restore.
|
465
|
+
# @option options [optional, Boolean] :use_latest_restorable_time specifies that the db be restored to the latest restored time. Conditional, cannot be specified if :restore_time parameter is provided.
|
466
|
+
# @option options [optional, Date] :restore_time specifies the date and time to restore from. Conditional, cannot be specified if :use_latest_restorable_time parameter is true.
|
465
467
|
# @option options [String] :target_db_instance_identifier is the name of the new database instance to be created.
|
466
|
-
# @option options [String] :
|
467
|
-
# @option options [
|
468
|
-
# @option options [String] :
|
469
|
-
# @option options [String] :port is the port which the db can accept connections on
|
470
|
-
# @option options [String] :availability_zone is the EC2 zone which the db instance will be created
|
468
|
+
# @option options [optional, String] :db_instance_class specifies the class of the compute and memory of the EC2 instance, Options : db.m1.small | db.m1.large | db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge
|
469
|
+
# @option options [optional, Integer] :port is the port which the db can accept connections on. Constraints: Value must be 1115-65535
|
470
|
+
# @option options [optional, String] :availability_zone is the EC2 zone which the db instance will be created
|
471
471
|
#
|
472
472
|
def restore_db_instance_to_point_in_time( options = {} )
|
473
|
-
raise ArgumentError, "No :
|
474
|
-
raise ArgumentError, "No :
|
475
|
-
raise ArgumentError, "No :db_instance_class provided" if options.does_not_have?(:db_instance_class)
|
473
|
+
raise ArgumentError, "No :source_db_instance_identifier provided" if options.does_not_have?(:source_db_instance_identifier)
|
474
|
+
raise ArgumentError, "No :target_db_instance_identifier provided" if options.does_not_have?(:target_db_instance_identifier)
|
476
475
|
|
477
476
|
params = {}
|
478
477
|
params['SourceDBInstanceIdentifier'] = options[:source_db_instance_identifier]
|
479
478
|
params['TargetDBInstanceIdentifier'] = options[:target_db_instance_identifier]
|
480
479
|
|
481
|
-
if options
|
482
|
-
|
483
|
-
elsif options
|
480
|
+
if options.has?(:use_latest_restorable_time) && options.has?(:restore_time)
|
481
|
+
raise ArgumentError, "You cannot provide both :use_latest_restorable_time and :restore_time"
|
482
|
+
elsif options.has?(:use_latest_restorable_time)
|
483
|
+
params['UseLatestRestorableTime'] = case options[:use_latest_restorable_time]
|
484
|
+
when 'true', 'false'
|
485
|
+
options[:use_latest_restorable_time]
|
486
|
+
when true
|
487
|
+
'true'
|
488
|
+
when false
|
489
|
+
'false'
|
490
|
+
else
|
491
|
+
raise ArgumentError, "Invalid value provided for :use_latest_restorable_time. Expected boolean."
|
492
|
+
end
|
493
|
+
elsif options.has?(:restore_time)
|
484
494
|
params['RestoreTime'] = options[:restore_time]
|
485
495
|
end
|
486
496
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 8
|
9
|
+
version: 0.9.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Glenn Rempe
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-18 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|