amazon-ec2 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,5 @@
1
1
  module AWS
2
2
  module EC2
3
-
4
3
  class Base < AWS::Base
5
4
 
6
5
 
@@ -10,15 +9,10 @@ module AWS
10
9
  # @option options [String] :key_name ("")
11
10
  #
12
11
  def create_keypair( options = {} )
13
-
14
12
  options = { :key_name => "" }.merge(options)
15
-
16
13
  raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
17
-
18
14
  params = { "KeyName" => options[:key_name] }
19
-
20
15
  return response_generator(:action => "CreateKeyPair", :params => params)
21
-
22
16
  end
23
17
 
24
18
 
@@ -29,13 +23,9 @@ module AWS
29
23
  # @option options [Array] :key_name ([])
30
24
  #
31
25
  def describe_keypairs( options = {} )
32
-
33
26
  options = { :key_name => [] }.merge(options)
34
-
35
27
  params = pathlist("KeyName", options[:key_name] )
36
-
37
28
  return response_generator(:action => "DescribeKeyPairs", :params => params)
38
-
39
29
  end
40
30
 
41
31
 
@@ -44,18 +34,14 @@ module AWS
44
34
  # @option options [String] :key_name ("")
45
35
  #
46
36
  def delete_keypair( options = {} )
47
-
48
37
  options = { :key_name => "" }.merge(options)
49
-
50
38
  raise ArgumentError, "No :key_name provided" if options[:key_name].nil? || options[:key_name].empty?
51
-
52
39
  params = { "KeyName" => options[:key_name] }
53
-
54
40
  return response_generator(:action => "DeleteKeyPair", :params => params)
55
-
56
41
  end
57
42
 
58
- end
59
43
 
44
+ end
60
45
  end
61
- end
46
+ end
47
+
@@ -2,6 +2,7 @@ module AWS
2
2
  module EC2
3
3
  class Base < AWS::Base
4
4
 
5
+
5
6
  # The CreateSecurityGroup operation creates a new security group. Every instance is launched
6
7
  # in a security group. If none is specified as part of the launch request then instances
7
8
  # are launched in the default security group. Instances within the same security group have
@@ -13,21 +14,16 @@ module AWS
13
14
  # @option options [String] :group_description ("")
14
15
  #
15
16
  def create_security_group( options = {} )
16
-
17
17
  options = {:group_name => "",
18
18
  :group_description => ""
19
19
  }.merge(options)
20
-
21
20
  raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
22
21
  raise ArgumentError, "No :group_description provided" if options[:group_description].nil? || options[:group_description].empty?
23
-
24
22
  params = {
25
23
  "GroupName" => options[:group_name],
26
24
  "GroupDescription" => options[:group_description]
27
25
  }
28
-
29
26
  return response_generator(:action => "CreateSecurityGroup", :params => params)
30
-
31
27
  end
32
28
 
33
29
 
@@ -41,13 +37,9 @@ module AWS
41
37
  # @option options [optional, Array] :group_name ([])
42
38
  #
43
39
  def describe_security_groups( options = {} )
44
-
45
40
  options = { :group_name => [] }.merge(options)
46
-
47
41
  params = pathlist("GroupName", options[:group_name] )
48
-
49
42
  return response_generator(:action => "DescribeSecurityGroups", :params => params)
50
-
51
43
  end
52
44
 
53
45
 
@@ -59,15 +51,10 @@ module AWS
59
51
  # @option options [String] :group_name ("")
60
52
  #
61
53
  def delete_security_group( options = {} )
62
-
63
54
  options = { :group_name => "" }.merge(options)
64
-
65
55
  raise ArgumentError, "No :group_name provided" if options[:group_name].nil? || options[:group_name].empty?
66
-
67
56
  params = { "GroupName" => options[:group_name] }
68
-
69
57
  return response_generator(:action => "DeleteSecurityGroup", :params => params)
70
-
71
58
  end
72
59
 
73
60
 
@@ -96,8 +83,6 @@ module AWS
96
83
  # @option options [optional, String] :source_security_group_owner_id (nil) Required when authorizing user group pair permissions
97
84
  #
98
85
  def authorize_security_group_ingress( options = {} )
99
-
100
- # defaults
101
86
  options = { :group_name => nil,
102
87
  :ip_protocol => nil,
103
88
  :from_port => nil,
@@ -118,9 +103,7 @@ module AWS
118
103
  "SourceSecurityGroupName" => options[:source_security_group_name],
119
104
  "SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
120
105
  }
121
-
122
106
  return response_generator(:action => "AuthorizeSecurityGroupIngress", :params => params)
123
-
124
107
  end
125
108
 
126
109
 
@@ -151,8 +134,6 @@ module AWS
151
134
  # @option options [optional, String] :source_security_group_owner_id (nil) Required when revoking user group pair permissions
152
135
  #
153
136
  def revoke_security_group_ingress( options = {} )
154
-
155
- # defaults
156
137
  options = { :group_name => nil,
157
138
  :ip_protocol => nil,
158
139
  :from_port => nil,
@@ -173,11 +154,11 @@ module AWS
173
154
  "SourceSecurityGroupName" => options[:source_security_group_name],
174
155
  "SourceSecurityGroupOwnerId" => options[:source_security_group_owner_id]
175
156
  }
176
-
177
157
  return response_generator(:action => "RevokeSecurityGroupIngress", :params => params)
178
-
179
158
  end
180
159
 
160
+
181
161
  end
182
162
  end
183
- end
163
+ end
164
+
@@ -3,36 +3,29 @@ module AWS
3
3
 
4
4
  class Base < AWS::Base
5
5
 
6
+
6
7
  # The DescribeSnapshots operation describes the status of Amazon EBS snapshots.
7
8
  #
8
9
  # @option options [Array] :snapshot_id ([])
9
10
  #
10
11
  def describe_snapshots( options = {} )
11
-
12
12
  options = { :snapshot_id => [] }.merge(options)
13
-
14
13
  params = pathlist("SnapshotId", options[:snapshot_id] )
15
-
16
14
  return response_generator(:action => "DescribeSnapshots", :params => params)
17
-
18
15
  end
19
16
 
17
+
20
18
  # The CreateSnapshot operation creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots for backups, to launch instances from identical snapshots, and to save data before shutting down an instance.
21
19
  #
22
20
  # @option options [String] :volume_id ('')
23
21
  #
24
22
  def create_snapshot( options = {} )
25
-
26
23
  options = { :volume_id => '' }.merge(options)
27
-
28
24
  raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
29
-
30
25
  params = {
31
26
  "VolumeId" => options[:volume_id]
32
27
  }
33
-
34
28
  return response_generator(:action => "CreateSnapshot", :params => params)
35
-
36
29
  end
37
30
 
38
31
 
@@ -41,19 +34,43 @@ module AWS
41
34
  # @option options [String] :snapshot_id ('')
42
35
  #
43
36
  def delete_snapshot( options = {} )
44
-
45
37
  options = { :snapshot_id => '' }.merge(options)
46
-
47
38
  raise ArgumentError, "No :snapshot_id provided" if options[:snapshot_id].nil? || options[:snapshot_id].empty?
48
-
49
39
  params = {
50
40
  "SnapshotId" => options[:snapshot_id]
51
41
  }
52
-
53
42
  return response_generator(:action => "DeleteSnapshot", :params => params)
43
+ end
54
44
 
45
+
46
+ # Not yet implemented
47
+ #
48
+ # @todo Implement this method
49
+ #
50
+ def describe_snapshot_attribute( options = {} )
51
+ raise "Not yet implemented"
52
+ end
53
+
54
+
55
+ # Not yet implemented
56
+ #
57
+ # @todo Implement this method
58
+ #
59
+ def modify_snapshot_attribute( options = {} )
60
+ raise "Not yet implemented"
55
61
  end
56
62
 
63
+
64
+ # Not yet implemented
65
+ #
66
+ # @todo Implement this method
67
+ #
68
+ def reset_snapshot_attribute( options = {} )
69
+ raise "Not yet implemented"
70
+ end
71
+
72
+
57
73
  end
58
74
  end
59
- end
75
+ end
76
+
@@ -2,6 +2,7 @@ module AWS
2
2
  module EC2
3
3
  class Base < AWS::Base
4
4
 
5
+
5
6
  # The DescribeVolumes operation lists one or more Amazon EBS volumes that you own, If you do not specify any volumes, Amazon EBS returns all volumes that you own.
6
7
  #
7
8
  # @option options [optional, String] :volume_id ([])
@@ -12,6 +13,7 @@ module AWS
12
13
  return response_generator(:action => "DescribeVolumes", :params => params)
13
14
  end
14
15
 
16
+
15
17
  # The CreateVolume operation creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.
16
18
  #
17
19
  # @option options [String] :availability_zone ('')
@@ -19,43 +21,33 @@ module AWS
19
21
  # @option options [optional, String] :snapshot_id ('')
20
22
  #
21
23
  def create_volume( options = {} )
22
-
23
- # defaults
24
24
  options = { :availability_zone => '' }.merge(options)
25
-
26
25
  raise ArgumentError, "No :availability_zone provided" if options[:availability_zone].nil? || options[:availability_zone].empty?
27
-
28
26
  options = { :size => '' }.merge(options)
29
27
  options = { :snapshot_id => '' }.merge(options)
30
-
31
28
  params = {
32
29
  "AvailabilityZone" => options[:availability_zone],
33
30
  "Size" => options[:size],
34
31
  "SnapshotId" => options[:snapshot_id]
35
32
  }
36
-
37
33
  return response_generator(:action => "CreateVolume", :params => params)
38
-
39
34
  end
40
35
 
36
+
41
37
  # The DeleteVolume operation deletes an Amazon EBS volume.
42
38
  #
43
39
  # @option options [String] :volume_id ('')
44
40
  #
45
41
  def delete_volume( options = {} )
46
-
47
42
  options = { :volume_id => '' }.merge(options)
48
-
49
43
  raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
50
-
51
44
  params = {
52
45
  "VolumeId" => options[:volume_id]
53
46
  }
54
-
55
47
  return response_generator(:action => "DeleteVolume", :params => params)
56
-
57
48
  end
58
49
 
50
+
59
51
  # The AttachVolume operation attaches an Amazon EBS volume to an instance.
60
52
  #
61
53
  # @option options [String] :volume_id ('')
@@ -63,11 +55,9 @@ module AWS
63
55
  # @option options [String] :device ('')
64
56
  #
65
57
  def attach_volume( options = {} )
66
-
67
58
  options = { :volume_id => '' }.merge(options)
68
59
  options = { :instance_id => '' }.merge(options)
69
60
  options = { :device => '' }.merge(options)
70
-
71
61
  raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
72
62
  raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
73
63
  raise ArgumentError, "No :device provided" if options[:device].nil? || options[:device].empty?
@@ -77,11 +67,10 @@ module AWS
77
67
  "InstanceId" => options[:instance_id],
78
68
  "Device" => options[:device]
79
69
  }
80
-
81
70
  return response_generator(:action => "AttachVolume", :params => params)
82
-
83
71
  end
84
72
 
73
+
85
74
  # The DetachVolume operation detaches an Amazon EBS volume from an instance.
86
75
  #
87
76
  # @option options [String] :volume_id ('')
@@ -90,25 +79,21 @@ module AWS
90
79
  # @option options [optional, Boolean] :force ('')
91
80
  #
92
81
  def detach_volume( options = {} )
93
-
94
82
  options = { :volume_id => '' }.merge(options)
95
-
96
83
  raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
97
-
98
84
  options = { :instance_id => '' }.merge(options)
99
85
  options = { :device => '' }.merge(options)
100
86
  options = { :force => '' }.merge(options)
101
-
102
87
  params = {
103
88
  "VolumeId" => options[:volume_id],
104
89
  "InstanceId" => options[:instance_id],
105
90
  "Device" => options[:device],
106
91
  "Force" => options[:force]
107
92
  }
108
-
109
93
  return response_generator(:action => "DetachVolume", :params => params)
110
94
  end
111
95
 
96
+
112
97
  end
113
98
  end
114
99
  end
@@ -1,8 +1,8 @@
1
1
  #--
2
- # AWS EC2 CLIENT ERROR CODES
3
- # AWS EC2 can throw error exceptions that contain a '.' in them.
2
+ # AWS ERROR CODES
3
+ # AWS can throw error exceptions that contain a '.' in them.
4
4
  # since we can't name an exception class with that '.' I compressed
5
- # each class name into the non-dot version. This allows us to retain
5
+ # each class name into the non-dot version which allows us to retain
6
6
  # the granularity of the exception.
7
7
  #++
8
8
 
@@ -14,17 +14,26 @@ module AWS
14
14
  # CLIENT : A client side argument error
15
15
  class ArgumentError < Error; end
16
16
 
17
+ # Elastic Compute Cloud
18
+ ############################
19
+
20
+ # EC2 : User has the maximum number of allowed IP addresses.
21
+ class AddressLimitExceeded < Error; end
22
+
23
+ # EC2 : The limit on the number of Amazon EBS volumes attached to one instance has been exceeded.
24
+ class AttachmentLimitExceeded < Error; end
25
+
17
26
  # EC2 : User not authorized.
18
27
  class AuthFailure < Error; end
19
28
 
20
- # EC2 : Invalid AWS Account
21
- class InvalidClientTokenId < Error; end
29
+ # EC2 : Volume is in incorrect state
30
+ class IncorrectState < Error; end
22
31
 
23
- # EC2 : Invalid Parameters for Value
24
- class InvalidParameterValue < Error; end
32
+ # EC2 : User has max allowed concurrent running instances.
33
+ class InstanceLimitExceeded < Error; end
25
34
 
26
- # EC2 : Specified AMI has an unparsable manifest.
27
- class InvalidManifest < Error; end
35
+ # EC2 : The value of an item added to, or removed from, an image attribute is invalid.
36
+ class InvalidAMIAttributeItemValue < Error; end
28
37
 
29
38
  # EC2 : Specified AMI ID is not valid.
30
39
  class InvalidAMIIDMalformed < Error; end
@@ -35,6 +44,12 @@ module AWS
35
44
  # EC2 : Specified AMI ID has been deregistered and is no longer available.
36
45
  class InvalidAMIIDUnavailable < Error; end
37
46
 
47
+ # EC2 : The instance cannot detach from a volume to which it is not attached.
48
+ class InvalidAttachmentNotFound < Error; end
49
+
50
+ # EC2 : The device to which you are trying to attach (i.e. /dev/sdh) is already in use on the instance.
51
+ class InvalidDeviceInUse < Error; end
52
+
38
53
  # EC2 : Specified instance ID is not valid.
39
54
  class InvalidInstanceIDMalformed < Error; end
40
55
 
@@ -59,6 +74,15 @@ module AWS
59
74
  # EC2 : Specified group name is a reserved name.
60
75
  class InvalidGroupReserved < Error; end
61
76
 
77
+ # EC2 : Specified AMI has an unparsable manifest.
78
+ class InvalidManifest < Error; end
79
+
80
+ # EC2 : RunInstances was called with minCount and maxCount set to 0 or minCount > maxCount.
81
+ class InvalidParameterCombination < Error; end
82
+
83
+ # EC2 : The value supplied for a parameter was invalid.
84
+ class InvalidParameterValue < Error; end
85
+
62
86
  # EC2 : Attempt to authorize a permission that has already been authorized.
63
87
  class InvalidPermissionDuplicate < Error; end
64
88
 
@@ -71,22 +95,79 @@ module AWS
71
95
  # EC2 : Specified reservation ID does not exist.
72
96
  class InvalidReservationIDNotFound < Error; end
73
97
 
74
- # EC2 : User has reached max allowed concurrent running instances.
75
- class InstanceLimitExceeded < Error; end
98
+ # EC2 : The snapshot ID that was passed as an argument was malformed.
99
+ class InvalidSnapshotIDMalformed < Error; end
76
100
 
77
- # EC2 : An invalid set of parameters were passed as arguments
78
- class InvalidParameterCombination < Error; end
79
-
80
- # EC2 : An unknown parameter was passed as an argument
81
- class UnknownParameter < Error; end
101
+ # EC2 : The specified snapshot does not exist.
102
+ class InvalidSnapshotIDNotFound < Error; end
82
103
 
83
104
  # EC2 : The user ID is neither in the form of an AWS account ID or one
84
105
  # of the special values accepted by the owner or executableBy flags
85
106
  # in the DescribeImages call.
86
107
  class InvalidUserIDMalformed < Error; end
87
108
 
88
- # EC2 : The value of an item added to, or removed from, an image attribute is invalid.
89
- class InvalidAMIAttributeItemValue < Error; end
109
+ # EC2 : Reserved Instances ID not found.
110
+ class InvalidReservedInstancesId < Error; end
111
+
112
+ # EC2 : Reserved Instances Offering ID not found.
113
+ class InvalidReservedInstancesOfferingId < Error; end
114
+
115
+ # EC2 : The volume ID that was passed as an argument was malformed.
116
+ class InvalidVolumeIDMalformed < Error; end
117
+
118
+ # EC2 : The volume specified does not exist.
119
+ class InvalidVolumeIDNotFound < Error; end
120
+
121
+ # EC2 : The volume already exists in the system.
122
+ class InvalidVolumeIDDuplicate < Error; end
123
+
124
+ # EC2 : The specified volume ID and instance ID are in different Availability Zones.
125
+ class InvalidVolumeIDZoneMismatch < Error; end
126
+
127
+ # EC2 : The zone specified does not exist.
128
+ class InvalidZoneNotFound < Error; end
129
+
130
+ # EC2 : Insufficient Reserved Instances capacity.
131
+ class InsufficientReservedInstancesCapacity < Error; end
132
+
133
+ # EC2 : The instance specified does not support EBS.
134
+ class NonEBSInstance < Error; end
135
+
136
+ # EC2 : The limit on the number of Amazon EBS snapshots in the pending state has been exceeded.
137
+ class PendingSnapshotLimitExceeded < Error; end
138
+
139
+ # EC2 : Your current quota does not allow you to purchase the required number of reserved instances.
140
+ class ReservedInstancesLimitExceeded < Error; end
141
+
142
+ # EC2 : The limit on the number of Amazon EBS snapshots has been exceeded.
143
+ class SnapshotLimitExceeded < Error; end
144
+
145
+ # EC2 : An unknown parameter was passed as an argument
146
+ class UnknownParameter < Error; end
147
+
148
+ # EC2 : The limit on the number of Amazon EBS volumes has been exceeded.
149
+ class VolumeLimitExceeded < Error; end
150
+
151
+ # Server Error Codes
152
+ ###
153
+
154
+ # Server : Internal Error.
155
+ class InternalError < Error; end
156
+
157
+ # Server : Not enough available addresses to satisfy your minimum request.
158
+ class InsufficientAddressCapacity < Error; end
159
+
160
+ # Server : There are not enough available instances to satisfy your minimum request.
161
+ class InsufficientInstanceCapacity < Error; end
162
+
163
+ # Server : There are not enough available reserved instances to satisfy your minimum request.
164
+ class InsufficientReservedInstanceCapacity < Error; end
165
+
166
+ # Server : The server is overloaded and cannot handle the request.
167
+ class Unavailable < Error; end
168
+
169
+ # Elastic Load Balancer
170
+ ############################
90
171
 
91
172
  # ELB : The Load balancer specified was not found.
92
173
  class LoadBalancerNotFound < Error; end
@@ -106,14 +187,11 @@ module AWS
106
187
  # ELB :
107
188
  class InvalidConfigurationRequest < Error; end
108
189
 
109
- # Server : Internal AWS EC2 Error.
110
- class InternalError < Error; end
111
-
112
- # Server : There are not enough available instances to satisfy your minimum request.
113
- class InsufficientInstanceCapacity < Error; end
190
+ # API Errors
191
+ ############################
114
192
 
115
- # Server : The server is overloaded and cannot handle the request.
116
- class Unavailable < Error; end
193
+ # Server : Invalid AWS Account
194
+ class InvalidClientTokenId < Error; end
117
195
 
118
196
  # Server : The provided signature does not match.
119
197
  class SignatureDoesNotMatch < Error; end