amazon-ec2 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/ChangeLog +7 -4
  2. data/README.rdoc +12 -12
  3. data/README_dev.rdoc +6 -0
  4. data/Rakefile +2 -1
  5. data/VERSION +1 -1
  6. data/amazon-ec2.gemspec +25 -18
  7. data/bin/ec2-gem-example.rb +3 -3
  8. data/bin/ec2-gem-profile.rb +2 -2
  9. data/bin/ec2sh +4 -4
  10. data/bin/setup.rb +4 -2
  11. data/lib/{EC2.rb → AWS.rb} +33 -67
  12. data/lib/AWS/EC2.rb +67 -0
  13. data/lib/AWS/EC2/availability_zones.rb +43 -0
  14. data/lib/AWS/EC2/console.rb +46 -0
  15. data/lib/AWS/EC2/elastic_ips.rb +154 -0
  16. data/lib/AWS/EC2/image_attributes.rb +168 -0
  17. data/lib/AWS/EC2/images.rb +136 -0
  18. data/lib/AWS/EC2/instances.rb +218 -0
  19. data/lib/AWS/EC2/keypairs.rb +96 -0
  20. data/lib/AWS/EC2/products.rb +45 -0
  21. data/lib/AWS/EC2/security_groups.rb +234 -0
  22. data/lib/AWS/EC2/snapshots.rb +96 -0
  23. data/lib/AWS/EC2/volumes.rb +172 -0
  24. data/lib/AWS/ELB.rb +67 -0
  25. data/lib/AWS/ELB/load_balancers.rb +198 -0
  26. data/lib/{EC2 → AWS}/exceptions.rb +21 -2
  27. data/lib/{EC2 → AWS}/responses.rb +4 -5
  28. data/perftools/ec2prof-results.txt +4 -4
  29. data/perftools/ec2prof.symbols +4 -4
  30. data/test/test_EC2.rb +14 -14
  31. data/test/test_EC2_availability_zones.rb +2 -2
  32. data/test/test_EC2_console.rb +5 -5
  33. data/test/test_EC2_elastic_ips.rb +13 -13
  34. data/test/test_EC2_image_attributes.rb +35 -35
  35. data/test/test_EC2_images.rb +7 -7
  36. data/test/test_EC2_instances.rb +35 -35
  37. data/test/test_EC2_keypairs.rb +10 -10
  38. data/test/test_EC2_products.rb +7 -7
  39. data/test/test_EC2_responses.rb +2 -2
  40. data/test/test_EC2_s3_xmlsimple.rb +2 -2
  41. data/test/test_EC2_security_groups.rb +13 -13
  42. data/test/test_EC2_snapshots.rb +2 -2
  43. data/test/test_EC2_volumes.rb +2 -2
  44. data/test/test_ELB_load_balancers.rb +239 -0
  45. data/test/test_helper.rb +1 -1
  46. metadata +24 -17
  47. data/lib/EC2/availability_zones.rb +0 -41
  48. data/lib/EC2/console.rb +0 -44
  49. data/lib/EC2/elastic_ips.rb +0 -153
  50. data/lib/EC2/image_attributes.rb +0 -166
  51. data/lib/EC2/images.rb +0 -134
  52. data/lib/EC2/instances.rb +0 -216
  53. data/lib/EC2/keypairs.rb +0 -94
  54. data/lib/EC2/products.rb +0 -43
  55. data/lib/EC2/security_groups.rb +0 -232
  56. data/lib/EC2/snapshots.rb +0 -94
  57. data/lib/EC2/volumes.rb +0 -170
data/lib/EC2/instances.rb DELETED
@@ -1,216 +0,0 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
- module EC2
12
-
13
- class Base
14
-
15
- #Amazon Developer Guide Docs:
16
- #
17
- # The RunInstances operation launches a specified number of instances.
18
- #
19
- # Note : The Query version of RunInstances only allows instances of a single AMI to be launched in
20
- # one call. This is different from the SOAP API call of the same name but similar to the
21
- # ec2-run-instances command line tool.
22
- #
23
- # If Amazon EC2 cannot launch the minimum number AMIs you request, no instances launch. If there
24
- # is insufficient capacity to launch the maximum number of AMIs you request, Amazon EC2 launches
25
- # as many as possible to satisfy the requested maximum values.
26
- #
27
- # Every instance is launched in a security group. If you do not specify a security group at
28
- # launch, the instances start in the default security group.
29
- #
30
- # An optional instance type can be specified. Currently supported types are 'm1.small', 'm1.large',
31
- # 'm1.xlarge' and the high CPU types 'c1.medium' and 'c1.xlarge'. 'm1.small' is the default
32
- # if no instance_type is specified.
33
- #
34
- # You can provide an optional key pair ID for each image in the launch request. All instances
35
- # that are created from images that use this key pair will have access to the associated public
36
- # key at boot. You can use this key to provide secure access to an instance of an image on a
37
- # per-instance basis. Amazon EC2 public images use this feature to provide secure access
38
- # without passwords.
39
- #
40
- # Important! Launching public images without a key pair ID will leave them inaccessible.
41
- #
42
- # The public key material is made available to the instance at boot time by placing it in a file named
43
- # openssh_id.pub on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
44
- # store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
45
- # OpenSSH format). This can be done at boot time (as part of rclocal, for example) allowing for secure
46
- # password-less access.
47
- #
48
- # Optional user data can be provided in the launch request. All instances comprising the launch
49
- # request have access to this data (see Instance Metadata for details).
50
- #
51
- # If any of the AMIs have product codes attached for which the user has not subscribed,
52
- # the RunInstances call will fail.
53
- #
54
- #Required Arguments:
55
- #
56
- # :image_id => String (Default : "")
57
- # :min_count => Integer (default : 1 )
58
- # :max_count => Integer (default : 1 )
59
- #
60
- #Optional Arguments:
61
- #
62
- # :key_name => String (default : nil)
63
- # :group_id => Array (default : [])
64
- # :user_data => String (default : nil)
65
- # :addressing_type => String (default : "public")
66
- # :instance_type => String (default : "m1.small")
67
- # :kernel_id => String (default : nil)
68
- # :availability_zone => String (default : nil)
69
- # :base64_encoded => Boolean (default : false)
70
- #
71
- def run_instances( options = {} )
72
-
73
- options = { :image_id => "",
74
- :min_count => 1,
75
- :max_count => 1,
76
- :key_name => nil,
77
- :group_id => [],
78
- :user_data => nil,
79
- :addressing_type => "public",
80
- :instance_type => "m1.small",
81
- :kernel_id => nil,
82
- :availability_zone => nil,
83
- :base64_encoded => false }.merge(options)
84
-
85
- # Do some validation on the arguments provided
86
- raise ArgumentError, ":image_id must be provided" if options[:image_id].nil? || options[:image_id].empty?
87
- raise ArgumentError, ":min_count is not valid" unless options[:min_count].to_i > 0
88
- raise ArgumentError, ":max_count is not valid" unless options[:max_count].to_i > 0
89
- raise ArgumentError, ":addressing_type must be 'direct' or 'public'" unless options[:addressing_type] == "public" || options[:addressing_type] == "direct"
90
- raise ArgumentError, ":instance_type must be 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', or 'c1.xlarge'" unless options[:instance_type] == "m1.small" || options[:instance_type] == "m1.large" || options[:instance_type] == "m1.xlarge" || options[:instance_type] == "c1.medium" || options[:instance_type] == "c1.xlarge"
91
- raise ArgumentError, ":base64_encoded must be 'true' or 'false'" unless options[:base64_encoded] == true || options[:base64_encoded] == false
92
-
93
- user_data = extract_user_data(options)
94
-
95
- params = {
96
- "ImageId" => options[:image_id],
97
- "MinCount" => options[:min_count].to_s,
98
- "MaxCount" => options[:max_count].to_s,
99
- }.merge(pathlist("SecurityGroup", options[:group_id]))
100
-
101
- params["KeyName"] = options[:key_name] unless options[:key_name].nil?
102
- params["UserData"] = user_data unless user_data.nil?
103
- params["AddressingType"] = options[:addressing_type]
104
- params["InstanceType"] = options[:instance_type]
105
- params["KernelId"] = options[:kernel_id] unless options[:kernel_id].nil?
106
- params["Placement.AvailabilityZone"] = options[:availability_zone] unless options[:availability_zone].nil?
107
-
108
- return response_generator(:action => "RunInstances", :params => params)
109
-
110
- end
111
-
112
- # If :user_data is passed in then URL escape and Base64 encode it
113
- # as needed. Need for URL Escape + Base64 encoding is determined
114
- # by :base64_encoded param.
115
- def extract_user_data(options)
116
- return unless options[:user_data]
117
- if options[:user_data]
118
- if options[:base64_encoded]
119
- Base64.encode64(options[:user_data]).gsub(/\n/,"").strip()
120
- else
121
- options[:user_data]
122
- end
123
- end
124
- end
125
-
126
-
127
- #Amazon Developer Guide Docs:
128
- #
129
- # The DescribeInstances operation returns information about instances owned by the user
130
- # making the request.
131
- #
132
- # An optional list of instance IDs may be provided to request information for those instances only. If no
133
- # instance IDs are provided, information of all relevant instances information will be returned. If an
134
- # instance is specified that does not exist a fault is returned. If an instance is specified that exists but is not
135
- # owned by the user making the request, then that instance will not be included in the returned results.
136
- #
137
- # Recently terminated instances will be included in the returned results for a small interval subsequent to
138
- # their termination. This interval is typically of the order of one hour
139
- #
140
- #Required Arguments:
141
- #
142
- # none
143
- #
144
- #Optional Arguments:
145
- #
146
- # :instance_id => Array (default : [])
147
- #
148
- def describe_instances( options = {} )
149
-
150
- options = { :instance_id => [] }.merge(options)
151
-
152
- params = pathlist("InstanceId", options[:instance_id])
153
-
154
- return response_generator(:action => "DescribeInstances", :params => params)
155
-
156
- end
157
-
158
-
159
- #Amazon Developer Guide Docs:
160
- #
161
- # The RebootInstances operation requests a reboot of one or more instances. This operation is
162
- # asynchronous; it only queues a request to reboot the specified instance(s). The operation will succeed
163
- # provided the instances are valid and belong to the user. Terminated instances will be ignored.
164
- #
165
- #Required Arguments:
166
- #
167
- # :instance_id => Array (default : [])
168
- #
169
- #Optional Arguments:
170
- #
171
- # none
172
- #
173
- def reboot_instances( options = {} )
174
-
175
- # defaults
176
- options = { :instance_id => [] }.merge(options)
177
-
178
- raise ArgumentError, "No instance IDs provided" if options[:instance_id].nil? || options[:instance_id].empty?
179
-
180
- params = pathlist("InstanceId", options[:instance_id])
181
-
182
- return response_generator(:action => "RebootInstances", :params => params)
183
-
184
- end
185
-
186
-
187
- #Amazon Developer Guide Docs:
188
- #
189
- # The TerminateInstances operation shuts down one or more instances. This operation is idempotent
190
- # and terminating an instance that is in the process of shutting down (or already terminated) will succeed.
191
- # Terminated instances remain visible for a short period of time (approximately one hour) after
192
- # termination, after which their instance ID is invalidated.
193
- #
194
- #Required Arguments:
195
- #
196
- # :instance_id => Array (default : [])
197
- #
198
- #Optional Arguments:
199
- #
200
- # none
201
- #
202
- def terminate_instances( options = {} )
203
-
204
- options = { :instance_id => [] }.merge(options)
205
-
206
- raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
207
-
208
- params = pathlist("InstanceId", options[:instance_id])
209
-
210
- return response_generator(:action => "TerminateInstances", :params => params)
211
-
212
- end
213
-
214
- end
215
-
216
- end
data/lib/EC2/keypairs.rb DELETED
@@ -1,94 +0,0 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
- module EC2
12
-
13
- class Base
14
-
15
-
16
- #Amazon Developer Guide Docs:
17
- #
18
- # The CreateKeyPair operation creates a new 2048 bit RSA keypair and returns a unique ID that can be
19
- # used to reference this keypair when launching new instances.
20
- #
21
- #Required Arguments:
22
- #
23
- # :key_name => String (default : "")
24
- #
25
- #Optional Arguments:
26
- #
27
- # none
28
- #
29
- def create_keypair( options = {} )
30
-
31
- # defaults
32
- options = { :key_name => "" }.merge(options)
33
-
34
- raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
35
-
36
- params = { "KeyName" => options[:key_name] }
37
-
38
- return response_generator(:action => "CreateKeyPair", :params => params)
39
-
40
- end
41
-
42
-
43
- #Amazon Developer Guide Docs:
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
47
- # all registered keypairs is required.
48
- #
49
- #Required Arguments:
50
- #
51
- # :key_name => Array (default : [])
52
- #
53
- #Optional Arguments:
54
- #
55
- # none
56
- #
57
- def describe_keypairs( options = {} )
58
-
59
- options = { :key_name => [] }.merge(options)
60
-
61
- params = pathlist("KeyName", options[:key_name] )
62
-
63
- return response_generator(:action => "DescribeKeyPairs", :params => params)
64
-
65
- end
66
-
67
-
68
- #Amazon Developer Guide Docs:
69
- #
70
- # The DeleteKeyPair operation deletes a keypair.
71
- #
72
- #Required Arguments:
73
- #
74
- # :key_name => String (default : "")
75
- #
76
- #Optional Arguments:
77
- #
78
- # none
79
- #
80
- def delete_keypair( options = {} )
81
-
82
- options = { :key_name => "" }.merge(options)
83
-
84
- raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
85
-
86
- params = { "KeyName" => options[:key_name] }
87
-
88
- return response_generator(:action => "DeleteKeyPair", :params => params)
89
-
90
- end
91
-
92
- end
93
-
94
- end
data/lib/EC2/products.rb DELETED
@@ -1,43 +0,0 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
- module EC2
12
-
13
- class Base
14
-
15
- #Amazon Developer Guide Docs:
16
- #
17
- # The ConfirmProductInstance operation returns true if the given product code is attached to the instance
18
- # with the given instance id. False is returned if the product code is not attached to the instance.
19
- #
20
- #Required Arguments:
21
- #
22
- # :product_code => String (default : "")
23
- # :instance_id => String (default : "")
24
- #
25
- #Optional Arguments:
26
- #
27
- # none
28
- #
29
- def confirm_product_instance( options ={} )
30
-
31
- options = {:product_code => "", :instance_id => ""}.merge(options)
32
-
33
- raise ArgumentError, "No product code provided" if options[:product_code].nil? || options[:product_code].empty?
34
- raise ArgumentError, "No instance ID provided" if options[:instance_id].nil? || options[:instance_id].empty?
35
-
36
- params = { "ProductCode" => options[:product_code], "InstanceId" => options[:instance_id] }
37
-
38
- return response_generator(:action => "ConfirmProductInstance", :params => params)
39
-
40
- end
41
- end
42
-
43
- end
@@ -1,232 +0,0 @@
1
- #--
2
- # Amazon Web Services EC2 Query API Ruby library
3
- #
4
- # Ruby Gem Name:: amazon-ec2
5
- # Author:: Glenn Rempe (mailto:glenn@rempe.us)
6
- # Copyright:: Copyright (c) 2007-2008 Glenn Rempe
7
- # License:: Distributes under the same terms as Ruby
8
- # Home:: http://github.com/grempe/amazon-ec2/tree/master
9
- #++
10
-
11
- module EC2
12
-
13
- class Base
14
-
15
-
16
- #Amazon Developer Guide Docs:
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
23
- # permissions using the AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress operations.
24
- #
25
- #Required Arguments:
26
- #
27
- # :group_name => String (default : "")
28
- # :group_description => String (default : "")
29
- #
30
- #Optional Arguments:
31
- #
32
- # none
33
- #
34
- def create_security_group( options = {} )
35
-
36
- options = {:group_name => "",
37
- :group_description => ""
38
- }.merge(options)
39
-
40
- raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
41
- raise ArgumentError, "No :group_description provided" if options[:group_description].nil? || options[:group_description].empty?
42
-
43
- params = {
44
- "GroupName" => options[:group_name],
45
- "GroupDescription" => options[:group_description]
46
- }
47
-
48
- return response_generator(:action => "CreateSecurityGroup", :params => params)
49
-
50
- end
51
-
52
-
53
- #Amazon Developer Guide Docs:
54
- #
55
- # The DescribeSecurityGroups operation returns information about security groups owned by the
56
- # user making the request.
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
60
- # returned. If a group is specified that does not exist a fault is returned.
61
- #
62
- #Required Arguments:
63
- #
64
- # none
65
- #
66
- #Optional Arguments:
67
- #
68
- # :group_name => Array (default : [])
69
- #
70
- def describe_security_groups( options = {} )
71
-
72
- options = { :group_name => [] }.merge(options)
73
-
74
- params = pathlist("GroupName", options[:group_name] )
75
-
76
- return response_generator(:action => "DescribeSecurityGroups", :params => params)
77
-
78
- end
79
-
80
-
81
- #Amazon Developer Guide Docs:
82
- #
83
- # The DeleteSecurityGroup operation deletes a security group.
84
- #
85
- # If an attempt is made to delete a security group and any instances exist that are members of that group a
86
- # fault is returned.
87
- #
88
- #Required Arguments:
89
- #
90
- # :group_name => String (default : "")
91
- #
92
- #Optional Arguments:
93
- #
94
- # none
95
- #
96
- def delete_security_group( options = {} )
97
-
98
- options = { :group_name => "" }.merge(options)
99
-
100
- raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
101
-
102
- params = { "GroupName" => options[:group_name] }
103
-
104
- return response_generator(:action => "DeleteSecurityGroup", :params => params)
105
-
106
- end
107
-
108
-
109
- #Amazon Developer Guide Docs:
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
116
- # type and code fields.
117
- #
118
- # Permission changes are propagated to instances within the security group being modified as quickly as
119
- # possible. However, a small delay is likely, depending on the number of instances that are members of
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
125
- # of parameters is not allowed.
126
- #
127
- #Required Arguments:
128
- #
129
- # :group_name => String (default : "")
130
- #
131
- #Optional Arguments:
132
- #
133
- # :ip_protocol => String (default : nil) : Required when authorizing CIDR IP permission
134
- # :from_port => Integer (default : nil) : Required when authorizing CIDR IP permission
135
- # :to_port => Integer (default : nil) : Required when authorizing CIDR IP permission
136
- # :cidr_ip => String (default : nil): Required when authorizing CIDR IP permission
137
- # :source_security_group_name => String (default : nil) : Required when authorizing user group pair permissions
138
- # :source_security_group_owner_id => String (default : nil) : Required when authorizing user group pair permissions
139
- #
140
- def authorize_security_group_ingress( options = {} )
141
-
142
- # defaults
143
- options = { :group_name => nil,
144
- :ip_protocol => nil,
145
- :from_port => nil,
146
- :to_port => nil,
147
- :cidr_ip => nil,
148
- :source_security_group_name => nil,
149
- :source_security_group_owner_id => nil }.merge(options)
150
-
151
- # lets not validate the rest of the possible permutations of required params and instead let
152
- # EC2 sort it out on the server side. We'll only require :group_name as that is always needed.
153
- raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
154
-
155
- params = { "GroupName" => options[:group_name],
156
- "IpProtocol" => options[:ip_protocol],
157
- "FromPort" => options[:from_port].to_s,
158
- "ToPort" => options[:to_port].to_s,
159
- "CidrIp" => options[:cidr_ip],
160
- "SourceSecurityGroupName" => options[:source_security_group_name],
161
- "SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
162
- }
163
-
164
- return response_generator(:action => "AuthorizeSecurityGroupIngress", :params => params)
165
-
166
- end
167
-
168
-
169
- #Amazon Developer Guide Docs:
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
173
- # originally used to grant the permission.
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
178
- # type and code fields.
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
182
- # the indicated group.
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
187
- # of parameters is not allowed.
188
- #
189
- #Required Arguments:
190
- #
191
- # :group_name => String (default : "")
192
- #
193
- #Optional Arguments:
194
- #
195
- # :ip_protocol => String (default : nil) : Required when revoking CIDR IP permission
196
- # :from_port => Integer (default : nil) : Required when revoking CIDR IP permission
197
- # :to_port => Integer (default : nil) : Required when revoking CIDR IP permission
198
- # :cidr_ip => String (default : nil): Required when revoking CIDR IP permission
199
- # :source_security_group_name => String (default : nil) : Required when revoking user group pair permissions
200
- # :source_security_group_owner_id => String (default : nil) : Required when revoking user group pair permissions
201
- #
202
- def revoke_security_group_ingress( options = {} )
203
-
204
- # defaults
205
- options = { :group_name => nil,
206
- :ip_protocol => nil,
207
- :from_port => nil,
208
- :to_port => nil,
209
- :cidr_ip => nil,
210
- :source_security_group_name => nil,
211
- :source_security_group_owner_id => nil }.merge(options)
212
-
213
- # lets not validate the rest of the possible permutations of required params and instead let
214
- # EC2 sort it out on the server side. We'll only require :group_name as that is always needed.
215
- raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
216
-
217
- params = { "GroupName" => options[:group_name],
218
- "IpProtocol" => options[:ip_protocol],
219
- "FromPort" => options[:from_port].to_s,
220
- "ToPort" => options[:to_port].to_s,
221
- "CidrIp" => options[:cidr_ip],
222
- "SourceSecurityGroupName" => options[:source_security_group_name],
223
- "SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
224
- }
225
-
226
- return response_generator(:action => "RevokeSecurityGroupIngress", :params => params)
227
-
228
- end
229
-
230
- end
231
-
232
- end