amazon-ec2 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +0 -2
- data/README.txt +1 -1
- data/lib/EC2.rb +60 -60
- data/lib/EC2/console.rb +11 -11
- data/lib/EC2/exceptions.rb +35 -35
- data/lib/EC2/image_attributes.rb +39 -39
- data/lib/EC2/images.rb +58 -58
- data/lib/EC2/instances.rb +86 -73
- data/lib/EC2/keypairs.rb +26 -26
- data/lib/EC2/products.rb +10 -10
- data/lib/EC2/responses.rb +37 -37
- data/lib/EC2/security_groups.rb +79 -79
- data/lib/EC2/version.rb +1 -1
- data/test/test_EC2.rb +10 -10
- data/test/test_EC2_console.rb +15 -15
- data/test/test_EC2_image_attributes.rb +74 -74
- data/test/test_EC2_images.rb +45 -45
- data/test/test_EC2_instances.rb +103 -88
- data/test/test_EC2_keypairs.rb +24 -24
- data/test/test_EC2_products.rb +10 -10
- data/test/test_EC2_responses.rb +29 -29
- data/test/test_EC2_security_groups.rb +50 -50
- data/test/test_EC2_version.rb +13 -13
- data/test/test_helper.rb +1 -1
- data/website/index.html +1 -1
- metadata +2 -4
- data/website/announce.html +0 -109
- data/website/announce.txt +0 -36
data/lib/EC2/keypairs.rb
CHANGED
@@ -9,13 +9,13 @@
|
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
12
|
-
|
12
|
+
|
13
13
|
class Base
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
|
16
16
|
#Amazon Developer Guide Docs:
|
17
17
|
#
|
18
|
-
# The CreateKeyPair operation creates a new 2048 bit RSA keypair and returns a unique ID that can be
|
18
|
+
# The CreateKeyPair operation creates a new 2048 bit RSA keypair and returns a unique ID that can be
|
19
19
|
# used to reference this keypair when launching new instances.
|
20
20
|
#
|
21
21
|
#Required Arguments:
|
@@ -27,23 +27,23 @@ module EC2
|
|
27
27
|
# none
|
28
28
|
#
|
29
29
|
def create_keypair( options = {} )
|
30
|
-
|
30
|
+
|
31
31
|
# defaults
|
32
32
|
options = { :key_name => "" }.merge(options)
|
33
|
-
|
33
|
+
|
34
34
|
raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
|
35
|
-
|
35
|
+
|
36
36
|
params = { "KeyName" => options[:key_name] }
|
37
|
-
|
37
|
+
|
38
38
|
return response_generator(:action => "CreateKeyPair", :params => params)
|
39
|
-
|
39
|
+
|
40
40
|
end
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
|
43
43
|
#Amazon Developer Guide Docs:
|
44
44
|
#
|
45
|
-
# The DescribeKeyPairs operation returns information about keypairs available for use by the user
|
46
|
-
# making the request. Selected keypairs may be specified or the list may be left empty if information for
|
45
|
+
# The DescribeKeyPairs operation returns information about keypairs available for use by the user
|
46
|
+
# making the request. Selected keypairs may be specified or the list may be left empty if information for
|
47
47
|
# all registered keypairs is required.
|
48
48
|
#
|
49
49
|
#Required Arguments:
|
@@ -55,16 +55,16 @@ module EC2
|
|
55
55
|
# none
|
56
56
|
#
|
57
57
|
def describe_keypairs( options = {} )
|
58
|
-
|
58
|
+
|
59
59
|
options = { :key_name => [] }.merge(options)
|
60
|
-
|
60
|
+
|
61
61
|
params = pathlist("KeyName", options[:key_name] )
|
62
|
-
|
62
|
+
|
63
63
|
return response_generator(:action => "DescribeKeyPairs", :params => params)
|
64
|
-
|
64
|
+
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
|
68
68
|
#Amazon Developer Guide Docs:
|
69
69
|
#
|
70
70
|
# The DeleteKeyPair operation deletes a keypair.
|
@@ -78,17 +78,17 @@ module EC2
|
|
78
78
|
# none
|
79
79
|
#
|
80
80
|
def delete_keypair( options = {} )
|
81
|
-
|
81
|
+
|
82
82
|
options = { :key_name => "" }.merge(options)
|
83
|
-
|
83
|
+
|
84
84
|
raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
|
85
|
-
|
85
|
+
|
86
86
|
params = { "KeyName" => options[:key_name] }
|
87
|
-
|
87
|
+
|
88
88
|
return response_generator(:action => "DeleteKeyPair", :params => params)
|
89
|
-
|
89
|
+
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
end
|
data/lib/EC2/products.rb
CHANGED
@@ -9,12 +9,12 @@
|
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
12
|
-
|
12
|
+
|
13
13
|
class Base
|
14
|
-
|
14
|
+
|
15
15
|
#Amazon Developer Guide Docs:
|
16
|
-
#
|
17
|
-
# The ConfirmProductInstance operation returns true if the given product code is attached to the instance
|
16
|
+
#
|
17
|
+
# The ConfirmProductInstance operation returns true if the given product code is attached to the instance
|
18
18
|
# with the given instance id. False is returned if the product code is not attached to the instance.
|
19
19
|
#
|
20
20
|
#Required Arguments:
|
@@ -27,17 +27,17 @@ module EC2
|
|
27
27
|
# none
|
28
28
|
#
|
29
29
|
def confirm_product_instance( options ={} )
|
30
|
-
|
30
|
+
|
31
31
|
options = {:product_code => "", :instance_id => ""}.merge(options)
|
32
|
-
|
32
|
+
|
33
33
|
raise ArgumentError, "No product code provided" if options[:product_code].nil? || options[:product_code].empty?
|
34
34
|
raise ArgumentError, "No instance ID provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
35
|
-
|
35
|
+
|
36
36
|
params = { "ProductCode" => options[:product_code], "InstanceId" => options[:instance_id] }
|
37
|
-
|
37
|
+
|
38
38
|
return response_generator(:action => "ConfirmProductInstance", :params => params)
|
39
|
-
|
39
|
+
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
end
|
data/lib/EC2/responses.rb
CHANGED
@@ -9,12 +9,12 @@
|
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
12
|
-
|
13
|
-
# The make_request() and ec2_error? methods, which are shared by all, will raise any
|
12
|
+
|
13
|
+
# The make_request() and ec2_error? methods, which are shared by all, will raise any
|
14
14
|
# exceptions encountered along the way as it converses with EC2.
|
15
15
|
#
|
16
16
|
# Exception Handling: If for some reason an error occurrs when executing a method
|
17
|
-
# (e.g. its arguments were incorrect, or it simply failed) then an exception will
|
17
|
+
# (e.g. its arguments were incorrect, or it simply failed) then an exception will
|
18
18
|
# be thrown. The exceptions are defined in exceptions.rb as individual classes and should
|
19
19
|
# match the exceptions that Amazon has defined for EC2. If the exception raised cannot be
|
20
20
|
# identified then a more generic exception class will be thrown.
|
@@ -22,52 +22,52 @@ module EC2
|
|
22
22
|
# The implication of this is that you need to be prepared to handle any exceptions that
|
23
23
|
# may be raised by this library in YOUR code with a 'rescue' clauses. It is up to you
|
24
24
|
# how gracefully you want to handle these exceptions that are raised.
|
25
|
-
|
25
|
+
|
26
26
|
# Credits :
|
27
|
-
# I learned the magic of making an OpenStruct object able to respond as a fully Enumerable
|
28
|
-
# object (responds to .each, etc.) thanks to a great blog article on Struct and OpenStruct
|
27
|
+
# I learned the magic of making an OpenStruct object able to respond as a fully Enumerable
|
28
|
+
# object (responds to .each, etc.) thanks to a great blog article on Struct and OpenStruct
|
29
29
|
# at http://errtheblog.com/post/30
|
30
30
|
#
|
31
31
|
# Thanks to Sean Knapp for the XmlSimple response patch which greatly simplified the response
|
32
32
|
# mechanism for the whole library while making it more accurate and much less brittle to boot!
|
33
33
|
#
|
34
|
-
|
34
|
+
|
35
35
|
require 'rubygems'
|
36
36
|
begin
|
37
37
|
require 'xmlsimple' unless defined? XmlSimple
|
38
38
|
rescue Exception => e
|
39
39
|
require 'xml-simple' unless defined? XmlSimple
|
40
40
|
end
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
|
43
43
|
class Response < OpenStruct
|
44
|
-
|
44
|
+
|
45
45
|
include Enumerable
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def self.parse(options = {})
|
49
49
|
options = {
|
50
50
|
:xml => "",
|
51
51
|
:parse_options => { 'ForceArray' => ['item'], 'SuppressEmpty' => nil }
|
52
52
|
}.merge(options)
|
53
53
|
response = Response.new(XmlSimple.xml_in(options[:xml], options[:parse_options]))
|
54
|
-
|
54
|
+
|
55
55
|
# set the xml attribute of the response object to contain the original XML that was
|
56
56
|
# returned by amazon. This allows anyone to bypass our parsing if desired and just
|
57
57
|
# get right at the raw XML response.
|
58
58
|
response.xml = options[:xml]
|
59
59
|
return response
|
60
60
|
end
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
|
63
63
|
# Every member of an OpenStruct object has getters and setters, the latter of which
|
64
64
|
# has a method ending in "=". Find all of these methods, excluding those defined on
|
65
65
|
# parent classes.
|
66
66
|
def members
|
67
|
-
methods(false).sort.grep(/=/).map { |m| m[0...-1] }
|
67
|
+
methods(false).sort.grep(/=/).map { |m| m[0...-1] }
|
68
68
|
end
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
|
71
71
|
# Required by the Enumerable module. Iterate over each item in the members array
|
72
72
|
# and pass as a value the block passed to each using yield.
|
73
73
|
def each
|
@@ -76,32 +76,32 @@ module EC2
|
|
76
76
|
end
|
77
77
|
self
|
78
78
|
end
|
79
|
-
|
80
|
-
|
79
|
+
|
80
|
+
|
81
81
|
# Same as the each method, but with both key and value.
|
82
82
|
#
|
83
83
|
#Sample Use:
|
84
84
|
# obj.each_pair { |k,v| puts "key: #{k}, value: #{v}" }
|
85
|
-
def each_pair
|
85
|
+
def each_pair
|
86
86
|
members.each do |method|
|
87
87
|
yield method, send(method)
|
88
88
|
end
|
89
89
|
self
|
90
90
|
end
|
91
|
-
|
92
|
-
|
91
|
+
|
92
|
+
|
93
93
|
# Alternative method for getting members.
|
94
94
|
def [](member)
|
95
95
|
send(member)
|
96
96
|
end
|
97
|
-
|
98
|
-
|
97
|
+
|
98
|
+
|
99
99
|
# Alternative method for setting members.
|
100
100
|
def []=(member, value)
|
101
101
|
send("#{member}=", value)
|
102
102
|
end
|
103
|
-
|
104
|
-
|
103
|
+
|
104
|
+
|
105
105
|
# Helper for converting to string which support a long and short version
|
106
106
|
# to avoid recursion problems with parents.
|
107
107
|
def to_string(short=false)
|
@@ -123,26 +123,26 @@ module EC2
|
|
123
123
|
s += ">"
|
124
124
|
return s
|
125
125
|
end
|
126
|
-
|
127
|
-
|
126
|
+
|
127
|
+
|
128
128
|
# Override of to string method.
|
129
129
|
def to_s
|
130
130
|
return to_string
|
131
131
|
end
|
132
|
-
|
133
|
-
|
134
|
-
private
|
135
|
-
|
132
|
+
|
133
|
+
|
134
|
+
private
|
135
|
+
|
136
136
|
# Initialize the object by passing data to the OpenStruct initialize method
|
137
|
-
# and then converting ourself to guarantee we have top-to-bottom data
|
137
|
+
# and then converting ourself to guarantee we have top-to-bottom data
|
138
138
|
# representation as a Response object.
|
139
139
|
def initialize(data, parent=nil)
|
140
140
|
super(data)
|
141
141
|
self.parent = parent
|
142
142
|
Response.convert(self, parent)
|
143
143
|
end
|
144
|
-
|
145
|
-
|
144
|
+
|
145
|
+
|
146
146
|
# The "brains" of our Response class. This method takes an arbitray object and
|
147
147
|
# depending on its class attempts to convert it.
|
148
148
|
def self.convert(obj, parent)
|
@@ -171,5 +171,5 @@ module EC2
|
|
171
171
|
end
|
172
172
|
|
173
173
|
end # class Response < OpenStruct
|
174
|
-
|
174
|
+
|
175
175
|
end # module EC2
|
data/lib/EC2/security_groups.rb
CHANGED
@@ -9,17 +9,17 @@
|
|
9
9
|
#++
|
10
10
|
|
11
11
|
module EC2
|
12
|
-
|
12
|
+
|
13
13
|
class Base
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
|
16
16
|
#Amazon Developer Guide Docs:
|
17
17
|
#
|
18
|
-
# The CreateSecurityGroup operation creates a new security group. Every instance is launched
|
19
|
-
# in a security group. If none is specified as part of the launch request then instances
|
20
|
-
# are launched in the default security group. Instances within the same security group have
|
21
|
-
# unrestricted network access to one another. Instances will reject network access attempts from other
|
22
|
-
# instances in a different security group. As the owner of instances you may grant or revoke specific
|
18
|
+
# The CreateSecurityGroup operation creates a new security group. Every instance is launched
|
19
|
+
# in a security group. If none is specified as part of the launch request then instances
|
20
|
+
# are launched in the default security group. Instances within the same security group have
|
21
|
+
# unrestricted network access to one another. Instances will reject network access attempts from other
|
22
|
+
# instances in a different security group. As the owner of instances you may grant or revoke specific
|
23
23
|
# permissions using the AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress operations.
|
24
24
|
#
|
25
25
|
#Required Arguments:
|
@@ -32,31 +32,31 @@ module EC2
|
|
32
32
|
# none
|
33
33
|
#
|
34
34
|
def create_security_group( options = {} )
|
35
|
-
|
35
|
+
|
36
36
|
options = {:group_name => "",
|
37
37
|
:group_description => ""
|
38
38
|
}.merge(options)
|
39
|
-
|
39
|
+
|
40
40
|
raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
|
41
41
|
raise ArgumentError, "No :group_description provided" if options[:group_description].nil? || options[:group_description].empty?
|
42
|
-
|
42
|
+
|
43
43
|
params = {
|
44
44
|
"GroupName" => options[:group_name],
|
45
45
|
"GroupDescription" => options[:group_description]
|
46
46
|
}
|
47
|
-
|
47
|
+
|
48
48
|
return response_generator(:action => "CreateSecurityGroup", :params => params)
|
49
|
-
|
49
|
+
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
#Amazon Developer Guide Docs:
|
54
54
|
#
|
55
|
-
# The DescribeSecurityGroups operation returns information about security groups owned by the
|
56
|
-
# user making the request.
|
55
|
+
# The DescribeSecurityGroups operation returns information about security groups owned by the
|
56
|
+
# user making the request.
|
57
57
|
#
|
58
|
-
# An optional list of security group names may be provided to request information for those security
|
59
|
-
# groups only. If no security group names are provided, information of all security groups will be
|
58
|
+
# An optional list of security group names may be provided to request information for those security
|
59
|
+
# groups only. If no security group names are provided, information of all security groups will be
|
60
60
|
# returned. If a group is specified that does not exist a fault is returned.
|
61
61
|
#
|
62
62
|
#Required Arguments:
|
@@ -68,21 +68,21 @@ module EC2
|
|
68
68
|
# :group_name => Array (default : [])
|
69
69
|
#
|
70
70
|
def describe_security_groups( options = {} )
|
71
|
-
|
71
|
+
|
72
72
|
options = { :group_name => [] }.merge(options)
|
73
|
-
|
73
|
+
|
74
74
|
params = pathlist("GroupName", options[:group_name] )
|
75
|
-
|
75
|
+
|
76
76
|
return response_generator(:action => "DescribeSecurityGroups", :params => params)
|
77
|
-
|
77
|
+
|
78
78
|
end
|
79
|
-
|
80
|
-
|
79
|
+
|
80
|
+
|
81
81
|
#Amazon Developer Guide Docs:
|
82
82
|
#
|
83
|
-
# The DeleteSecurityGroup operation deletes a security group.
|
83
|
+
# The DeleteSecurityGroup operation deletes a security group.
|
84
84
|
#
|
85
|
-
# If an attempt is made to delete a security group and any instances exist that are members of that group a
|
85
|
+
# If an attempt is made to delete a security group and any instances exist that are members of that group a
|
86
86
|
# fault is returned.
|
87
87
|
#
|
88
88
|
#Required Arguments:
|
@@ -94,34 +94,34 @@ module EC2
|
|
94
94
|
# none
|
95
95
|
#
|
96
96
|
def delete_security_group( options = {} )
|
97
|
-
|
97
|
+
|
98
98
|
options = { :group_name => "" }.merge(options)
|
99
|
-
|
99
|
+
|
100
100
|
raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
|
101
|
-
|
101
|
+
|
102
102
|
params = { "GroupName" => options[:group_name] }
|
103
|
-
|
103
|
+
|
104
104
|
return response_generator(:action => "DeleteSecurityGroup", :params => params)
|
105
|
-
|
105
|
+
|
106
106
|
end
|
107
|
-
|
108
|
-
|
107
|
+
|
108
|
+
|
109
109
|
#Amazon Developer Guide Docs:
|
110
110
|
#
|
111
|
-
# The AuthorizeSecurityGroupIngress operation adds permissions to a security group.
|
112
|
-
#
|
113
|
-
# Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP), the source of the request (by
|
114
|
-
# IP range or an Amazon EC2 user-group pair), source and destination port ranges (for TCP and UDP),
|
115
|
-
# and ICMP codes and types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard in the
|
111
|
+
# The AuthorizeSecurityGroupIngress operation adds permissions to a security group.
|
112
|
+
#
|
113
|
+
# Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP), the source of the request (by
|
114
|
+
# IP range or an Amazon EC2 user-group pair), source and destination port ranges (for TCP and UDP),
|
115
|
+
# and ICMP codes and types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard in the
|
116
116
|
# type and code fields.
|
117
|
-
#
|
118
|
-
# Permission changes are propagated to instances within the security group being modified as quickly as
|
117
|
+
#
|
118
|
+
# Permission changes are propagated to instances within the security group being modified as quickly as
|
119
119
|
# possible. However, a small delay is likely, depending on the number of instances that are members of
|
120
120
|
# the indicated group.
|
121
|
-
#
|
122
|
-
# When authorizing a user/group pair permission, GroupName, SourceSecurityGroupName and
|
123
|
-
# SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP permission,
|
124
|
-
# GroupName, IpProtocol, FromPort, ToPort and CidrIp must be specified. Mixing these two types
|
121
|
+
#
|
122
|
+
# When authorizing a user/group pair permission, GroupName, SourceSecurityGroupName and
|
123
|
+
# SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP permission,
|
124
|
+
# GroupName, IpProtocol, FromPort, ToPort and CidrIp must be specified. Mixing these two types
|
125
125
|
# of parameters is not allowed.
|
126
126
|
#
|
127
127
|
#Required Arguments:
|
@@ -138,52 +138,52 @@ module EC2
|
|
138
138
|
# :source_security_group_owner_id => String (default : nil) : Required when authorizing user group pair permissions
|
139
139
|
#
|
140
140
|
def authorize_security_group_ingress( options = {} )
|
141
|
-
|
141
|
+
|
142
142
|
# defaults
|
143
143
|
options = { :group_name => nil,
|
144
144
|
:ip_protocol => nil,
|
145
|
-
:from_port => nil,
|
146
|
-
:to_port => nil,
|
147
|
-
:cidr_ip => nil,
|
145
|
+
:from_port => nil,
|
146
|
+
:to_port => nil,
|
147
|
+
:cidr_ip => nil,
|
148
148
|
:source_security_group_name => nil,
|
149
149
|
:source_security_group_owner_id => nil }.merge(options)
|
150
|
-
|
150
|
+
|
151
151
|
# lets not validate the rest of the possible permutations of required params and instead let
|
152
152
|
# EC2 sort it out on the server side. We'll only require :group_name as that is always needed.
|
153
153
|
raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
|
154
|
-
|
154
|
+
|
155
155
|
params = { "GroupName" => options[:group_name],
|
156
156
|
"IpProtocol" => options[:ip_protocol],
|
157
157
|
"FromPort" => options[:from_port].to_s,
|
158
|
-
"ToPort" => options[:to_port].to_s,
|
159
|
-
"CidrIp" => options[:cidr_ip],
|
158
|
+
"ToPort" => options[:to_port].to_s,
|
159
|
+
"CidrIp" => options[:cidr_ip],
|
160
160
|
"SourceSecurityGroupName" => options[:source_security_group_name],
|
161
161
|
"SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
|
162
162
|
}
|
163
|
-
|
163
|
+
|
164
164
|
return response_generator(:action => "AuthorizeSecurityGroupIngress", :params => params)
|
165
|
-
|
165
|
+
|
166
166
|
end
|
167
|
-
|
168
|
-
|
167
|
+
|
168
|
+
|
169
169
|
#Amazon Developer Guide Docs:
|
170
170
|
#
|
171
|
-
# The RevokeSecurityGroupIngress operation revokes existing permissions that were previously
|
172
|
-
# granted to a security group. The permissions to revoke must be specified using the same values
|
171
|
+
# The RevokeSecurityGroupIngress operation revokes existing permissions that were previously
|
172
|
+
# granted to a security group. The permissions to revoke must be specified using the same values
|
173
173
|
# originally used to grant the permission.
|
174
174
|
#
|
175
|
-
# Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP), the source of the request (by
|
176
|
-
# IP range or an Amazon EC2 user-group pair), source and destination port ranges (for TCP and UDP),
|
177
|
-
# and ICMP codes and types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard in the
|
175
|
+
# Permissions are specified in terms of the IP protocol (TCP, UDP or ICMP), the source of the request (by
|
176
|
+
# IP range or an Amazon EC2 user-group pair), source and destination port ranges (for TCP and UDP),
|
177
|
+
# and ICMP codes and types (for ICMP). When authorizing ICMP, -1 may be used as a wildcard in the
|
178
178
|
# type and code fields.
|
179
179
|
#
|
180
|
-
# Permission changes are propagated to instances within the security group being modified as quickly as
|
181
|
-
# possible. However, a small delay is likely, depending on the number of instances that are members of
|
180
|
+
# Permission changes are propagated to instances within the security group being modified as quickly as
|
181
|
+
# possible. However, a small delay is likely, depending on the number of instances that are members of
|
182
182
|
# the indicated group.
|
183
183
|
#
|
184
|
-
# When revoking a user/group pair permission, GroupName, SourceSecurityGroupName and
|
185
|
-
# SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP permission,
|
186
|
-
# GroupName, IpProtocol, FromPort, ToPort and CidrIp must be specified. Mixing these two types
|
184
|
+
# When revoking a user/group pair permission, GroupName, SourceSecurityGroupName and
|
185
|
+
# SourceSecurityGroupOwnerId must be specified. When authorizing a CIDR IP permission,
|
186
|
+
# GroupName, IpProtocol, FromPort, ToPort and CidrIp must be specified. Mixing these two types
|
187
187
|
# of parameters is not allowed.
|
188
188
|
#
|
189
189
|
#Required Arguments:
|
@@ -200,33 +200,33 @@ module EC2
|
|
200
200
|
# :source_security_group_owner_id => String (default : nil) : Required when revoking user group pair permissions
|
201
201
|
#
|
202
202
|
def revoke_security_group_ingress( options = {} )
|
203
|
-
|
203
|
+
|
204
204
|
# defaults
|
205
205
|
options = { :group_name => nil,
|
206
206
|
:ip_protocol => nil,
|
207
|
-
:from_port => nil,
|
208
|
-
:to_port => nil,
|
209
|
-
:cidr_ip => nil,
|
207
|
+
:from_port => nil,
|
208
|
+
:to_port => nil,
|
209
|
+
:cidr_ip => nil,
|
210
210
|
:source_security_group_name => nil,
|
211
211
|
:source_security_group_owner_id => nil }.merge(options)
|
212
|
-
|
212
|
+
|
213
213
|
# lets not validate the rest of the possible permutations of required params and instead let
|
214
214
|
# EC2 sort it out on the server side. We'll only require :group_name as that is always needed.
|
215
215
|
raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
|
216
|
-
|
216
|
+
|
217
217
|
params = { "GroupName" => options[:group_name],
|
218
218
|
"IpProtocol" => options[:ip_protocol],
|
219
219
|
"FromPort" => options[:from_port].to_s,
|
220
|
-
"ToPort" => options[:to_port].to_s,
|
221
|
-
"CidrIp" => options[:cidr_ip],
|
220
|
+
"ToPort" => options[:to_port].to_s,
|
221
|
+
"CidrIp" => options[:cidr_ip],
|
222
222
|
"SourceSecurityGroupName" => options[:source_security_group_name],
|
223
223
|
"SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
|
224
224
|
}
|
225
|
-
|
225
|
+
|
226
226
|
return response_generator(:action => "RevokeSecurityGroupIngress", :params => params)
|
227
|
-
|
227
|
+
|
228
228
|
end
|
229
|
-
|
229
|
+
|
230
230
|
end
|
231
|
-
|
231
|
+
|
232
232
|
end
|