poolparty 1.4.6 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/bin/cloud-contract +6 -1
- data/bin/cloud-list +5 -6
- data/bin/cloud-vnc +39 -0
- data/examples/rds_cloud.rb +44 -0
- data/lib/cloud_providers/connections.rb +0 -1
- data/lib/cloud_providers/ec2/ec2.rb +86 -25
- data/lib/cloud_providers/ec2/ec2_instance.rb +6 -2
- data/lib/cloud_providers/ec2/helpers/ec2_helper.rb +19 -6
- data/lib/cloud_providers/ec2/helpers/elastic_load_balancer.rb +3 -3
- data/lib/cloud_providers/ec2/helpers/rds_instance.rb +110 -0
- data/lib/cloud_providers/remote_instance.rb +5 -3
- data/lib/poolparty/cloud.rb +8 -3
- data/lib/poolparty/pool.rb +12 -0
- data/test/fixtures/clouds/rds_cloud.rb +14 -0
- data/test/fixtures/clouds/rds_missing_params.rb +11 -0
- data/test/fixtures/ec2/ec2-describe-security-groups_response_body.xml +23 -0
- data/test/fixtures/ec2/rds-describe-db-instances-empty_response_body.xml +9 -0
- data/test/lib/poolparty/rds_test.rb +35 -0
- data/test/test_helper.rb +4 -4
- data/vendor/gems/amazon-ec2/ChangeLog +15 -0
- data/vendor/gems/amazon-ec2/README.rdoc +27 -24
- data/vendor/gems/amazon-ec2/README_dev.rdoc +0 -2
- data/vendor/gems/amazon-ec2/Rakefile +8 -39
- data/vendor/gems/amazon-ec2/VERSION +1 -1
- data/vendor/gems/amazon-ec2/amazon-ec2.gemspec +24 -16
- data/vendor/gems/amazon-ec2/bin/setup.rb +1 -0
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling/autoscaling.rb +6 -16
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/availability_zones.rb +8 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/console.rb +2 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/devpay.rb +18 -0
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/elastic_ips.rb +37 -32
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/images.rb +43 -27
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/instances.rb +136 -99
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/keypairs.rb +3 -17
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/security_groups.rb +4 -23
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/snapshots.rb +38 -17
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/volumes.rb +6 -21
- data/vendor/gems/amazon-ec2/lib/AWS/EC2.rb +2 -2
- data/vendor/gems/amazon-ec2/lib/AWS/ELB/load_balancers.rb +11 -38
- data/vendor/gems/amazon-ec2/lib/AWS/RDS/rds.rb +522 -0
- data/vendor/gems/amazon-ec2/lib/AWS/RDS.rb +73 -0
- data/vendor/gems/amazon-ec2/lib/AWS/exceptions.rb +103 -25
- data/vendor/gems/amazon-ec2/lib/AWS.rb +19 -9
- data/vendor/gems/amazon-ec2/perftools/ec2prof +0 -0
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.dot +130 -191
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.txt +100 -126
- data/vendor/gems/amazon-ec2/perftools/ec2prof.symbols +102 -129
- data/vendor/gems/amazon-ec2/test/test_Autoscaling_groups.rb +3 -2
- data/vendor/gems/amazon-ec2/test/test_EC2_images.rb +32 -0
- data/vendor/gems/amazon-ec2/test/test_EC2_instances.rb +204 -22
- data/vendor/gems/amazon-ec2/test/test_EC2_snapshots.rb +1 -1
- data/vendor/gems/amazon-ec2/test/test_ELB_load_balancers.rb +2 -2
- data/vendor/gems/amazon-ec2/test/test_RDS.rb +354 -0
- data/vendor/gems/amazon-ec2/wsdl/2009-10-31.ec2.wsdl +4261 -0
- data/vendor/gems/amazon-ec2/wsdl/2009-11-30.ec2.wsdl +4668 -0
- metadata +17 -2
@@ -3,6 +3,46 @@ module AWS
|
|
3
3
|
|
4
4
|
class Base < AWS::Base
|
5
5
|
|
6
|
+
# Creates an AMI that uses an Amazon EBS root device from a "running" or "stopped" instance.
|
7
|
+
#
|
8
|
+
# AMIs that use an Amazon EBS root device boot faster than AMIs that use instance stores.
|
9
|
+
# They can be up to 1 TiB in size, use storage that persists on instance failure, and can be
|
10
|
+
# stopped and started.
|
11
|
+
#
|
12
|
+
# @option options [String] :instance_id ("") The ID of the instance.
|
13
|
+
# @option options [String] :name ("") The name of the AMI that was provided during image creation. Constraints 3-128 alphanumeric characters, parenthesis (()), commas (,), slashes (/), dashes (-), or underscores(_)
|
14
|
+
# @option options [optional,String] :description ("") The description of the AMI that was provided during image creation.
|
15
|
+
# @option options [optional,Boolean] :no_reboot (false) By default this property is set to false, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When set to true, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.
|
16
|
+
#
|
17
|
+
def create_image( options = {} )
|
18
|
+
options = { :instance_id => "", :name => "" }.merge(options)
|
19
|
+
raise ArgumentError, "No :instance_id provided" if options.does_not_have? :instance_id
|
20
|
+
raise ArgumentError, "No :name provided" if options.does_not_have? :name
|
21
|
+
raise ArgumentError, "Invalid string length for :name provided" if options[:name] && options[:name].size < 3 || options[:name].size > 128
|
22
|
+
raise ArgumentError, "Invalid string length for :description provided (too long)" if options[:description] && options[:description].size > 255
|
23
|
+
raise ArgumentError, ":no_reboot option must be a Boolean" unless options[:no_reboot].nil? || [true, false].include?(options[:no_reboot])
|
24
|
+
params = {}
|
25
|
+
params["InstanceId"] = options[:instance_id].to_s
|
26
|
+
params["Name"] = options[:name].to_s
|
27
|
+
params["Description"] = options[:description].to_s
|
28
|
+
params["NoReboot"] = options[:no_reboot].to_s
|
29
|
+
return response_generator(:action => "CreateImage", :params => params)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
# The DeregisterImage operation deregisters an AMI. Once deregistered, instances of the AMI may no
|
34
|
+
# longer be launched.
|
35
|
+
#
|
36
|
+
# @option options [String] :image_id ("")
|
37
|
+
#
|
38
|
+
def deregister_image( options = {} )
|
39
|
+
options = { :image_id => "" }.merge(options)
|
40
|
+
raise ArgumentError, "No :image_id provided" if options[:image_id].nil? || options[:image_id].empty?
|
41
|
+
params = { "ImageId" => options[:image_id] }
|
42
|
+
return response_generator(:action => "DeregisterImage", :params => params)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
6
46
|
# The RegisterImage operation registers an AMI with Amazon EC2. Images must be registered before
|
7
47
|
# they can be launched. Each AMI is associated with an unique ID which is provided by the EC2
|
8
48
|
# service via the Registerimage operation. As part of the registration process, Amazon EC2 will
|
@@ -15,17 +55,13 @@ module AWS
|
|
15
55
|
# @option options [String] :image_location ("")
|
16
56
|
#
|
17
57
|
def register_image( options = {} )
|
18
|
-
|
19
58
|
options = {:image_location => ""}.merge(options)
|
20
|
-
|
21
59
|
raise ArgumentError, "No :image_location provided" if options[:image_location].nil? || options[:image_location].empty?
|
22
|
-
|
23
60
|
params = { "ImageLocation" => options[:image_location] }
|
24
|
-
|
25
61
|
return response_generator(:action => "RegisterImage", :params => params)
|
26
|
-
|
27
62
|
end
|
28
63
|
|
64
|
+
|
29
65
|
# The DescribeImages operation returns information about AMIs available for use by the user. This
|
30
66
|
# includes both public AMIs (those available for any user to launch) and private AMIs (those owned by
|
31
67
|
# the user making the request and those owned by other users that the user making the request has explicit
|
@@ -67,35 +103,15 @@ module AWS
|
|
67
103
|
# @option options [Array] :executable_by ([])
|
68
104
|
#
|
69
105
|
def describe_images( options = {} )
|
70
|
-
|
71
106
|
options = { :image_id => [], :owner_id => [], :executable_by => [] }.merge(options)
|
72
|
-
|
73
107
|
params = pathlist( "ImageId", options[:image_id] )
|
74
108
|
params.merge!(pathlist( "Owner", options[:owner_id] ))
|
75
109
|
params.merge!(pathlist( "ExecutableBy", options[:executable_by] ))
|
76
|
-
|
77
110
|
return response_generator(:action => "DescribeImages", :params => params)
|
78
|
-
|
79
111
|
end
|
80
112
|
|
81
|
-
# The DeregisterImage operation deregisters an AMI. Once deregistered, instances of the AMI may no
|
82
|
-
# longer be launched.
|
83
|
-
#
|
84
|
-
# @option options [String] :image_id ("")
|
85
|
-
#
|
86
|
-
def deregister_image( options = {} )
|
87
|
-
|
88
|
-
options = { :image_id => "" }.merge(options)
|
89
|
-
|
90
|
-
raise ArgumentError, "No :image_id provided" if options[:image_id].nil? || options[:image_id].empty?
|
91
|
-
|
92
|
-
params = { "ImageId" => options[:image_id] }
|
93
|
-
|
94
|
-
return response_generator(:action => "DeregisterImage", :params => params)
|
95
|
-
|
96
|
-
end
|
97
113
|
|
98
114
|
end
|
99
|
-
|
100
115
|
end
|
101
|
-
end
|
116
|
+
end
|
117
|
+
|
@@ -1,96 +1,75 @@
|
|
1
1
|
module AWS
|
2
2
|
module EC2
|
3
|
-
|
4
3
|
class Base < AWS::Base
|
5
4
|
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# If Amazon EC2
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# per-instance basis. Amazon EC2 public images use this feature to provide secure access
|
27
|
-
# without passwords.
|
28
|
-
#
|
29
|
-
# Important! Launching public images without a key pair ID will leave them inaccessible.
|
30
|
-
#
|
31
|
-
# The public key material is made available to the instance at boot time by placing it in a file named
|
32
|
-
# openssh_id.pub on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
|
33
|
-
# store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
|
34
|
-
# OpenSSH format). This can be done at boot time (as part of rclocal, for example) allowing for secure
|
35
|
-
# password-less access.
|
36
|
-
#
|
37
|
-
# Optional user data can be provided in the launch request. All instances comprising the launch
|
38
|
-
# request have access to this data (see Instance Metadata for details).
|
39
|
-
#
|
40
|
-
# If any of the AMIs have product codes attached for which the user has not subscribed,
|
41
|
-
# the RunInstances call will fail.
|
42
|
-
#
|
43
|
-
# @option options [String] :image_id ("")
|
44
|
-
# @option options [Integer] :min_count (1)
|
45
|
-
# @option options [Integer] :max_count (1)
|
46
|
-
# @option options [optional, String] :key_name (nil)
|
47
|
-
# @option options [optional, Array] :group_id ([])
|
48
|
-
# @option options [optional, String] :user_data (nil)
|
49
|
-
# @option options [optional, String] :addressing_type ("public")
|
50
|
-
# @option options [optional, String] :instance_type ("m1.small")
|
51
|
-
# @option options [optional, String] :kernel_id (nil)
|
52
|
-
# @option options [optional, String] :availability_zone (nil)
|
5
|
+
# Launches a specified number of instances of an AMI for which you have permissions.
|
6
|
+
#
|
7
|
+
# Amazon API Docs : HTML[http://docs.amazonwebservices.com/AWSEC2/2009-10-31/APIReference/index.html?ApiReference-query-RunInstances.html]
|
8
|
+
#
|
9
|
+
# @option options [String] :image_id ("") Unique ID of a machine image.
|
10
|
+
# @option options [Integer] :min_count (1) Minimum number of instances to launch. If the value is more than Amazon EC2 can launch, no instances are launched at all.
|
11
|
+
# @option options [Integer] :max_count (1) Maximum number of instances to launch. If the value is more than Amazon EC2 can launch, the largest possible number above minCount will be launched instead.
|
12
|
+
# @option options [optional, String] :key_name (nil) The name of the key pair.
|
13
|
+
# @option options [optional, Array of Strings or String] :security_group (nil) Name of the security group(s).
|
14
|
+
# @option options [optional, String] :additional_info (nil) Specifies additional information to make available to the instance(s).
|
15
|
+
# @option options [optional, String] :user_data (nil) MIME, Base64-encoded user data.
|
16
|
+
# @option options [optional, String] :instance_type (nil) Specifies the instance type.
|
17
|
+
# @option options [optional, String] :availability_zone (nil) Specifies the placement constraints (Availability Zones) for launching the instances.
|
18
|
+
# @option options [optional, String] :kernel_id (nil) The ID of the kernel with which to launch the instance.
|
19
|
+
# @option options [optional, String] :ramdisk_id (nil) The ID of the RAM disk with which to launch the instance. Some kernels require additional drivers at launch. Check the kernel requirements for information on whether you need to specify a RAM disk. To find kernel requirements, go to the Resource Center and search for the kernel ID.
|
20
|
+
# @option options [optional, Array] :block_device_mapping ([]) An array of Hashes representing the elements of the block device mapping. e.g. [{:device_name => '/dev/sdh', :virtual_name => '', :ebs_snapshot_id => '', :ebs_volume_size => '', :ebs_delete_on_termination => ''},{},...]
|
21
|
+
# @option options [optional, Boolean] :monitoring_enabled (false) Enables monitoring for the instance.
|
22
|
+
# @option options [optional, String] :subnet_id (nil) Specifies the Amazon VPC subnet ID within which to launch the instance(s) for Amazon Virtual Private Cloud.
|
23
|
+
# @option options [optional, Boolean] :disable_api_termination (true) Specifies whether the instance can be terminated using the APIs. You must modify this attribute before you can terminate any "locked" instances from the APIs.
|
24
|
+
# @option options [optional, String] :instance_initiated_shutdown_behavior ('stop') Specifies whether the instance's Amazon EBS volumes are stopped or terminated when the instance is shut down. Valid values : 'stop', 'terminate'
|
53
25
|
# @option options [optional, Boolean] :base64_encoded (false)
|
54
26
|
#
|
55
27
|
def run_instances( options = {} )
|
56
|
-
|
57
28
|
options = { :image_id => "",
|
58
29
|
:min_count => 1,
|
59
30
|
:max_count => 1,
|
60
|
-
:key_name => nil,
|
61
|
-
:group_id => [],
|
62
|
-
:user_data => nil,
|
63
|
-
:addressing_type => "public",
|
64
|
-
:instance_type => "m1.small",
|
65
|
-
:kernel_id => nil,
|
66
|
-
:availability_zone => nil,
|
67
31
|
:base64_encoded => false }.merge(options)
|
68
32
|
|
69
|
-
|
33
|
+
raise ArgumentError, ":addressing_type has been deprecated." if options[:addressing_type]
|
34
|
+
raise ArgumentError, ":group_id has been deprecated." if options[:group_id]
|
35
|
+
|
70
36
|
raise ArgumentError, ":image_id must be provided" if options[:image_id].nil? || options[:image_id].empty?
|
71
37
|
raise ArgumentError, ":min_count is not valid" unless options[:min_count].to_i > 0
|
72
|
-
raise ArgumentError, ":max_count is not valid" unless options[:max_count].to_i > 0
|
73
|
-
raise ArgumentError, ":
|
74
|
-
raise ArgumentError, ":
|
75
|
-
raise ArgumentError, ":
|
38
|
+
raise ArgumentError, ":max_count is not valid or must be >= :min_count" unless options[:max_count].to_i > 0 && options[:max_count].to_i >= options[:min_count].to_i
|
39
|
+
raise ArgumentError, ":instance_type must specify a valid instance size" unless options[:instance_type].nil? || ["m1.small", "m1.large", "m1.xlarge", "c1.medium", "c1.xlarge", "m2.2xlarge", "m2.4xlarge"].include?(options[:instance_type])
|
40
|
+
raise ArgumentError, ":monitoring_enabled must be 'true' or 'false'" unless options[:monitoring_enabled].nil? || [true, false].include?(options[:monitoring_enabled])
|
41
|
+
raise ArgumentError, ":disable_api_termination must be 'true' or 'false'" unless options[:disable_api_termination].nil? || [true, false].include?(options[:disable_api_termination])
|
42
|
+
raise ArgumentError, ":instance_initiated_shutdown_behavior must be 'stop' or 'terminate'" unless options[:instance_initiated_shutdown_behavior].nil? || ["stop", "terminate"].include?(options[:instance_initiated_shutdown_behavior])
|
43
|
+
raise ArgumentError, ":base64_encoded must be 'true' or 'false'" unless [true, false].include?(options[:base64_encoded])
|
76
44
|
|
77
45
|
user_data = extract_user_data(options)
|
78
46
|
|
79
|
-
params = {
|
80
|
-
"ImageId" => options[:image_id],
|
81
|
-
"MinCount" => options[:min_count].to_s,
|
82
|
-
"MaxCount" => options[:max_count].to_s,
|
83
|
-
}.merge(pathlist("SecurityGroup", options[:group_id]))
|
47
|
+
params = {}
|
84
48
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
params["InstanceType"] = options[:instance_type]
|
89
|
-
params["KernelId"] = options[:kernel_id] unless options[:kernel_id].nil?
|
90
|
-
params["Placement.AvailabilityZone"] = options[:availability_zone] unless options[:availability_zone].nil?
|
49
|
+
if options[:security_group]
|
50
|
+
params.merge!(pathlist("SecurityGroup", options[:security_group]))
|
51
|
+
end
|
91
52
|
|
92
|
-
|
53
|
+
if options[:block_device_mapping]
|
54
|
+
params.merge!(pathhashlist('BlockDeviceMapping', options[:block_device_mapping].flatten, {:device_name => 'DeviceName', :virtual_name => 'VirtualName', :ebs_snapshot_id => 'Ebs.SnapshotId', :ebs_volume_size => 'Ebs.VolumeSize', :ebs_delete_on_termination => 'Ebs.DeleteOnTermination' }))
|
55
|
+
end
|
56
|
+
|
57
|
+
params["ImageId"] = options[:image_id]
|
58
|
+
params["MinCount"] = options[:min_count].to_s
|
59
|
+
params["MaxCount"] = options[:max_count].to_s
|
60
|
+
params["KeyName"] = options[:key_name] unless options[:key_name].nil?
|
61
|
+
params["AdditionalInfo"] = options[:additional_info] unless options[:additional_info].nil?
|
62
|
+
params["UserData"] = user_data unless user_data.nil?
|
63
|
+
params["InstanceType"] = options[:instance_type] unless options[:instance_type].nil?
|
64
|
+
params["Placement.AvailabilityZone"] = options[:availability_zone] unless options[:availability_zone].nil?
|
65
|
+
params["KernelId"] = options[:kernel_id] unless options[:kernel_id].nil?
|
66
|
+
params["RamdiskId"] = options[:ramdisk_id] unless options[:ramdisk_id].nil?
|
67
|
+
params["Monitoring.Enabled"] = options[:monitoring_enabled].to_s unless options[:monitoring_enabled].nil?
|
68
|
+
params["SubnetId"] = options[:subnet_id] unless options[:subnet_id].nil?
|
69
|
+
params["DisableApiTermination"] = options[:disable_api_termination].to_s unless options[:disable_api_termination].nil?
|
70
|
+
params["InstanceInitiatedShutdownBehavior"] = options[:instance_initiated_shutdown_behavior] unless options[:instance_initiated_shutdown_behavior].nil?
|
93
71
|
|
72
|
+
return response_generator(:action => "RunInstances", :params => params)
|
94
73
|
end
|
95
74
|
|
96
75
|
# If :user_data is passed in then URL escape and Base64 encode it
|
@@ -122,13 +101,65 @@ module AWS
|
|
122
101
|
# @option options [Array] :instance_id ([])
|
123
102
|
#
|
124
103
|
def describe_instances( options = {} )
|
125
|
-
|
126
104
|
options = { :instance_id => [] }.merge(options)
|
127
|
-
|
128
105
|
params = pathlist("InstanceId", options[:instance_id])
|
129
|
-
|
130
106
|
return response_generator(:action => "DescribeInstances", :params => params)
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
# Not yet implemented
|
111
|
+
#
|
112
|
+
# @todo Implement this method
|
113
|
+
#
|
114
|
+
def describe_instance_attribute( options = {} )
|
115
|
+
raise "Not yet implemented"
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
# Not yet implemented
|
120
|
+
#
|
121
|
+
# @todo Implement this method
|
122
|
+
#
|
123
|
+
def modify_instance_attribute( options = {} )
|
124
|
+
raise "Not yet implemented"
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
# Not yet implemented
|
129
|
+
#
|
130
|
+
# @todo Implement this method
|
131
|
+
#
|
132
|
+
def reset_instance_attribute( options = {} )
|
133
|
+
raise "Not yet implemented"
|
134
|
+
end
|
131
135
|
|
136
|
+
|
137
|
+
# Starts an instance that uses an Amazon EBS volume as its root device.
|
138
|
+
#
|
139
|
+
# @option options [Array] :instance_id ([]) Array of unique instance ID's of stopped instances.
|
140
|
+
#
|
141
|
+
def start_instances( options = {} )
|
142
|
+
options = { :instance_id => [] }.merge(options)
|
143
|
+
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
144
|
+
params = {}
|
145
|
+
params.merge!(pathlist("InstanceId", options[:instance_id]))
|
146
|
+
return response_generator(:action => "StartInstances", :params => params)
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
# Stops an instance that uses an Amazon EBS volume as its root device.
|
151
|
+
#
|
152
|
+
# @option options [Array] :instance_id ([]) Unique instance ID of a running instance.
|
153
|
+
# @option options [optional, Boolean] :force (false) Forces the instance to stop. The instance will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures. This option is not recommended for Windows instances.
|
154
|
+
#
|
155
|
+
def stop_instances( options = {} )
|
156
|
+
options = { :instance_id => [] }.merge(options)
|
157
|
+
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
158
|
+
raise ArgumentError, ":force must be 'true' or 'false'" unless options[:force].nil? || [true, false].include?(options[:force])
|
159
|
+
params = {}
|
160
|
+
params.merge!(pathlist("InstanceId", options[:instance_id]))
|
161
|
+
params["Force"] = options[:force].to_s unless options[:force].nil?
|
162
|
+
return response_generator(:action => "StopInstances", :params => params)
|
132
163
|
end
|
133
164
|
|
134
165
|
|
@@ -139,16 +170,10 @@ module AWS
|
|
139
170
|
# @option options [Array] :instance_id ([])
|
140
171
|
#
|
141
172
|
def reboot_instances( options = {} )
|
142
|
-
|
143
|
-
# defaults
|
144
173
|
options = { :instance_id => [] }.merge(options)
|
145
|
-
|
146
174
|
raise ArgumentError, "No instance IDs provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
147
|
-
|
148
175
|
params = pathlist("InstanceId", options[:instance_id])
|
149
|
-
|
150
176
|
return response_generator(:action => "RebootInstances", :params => params)
|
151
|
-
|
152
177
|
end
|
153
178
|
|
154
179
|
|
@@ -160,15 +185,10 @@ module AWS
|
|
160
185
|
# @option options [Array] :instance_id ([])
|
161
186
|
#
|
162
187
|
def terminate_instances( options = {} )
|
163
|
-
|
164
188
|
options = { :instance_id => [] }.merge(options)
|
165
|
-
|
166
189
|
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
167
|
-
|
168
190
|
params = pathlist("InstanceId", options[:instance_id])
|
169
|
-
|
170
191
|
return response_generator(:action => "TerminateInstances", :params => params)
|
171
|
-
|
172
192
|
end
|
173
193
|
|
174
194
|
|
@@ -177,36 +197,53 @@ module AWS
|
|
177
197
|
# @option options [Array] :instance_id ([])
|
178
198
|
#
|
179
199
|
def monitor_instances( options = {} )
|
180
|
-
|
181
200
|
options = { :instance_id => [] }.merge(options)
|
182
|
-
|
183
201
|
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
184
|
-
|
185
202
|
params = pathlist("InstanceId", options[:instance_id])
|
186
|
-
|
187
203
|
return response_generator(:action => "MonitorInstances", :params => params)
|
188
|
-
|
189
204
|
end
|
190
205
|
|
191
206
|
|
192
|
-
|
193
207
|
# The UnmonitorInstances operation tells Cloudwatch to stop logging metrics from one or more EC2 instances
|
194
208
|
#
|
195
209
|
# @option options [Array] :instance_id ([])
|
196
210
|
#
|
197
211
|
def unmonitor_instances( options = {} )
|
198
|
-
|
199
212
|
options = { :instance_id => [] }.merge(options)
|
200
|
-
|
201
213
|
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
202
|
-
|
203
214
|
params = pathlist("InstanceId", options[:instance_id])
|
204
|
-
|
205
215
|
return response_generator(:action => "UnmonitorInstances", :params => params)
|
216
|
+
end
|
206
217
|
|
218
|
+
|
219
|
+
# Not yet implemented
|
220
|
+
#
|
221
|
+
# @todo Implement this method
|
222
|
+
#
|
223
|
+
def describe_reserved_instances( options = {} )
|
224
|
+
raise "Not yet implemented"
|
207
225
|
end
|
208
226
|
|
209
|
-
end
|
210
227
|
|
228
|
+
# Not yet implemented
|
229
|
+
#
|
230
|
+
# @todo Implement this method
|
231
|
+
#
|
232
|
+
def describe_reserved_instances_offerings( options = {} )
|
233
|
+
raise "Not yet implemented"
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
# Not yet implemented
|
238
|
+
#
|
239
|
+
# @todo Implement this method
|
240
|
+
#
|
241
|
+
def purchase_reserved_instances_offering( options = {} )
|
242
|
+
raise "Not yet implemented"
|
243
|
+
end
|
244
|
+
|
245
|
+
|
246
|
+
end
|
211
247
|
end
|
212
|
-
end
|
248
|
+
end
|
249
|
+
|
@@ -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
|
+
|