amazon-ec2 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +12 -1
- data/History.txt +2 -0
- data/README.txt +4 -4
- data/examples/ec2-example.rb +1 -1
- data/lib/EC2/instances.rb +19 -2
- data/lib/EC2/version.rb +1 -1
- data/test/EC2_test.rb +6 -4
- data/test/test_helper.rb +13 -0
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
@@ -1,7 +1,18 @@
|
|
1
1
|
=CHANGELOG.txt : Amazon Elastic Compute Cloud (EC2) Ruby Gem
|
2
2
|
|
3
|
+
===0.0.5 (12/21/2006)
|
4
|
+
* Changes to home page documentation and example files to indicate that you
|
5
|
+
should use 'require_gem' instead of a simple require. Not sure if this
|
6
|
+
is a result of something I am doing in the packaging of the gem that is
|
7
|
+
incorrect or if this is right and proper. I will investigate further.
|
8
|
+
* Patched instances.rb run_instances method to allow for submission of
|
9
|
+
user data with the command to start an instance. Patch submitted
|
10
|
+
anonymously on RubyForge. This had not been functionally implemented
|
11
|
+
in the Amazon Web Services sample library prior to this patch.
|
12
|
+
* Added simple framework for adding unit tests for the library under test dir.
|
13
|
+
No functional unit tests exist yet.
|
3
14
|
|
4
|
-
===0.0.4 (12/
|
15
|
+
===0.0.4 (12/21/2006)
|
5
16
|
* Applied patch from Kevin Clark to svn version 7. Thanks for the
|
6
17
|
patch and the description Kevin! Please report if you
|
7
18
|
encounter any issues with this patched version. Here is Kevin's
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -51,9 +51,9 @@ as such the Query API Reference in the EC2 Developer Guide should be consulted.
|
|
51
51
|
===Example Code Usage (Stand-alone Ruby Application):
|
52
52
|
|
53
53
|
#!/usr/bin/env ruby
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
require 'rubygems'
|
55
|
+
require_gem 'amazon-ec2'
|
56
|
+
AWS_ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--'
|
57
57
|
AWS_SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--'
|
58
58
|
conn = EC2::AWSAuthConnection.new(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
59
59
|
puts "----- listing images -----"
|
@@ -71,7 +71,7 @@ you may consult for a few more detailed usage examples.
|
|
71
71
|
config/environment.rb:
|
72
72
|
...
|
73
73
|
# Include Amazon Web Services EC2 library gem
|
74
|
-
|
74
|
+
require_gem 'amazon-ec2'
|
75
75
|
|
76
76
|
app/controllers/your_controller.rb:
|
77
77
|
conn = EC2::AWSAuthConnection.new(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
|
data/examples/ec2-example.rb
CHANGED
data/lib/EC2/instances.rb
CHANGED
@@ -45,10 +45,26 @@ module EC2
|
|
45
45
|
# password-less access. As the need arises, other formats will
|
46
46
|
# also be considered.
|
47
47
|
def run_instances(imageId, kwargs={})
|
48
|
+
|
49
|
+
# setup the default input parameters hash
|
48
50
|
in_params = { :minCount=>1, :maxCount=>1, :keyname=>nil, :groupIds=>[], :userData=>nil, :base64Encoded=>false }
|
51
|
+
|
52
|
+
# Override or extend the default input params with any passed in kwargs
|
49
53
|
in_params.merge!(kwargs)
|
50
|
-
userData = Base64.encode64(userData) if userData and not base64Encoded
|
51
54
|
|
55
|
+
# If userData is passed in then URL escape and Base64 encode it
|
56
|
+
# as needed. Need for URL Escape + Base64 encoding is determined
|
57
|
+
# by base64Encoded param.
|
58
|
+
if in_params[:userData]
|
59
|
+
if in_params[:base64Encoded]
|
60
|
+
userData = in_params[:userData]
|
61
|
+
else
|
62
|
+
userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
|
63
|
+
end
|
64
|
+
else
|
65
|
+
userData = nil
|
66
|
+
end
|
67
|
+
|
52
68
|
params = {
|
53
69
|
"ImageId" => imageId,
|
54
70
|
"MinCount" => in_params[:minCount].to_s,
|
@@ -56,7 +72,8 @@ module EC2
|
|
56
72
|
}.merge(pathlist("SecurityGroup", in_params[:groupIds]))
|
57
73
|
|
58
74
|
params["KeyName"] = in_params[:keyname] unless in_params[:keyname].nil?
|
59
|
-
|
75
|
+
params["UserData"] = userData unless userData.nil?
|
76
|
+
|
60
77
|
RunInstancesResponse.new(make_request("RunInstances", params))
|
61
78
|
end
|
62
79
|
|
data/lib/EC2/version.rb
CHANGED
data/test/EC2_test.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
|
+
# This is the top of the test suite. This file is what is
|
4
|
+
# automatically run when 'rake test' is run. Individual test
|
5
|
+
# cases are found in the tc_* files. Do any setup for
|
6
|
+
# all of the test cases in the setup method of this file.
|
7
|
+
|
3
8
|
class EC2Test < Test::Unit::TestCase
|
4
9
|
|
5
10
|
def setup
|
6
11
|
end
|
7
|
-
|
8
|
-
def test_truth
|
9
|
-
assert true
|
10
|
-
end
|
12
|
+
|
11
13
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,2 +1,15 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
|
3
|
+
# include the test cases that are part of this suite.
|
4
|
+
# these are broken out into the same functional groups
|
5
|
+
# as the module components in the lib/EC2 dir.
|
6
|
+
require 'tc_ec2_base'
|
7
|
+
require 'tc_images'
|
8
|
+
require 'tc_image_attributes'
|
9
|
+
require 'tc_keypairs'
|
10
|
+
require 'tc_instances'
|
11
|
+
require 'tc_responses'
|
12
|
+
require 'tc_security_groups'
|
13
|
+
require 'tc_version'
|
14
|
+
|
2
15
|
require File.dirname(__FILE__) + '/../lib/EC2'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: amazon-ec2
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date:
|
6
|
+
version: 0.0.5
|
7
|
+
date: 2007-01-02 00:00:00 -08:00
|
8
8
|
summary: An interface library that allows Ruby or Ruby on Rails applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate server instances.
|
9
9
|
require_paths:
|
10
10
|
- lib
|