newrelic-amazon-ec2 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.yardopts +1 -0
- data/ChangeLog +293 -0
- data/LICENSE +66 -0
- data/README.rdoc +354 -0
- data/README_dev.rdoc +12 -0
- data/Rakefile +101 -0
- data/VERSION +1 -0
- data/amazon-ec2.gemspec +134 -0
- data/bin/ec2-gem-example.rb +137 -0
- data/bin/ec2-gem-profile.rb +10 -0
- data/bin/ec2sh +62 -0
- data/bin/setup.rb +28 -0
- data/deps.rip +1 -0
- data/lib/AWS.rb +292 -0
- data/lib/AWS/Autoscaling.rb +70 -0
- data/lib/AWS/Autoscaling/autoscaling.rb +273 -0
- data/lib/AWS/Cloudwatch.rb +32 -0
- data/lib/AWS/Cloudwatch/monitoring.rb +89 -0
- data/lib/AWS/EC2.rb +33 -0
- data/lib/AWS/EC2/availability_zones.rb +21 -0
- data/lib/AWS/EC2/console.rb +23 -0
- data/lib/AWS/EC2/elastic_ips.rb +81 -0
- data/lib/AWS/EC2/image_attributes.rb +133 -0
- data/lib/AWS/EC2/images.rb +101 -0
- data/lib/AWS/EC2/instances.rb +212 -0
- data/lib/AWS/EC2/keypairs.rb +61 -0
- data/lib/AWS/EC2/products.rb +21 -0
- data/lib/AWS/EC2/security_groups.rb +183 -0
- data/lib/AWS/EC2/snapshots.rb +59 -0
- data/lib/AWS/EC2/volumes.rb +115 -0
- data/lib/AWS/ELB.rb +71 -0
- data/lib/AWS/ELB/load_balancers.rb +178 -0
- data/lib/AWS/exceptions.rb +122 -0
- data/lib/AWS/responses.rb +21 -0
- data/newrelic-amazon-ec2.gemspec +136 -0
- data/perftools/ec2prof +0 -0
- data/perftools/ec2prof-results.dot +132 -0
- data/perftools/ec2prof-results.txt +100 -0
- data/perftools/ec2prof.symbols +102 -0
- data/test/test_Autoscaling_groups.rb +336 -0
- data/test/test_EC2.rb +68 -0
- data/test/test_EC2_availability_zones.rb +49 -0
- data/test/test_EC2_console.rb +54 -0
- data/test/test_EC2_elastic_ips.rb +144 -0
- data/test/test_EC2_image_attributes.rb +238 -0
- data/test/test_EC2_images.rb +197 -0
- data/test/test_EC2_instances.rb +429 -0
- data/test/test_EC2_keypairs.rb +123 -0
- data/test/test_EC2_products.rb +48 -0
- data/test/test_EC2_responses.rb +53 -0
- data/test/test_EC2_s3_xmlsimple.rb +80 -0
- data/test/test_EC2_security_groups.rb +205 -0
- data/test/test_EC2_snapshots.rb +83 -0
- data/test/test_EC2_volumes.rb +142 -0
- data/test/test_ELB_load_balancers.rb +239 -0
- data/test/test_helper.rb +23 -0
- data/wsdl/2007-08-29.ec2.wsdl +1269 -0
- data/wsdl/2008-02-01.ec2.wsdl +1614 -0
- data/wsdl/2008-05-05.ec2.wsdl +2052 -0
- data/wsdl/2008-12-01.ec2.wsdl +2354 -0
- metadata +218 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
module AWS
|
2
|
+
module EC2
|
3
|
+
|
4
|
+
class Base < AWS::Base
|
5
|
+
|
6
|
+
# The DescribeSnapshots operation describes the status of Amazon EBS snapshots.
|
7
|
+
#
|
8
|
+
# @option options [Array] :snapshot_id ([])
|
9
|
+
#
|
10
|
+
def describe_snapshots( options = {} )
|
11
|
+
|
12
|
+
options = { :snapshot_id => [] }.merge(options)
|
13
|
+
|
14
|
+
params = pathlist("SnapshotId", options[:snapshot_id] )
|
15
|
+
|
16
|
+
return response_generator(:action => "DescribeSnapshots", :params => params)
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# 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
|
+
#
|
22
|
+
# @option options [String] :volume_id ('')
|
23
|
+
#
|
24
|
+
def create_snapshot( options = {} )
|
25
|
+
|
26
|
+
options = { :volume_id => '' }.merge(options)
|
27
|
+
|
28
|
+
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
29
|
+
|
30
|
+
params = {
|
31
|
+
"VolumeId" => options[:volume_id]
|
32
|
+
}
|
33
|
+
|
34
|
+
return response_generator(:action => "CreateSnapshot", :params => params)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# The DeleteSnapshot operation deletes a snapshot of an Amazon EBS volume that is stored in Amazon S3.
|
40
|
+
#
|
41
|
+
# @option options [String] :snapshot_id ('')
|
42
|
+
#
|
43
|
+
def delete_snapshot( options = {} )
|
44
|
+
|
45
|
+
options = { :snapshot_id => '' }.merge(options)
|
46
|
+
|
47
|
+
raise ArgumentError, "No :snapshot_id provided" if options[:snapshot_id].nil? || options[:snapshot_id].empty?
|
48
|
+
|
49
|
+
params = {
|
50
|
+
"SnapshotId" => options[:snapshot_id]
|
51
|
+
}
|
52
|
+
|
53
|
+
return response_generator(:action => "DeleteSnapshot", :params => params)
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module AWS
|
2
|
+
module EC2
|
3
|
+
class Base < AWS::Base
|
4
|
+
|
5
|
+
# 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
|
+
# @option options [optional, String] :volume_id ([])
|
8
|
+
#
|
9
|
+
def describe_volumes( options = {} )
|
10
|
+
options = { :volume_id => [] }.merge(options)
|
11
|
+
params = pathlist("VolumeId", options[:volume_id] )
|
12
|
+
return response_generator(:action => "DescribeVolumes", :params => params)
|
13
|
+
end
|
14
|
+
|
15
|
+
# The CreateVolume operation creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.
|
16
|
+
#
|
17
|
+
# @option options [String] :availability_zone ('')
|
18
|
+
# @option options [optional, String] :size ('')
|
19
|
+
# @option options [optional, String] :snapshot_id ('')
|
20
|
+
#
|
21
|
+
def create_volume( options = {} )
|
22
|
+
|
23
|
+
# defaults
|
24
|
+
options = { :availability_zone => '' }.merge(options)
|
25
|
+
|
26
|
+
raise ArgumentError, "No :availability_zone provided" if options[:availability_zone].nil? || options[:availability_zone].empty?
|
27
|
+
|
28
|
+
options = { :size => '' }.merge(options)
|
29
|
+
options = { :snapshot_id => '' }.merge(options)
|
30
|
+
|
31
|
+
params = {
|
32
|
+
"AvailabilityZone" => options[:availability_zone],
|
33
|
+
"Size" => options[:size],
|
34
|
+
"SnapshotId" => options[:snapshot_id]
|
35
|
+
}
|
36
|
+
|
37
|
+
return response_generator(:action => "CreateVolume", :params => params)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# The DeleteVolume operation deletes an Amazon EBS volume.
|
42
|
+
#
|
43
|
+
# @option options [String] :volume_id ('')
|
44
|
+
#
|
45
|
+
def delete_volume( options = {} )
|
46
|
+
|
47
|
+
options = { :volume_id => '' }.merge(options)
|
48
|
+
|
49
|
+
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
50
|
+
|
51
|
+
params = {
|
52
|
+
"VolumeId" => options[:volume_id]
|
53
|
+
}
|
54
|
+
|
55
|
+
return response_generator(:action => "DeleteVolume", :params => params)
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
# The AttachVolume operation attaches an Amazon EBS volume to an instance.
|
60
|
+
#
|
61
|
+
# @option options [String] :volume_id ('')
|
62
|
+
# @option options [String] :instance_id ('')
|
63
|
+
# @option options [String] :device ('')
|
64
|
+
#
|
65
|
+
def attach_volume( options = {} )
|
66
|
+
|
67
|
+
options = { :volume_id => '' }.merge(options)
|
68
|
+
options = { :instance_id => '' }.merge(options)
|
69
|
+
options = { :device => '' }.merge(options)
|
70
|
+
|
71
|
+
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
72
|
+
raise ArgumentError, "No :instance_id provided" if options[:instance_id].nil? || options[:instance_id].empty?
|
73
|
+
raise ArgumentError, "No :device provided" if options[:device].nil? || options[:device].empty?
|
74
|
+
|
75
|
+
params = {
|
76
|
+
"VolumeId" => options[:volume_id],
|
77
|
+
"InstanceId" => options[:instance_id],
|
78
|
+
"Device" => options[:device]
|
79
|
+
}
|
80
|
+
|
81
|
+
return response_generator(:action => "AttachVolume", :params => params)
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
# The DetachVolume operation detaches an Amazon EBS volume from an instance.
|
86
|
+
#
|
87
|
+
# @option options [String] :volume_id ('')
|
88
|
+
# @option options [optional, String] :instance_id ('')
|
89
|
+
# @option options [optional, String] :device ('')
|
90
|
+
# @option options [optional, Boolean] :force ('')
|
91
|
+
#
|
92
|
+
def detach_volume( options = {} )
|
93
|
+
|
94
|
+
options = { :volume_id => '' }.merge(options)
|
95
|
+
|
96
|
+
raise ArgumentError, "No :volume_id provided" if options[:volume_id].nil? || options[:volume_id].empty?
|
97
|
+
|
98
|
+
options = { :instance_id => '' }.merge(options)
|
99
|
+
options = { :device => '' }.merge(options)
|
100
|
+
options = { :force => '' }.merge(options)
|
101
|
+
|
102
|
+
params = {
|
103
|
+
"VolumeId" => options[:volume_id],
|
104
|
+
"InstanceId" => options[:instance_id],
|
105
|
+
"Device" => options[:device],
|
106
|
+
"Force" => options[:force]
|
107
|
+
}
|
108
|
+
|
109
|
+
return response_generator(:action => "DetachVolume", :params => params)
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
data/lib/AWS/ELB.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
module AWS
|
2
|
+
module ELB
|
3
|
+
|
4
|
+
# Which host FQDN will we connect to for all API calls to AWS?
|
5
|
+
# If ELB_URL is defined in the users ENV we can override the default with that.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# export ELB_URL='https://elasticloadbalancing.amazonaws.com'
|
9
|
+
if ENV['ELB_URL']
|
10
|
+
ELB_URL = ENV['ELB_URL']
|
11
|
+
VALID_HOSTS = ['elasticloadbalancing.amazonaws.com']
|
12
|
+
raise ArgumentError, "Invalid ELB_URL environment variable : #{ELB_URL}" unless VALID_HOSTS.include?(ELB_URL)
|
13
|
+
DEFAULT_HOST = URI.parse(ELB_URL).host
|
14
|
+
else
|
15
|
+
# Default US API endpoint
|
16
|
+
DEFAULT_HOST = 'elasticloadbalancing.amazonaws.com'
|
17
|
+
end
|
18
|
+
|
19
|
+
API_VERSION = '2009-05-15'
|
20
|
+
|
21
|
+
class Base < AWS::Base
|
22
|
+
def api_version
|
23
|
+
API_VERSION
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_host
|
27
|
+
DEFAULT_HOST
|
28
|
+
end
|
29
|
+
|
30
|
+
# Raises the appropriate error if the specified Net::HTTPResponse object
|
31
|
+
# contains an Amazon EC2 error; returns +false+ otherwise.
|
32
|
+
def aws_error?(response)
|
33
|
+
|
34
|
+
# return false if we got a HTTP 200 code,
|
35
|
+
# otherwise there is some type of error (40x,50x) and
|
36
|
+
# we should try to raise an appropriate exception
|
37
|
+
# from one of our exception classes defined in
|
38
|
+
# exceptions.rb
|
39
|
+
return false if response.is_a?(Net::HTTPSuccess)
|
40
|
+
|
41
|
+
# parse the XML document so we can walk through it
|
42
|
+
doc = REXML::Document.new(response.body)
|
43
|
+
|
44
|
+
# Check that the Error element is in the place we would expect.
|
45
|
+
# and if not raise a generic error exception
|
46
|
+
unless doc.root.elements[1].name == "Error"
|
47
|
+
raise Error, "Unexpected error format. response.body is: #{response.body}"
|
48
|
+
end
|
49
|
+
|
50
|
+
# An valid error response looks like this:
|
51
|
+
# <?xml version="1.0"?><Response><Errors><Error><Code>InvalidParameterCombination</Code><Message>Unknown parameter: foo</Message></Error></Errors><RequestID>291cef62-3e86-414b-900e-17246eccfae8</RequestID></Response>
|
52
|
+
# AWS EC2 throws some exception codes that look like Error.SubError. Since we can't name classes this way
|
53
|
+
# we need to strip out the '.' in the error 'Code' and we name the error exceptions with this
|
54
|
+
# non '.' name as well.
|
55
|
+
error_code = doc.root.elements['//ErrorResponse/Error/Code'].text.gsub('.', '')
|
56
|
+
error_message = doc.root.elements['//ErrorResponse/Error/Message'].text
|
57
|
+
|
58
|
+
# Raise one of our specific error classes if it exists.
|
59
|
+
# otherwise, throw a generic EC2 Error with a few details.
|
60
|
+
if AWS.const_defined?(error_code)
|
61
|
+
raise AWS.const_get(error_code), error_message
|
62
|
+
else
|
63
|
+
raise AWS::Error, error_message
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
module AWS
|
2
|
+
module ELB
|
3
|
+
class Base < AWS::Base
|
4
|
+
|
5
|
+
# This API creates a new LoadBalancer. Once the call has completed
|
6
|
+
# successfully, a new LoadBalancer will be created, but it will not be
|
7
|
+
# usable until at least one instance has been registered. When the
|
8
|
+
# LoadBalancer creation is completed, you can check whether it is usable
|
9
|
+
# by using the DescribeInstanceHealth API. The LoadBalancer is usable as
|
10
|
+
# soon as any registered instance is InService.
|
11
|
+
#
|
12
|
+
# @option options [String] :load_balancer_name (nil) the name of the load balancer
|
13
|
+
# @option options [Array] :availability_zones (nil)
|
14
|
+
# @option options [Array] :listeners (nil) An Array of Hashes (:protocol, :load_balancer_port, :instance_port)
|
15
|
+
# @option options [Array] :availability_zones (nil) An Array of Strings
|
16
|
+
#
|
17
|
+
def create_load_balancer( options = {} )
|
18
|
+
raise ArgumentError, "No :availability_zones provided" if options[:availability_zones].nil? || options[:availability_zones].empty?
|
19
|
+
raise ArgumentError, "No :listeners provided" if options[:listeners].nil? || options[:listeners].empty?
|
20
|
+
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
|
21
|
+
|
22
|
+
params = {}
|
23
|
+
|
24
|
+
params.merge!(pathlist('AvailabilityZones.member', [options[:availability_zones]].flatten))
|
25
|
+
params.merge!(pathhashlist('Listeners.member', [options[:listeners]].flatten, {
|
26
|
+
:protocol => 'Protocol',
|
27
|
+
:load_balancer_port => 'LoadBalancerPort',
|
28
|
+
:instance_port => 'InstancePort'
|
29
|
+
}))
|
30
|
+
params['LoadBalancerName'] = options[:load_balancer_name]
|
31
|
+
|
32
|
+
return response_generator(:action => "CreateLoadBalancer", :params => params)
|
33
|
+
end
|
34
|
+
|
35
|
+
# This API deletes the specified LoadBalancer. On deletion, all of the
|
36
|
+
# configured properties of the LoadBalancer will be deleted. If you
|
37
|
+
# attempt to recreate the LoadBalancer, you need to reconfigure all the
|
38
|
+
# settings. The DNS name associated with a deleted LoadBalancer is no
|
39
|
+
# longer be usable. Once deleted, the name and associated DNS record of
|
40
|
+
# the LoadBalancer no longer exist and traffic sent to any of its IP
|
41
|
+
# addresses will no longer be delivered to your instances. You will not
|
42
|
+
# get the same DNS name even if you create a new LoadBalancer with same
|
43
|
+
# LoadBalancerName.
|
44
|
+
#
|
45
|
+
# @option options [String] :load_balancer_name the name of the load balancer
|
46
|
+
#
|
47
|
+
def delete_load_balancer( options = {} )
|
48
|
+
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
|
49
|
+
params = { 'LoadBalancerName' => options[:load_balancer_name] }
|
50
|
+
return response_generator(:action => "DeleteLoadBalancer", :params => params)
|
51
|
+
end
|
52
|
+
|
53
|
+
# This API returns detailed configuration information for the specified
|
54
|
+
# LoadBalancers, or if no LoadBalancers are specified, then the API
|
55
|
+
# returns configuration information for all LoadBalancers created by the
|
56
|
+
# caller. For more information, please see LoadBalancer.
|
57
|
+
#
|
58
|
+
# You must have created the specified input LoadBalancers in order to
|
59
|
+
# retrieve this information. In other words, in order to successfully call
|
60
|
+
# this API, you must provide the same account credentials as those that
|
61
|
+
# were used to create the LoadBalancer.
|
62
|
+
#
|
63
|
+
# @option options [Array<String>] :load_balancer_names ([]) An Array of names of load balancers to describe.
|
64
|
+
#
|
65
|
+
def describe_load_balancers( options = {} )
|
66
|
+
options = { :load_balancer_names => [] }.merge(options)
|
67
|
+
params = pathlist("LoadBalancerName.member", options[:load_balancer_names])
|
68
|
+
return response_generator(:action => "DescribeLoadBalancers", :params => params)
|
69
|
+
end
|
70
|
+
|
71
|
+
# This API adds new instances to the LoadBalancer.
|
72
|
+
#
|
73
|
+
# Once the instance is registered, it starts receiving traffic and
|
74
|
+
# requests from the LoadBalancer. Any instance that is not in any of the
|
75
|
+
# Availability Zones registered for the LoadBalancer will be moved to
|
76
|
+
# the OutOfService state. It will move to the InService state when the
|
77
|
+
# Availability Zone is added to the LoadBalancer.
|
78
|
+
#
|
79
|
+
# You must have been the one who created the LoadBalancer. In other
|
80
|
+
# words, in order to successfully call this API, you must provide the
|
81
|
+
# same account credentials as those that were used to create the
|
82
|
+
# LoadBalancer.
|
83
|
+
#
|
84
|
+
# NOTE: Completion of this API does not guarantee that operation has
|
85
|
+
# completed. Rather, it means that the request has been registered and
|
86
|
+
# the changes will happen shortly.
|
87
|
+
#
|
88
|
+
# @option options [Array<String>] :instances An Array of instance names to add to the load balancer.
|
89
|
+
# @option options [String] :load_balancer_name The name of the load balancer.
|
90
|
+
#
|
91
|
+
def register_instances_with_load_balancer( options = {} )
|
92
|
+
raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
|
93
|
+
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
|
94
|
+
params = {}
|
95
|
+
params.merge!(pathhashlist('Instances.member', options[:instances].flatten.collect{|e| {:instance_id => e}}, {:instance_id => 'InstanceId'}))
|
96
|
+
params['LoadBalancerName'] = options[:load_balancer_name]
|
97
|
+
return response_generator(:action => "RegisterInstancesWithLoadBalancer", :params => params)
|
98
|
+
end
|
99
|
+
|
100
|
+
# This API deregisters instances from the LoadBalancer. Trying to
|
101
|
+
# deregister an instance that is not registered with the LoadBalancer
|
102
|
+
# does nothing.
|
103
|
+
#
|
104
|
+
# In order to successfully call this API, you must provide the same
|
105
|
+
# account credentials as those that were used to create the
|
106
|
+
# LoadBalancer.
|
107
|
+
#
|
108
|
+
# Once the instance is deregistered, it will stop receiving traffic from
|
109
|
+
# the LoadBalancer.
|
110
|
+
#
|
111
|
+
# @option options [Array<String>] :instances An Array of instance names to remove from the load balancer.
|
112
|
+
# @option options [String] :load_balancer_name The name of the load balancer.
|
113
|
+
#
|
114
|
+
def deregister_instances_from_load_balancer( options = {} )
|
115
|
+
raise ArgumentError, "No :instances provided" if options[:instances].nil? || options[:instances].empty?
|
116
|
+
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
|
117
|
+
params = {}
|
118
|
+
params.merge!(pathlist('Instances.member', [options[:instances]].flatten))
|
119
|
+
params['LoadBalancerName'] = options[:load_balancer_name]
|
120
|
+
return response_generator(:action => "DeregisterInstancesFromLoadBalancer", :params => params)
|
121
|
+
end
|
122
|
+
|
123
|
+
# This API enables you to define an application healthcheck for the
|
124
|
+
# instances.
|
125
|
+
#
|
126
|
+
# Note: Completion of this API does not guarantee that operation has completed. Rather, it means that the request has been registered and the changes will happen shortly.
|
127
|
+
#
|
128
|
+
# @option options [Hash] :health_check A Hash with the keys (:timeout, :interval, :unhealthy_threshold, :healthy_threshold)
|
129
|
+
# @option options [String] :load_balancer_name The name of the load balancer.
|
130
|
+
#
|
131
|
+
def configure_health_check( options = {} )
|
132
|
+
raise ArgumentError, "No :health_check provided" if options[:health_check].nil? || options[:health_check].empty?
|
133
|
+
raise ArgumentError, "No :health_check => :target provided" if options[:health_check][:target].nil? || options[:health_check][:target].empty?
|
134
|
+
raise ArgumentError, "No :health_check => :timeout provided" if options[:health_check][:timeout].nil? || options[:health_check][:timeout].empty?
|
135
|
+
raise ArgumentError, "No :health_check => :interval provided" if options[:health_check][:interval].nil? || options[:health_check][:interval].empty?
|
136
|
+
raise ArgumentError, "No :health_check => :unhealthy_threshold provided" if options[:health_check][:unhealthy_threshold].nil? || options[:health_check][:unhealthy_threshold].empty?
|
137
|
+
raise ArgumentError, "No :health_check => :healthy_threshold provided" if options[:health_check][:healthy_threshold].nil? || options[:health_check][:healthy_threshold].empty?
|
138
|
+
raise ArgumentError, "No :load_balancer_name provided" if options[:load_balancer_name].nil? || options[:load_balancer_name].empty?
|
139
|
+
|
140
|
+
params = {}
|
141
|
+
|
142
|
+
params['LoadBalancerName'] = options[:load_balancer_name]
|
143
|
+
params['HealthCheck.Target'] = options[:health_check][:target]
|
144
|
+
params['HealthCheck.Timeout'] = options[:health_check][:timeout]
|
145
|
+
params['HealthCheck.Interval'] = options[:health_check][:interval]
|
146
|
+
params['HealthCheck.UnhealthyThreshold'] = options[:health_check][:unhealthy_threshold]
|
147
|
+
params['HealthCheck.HealthyThreshold'] = options[:health_check][:healthy_threshold]
|
148
|
+
|
149
|
+
return response_generator(:action => "ConfigureHealthCheck", :params => params)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Not yet implemented
|
153
|
+
#
|
154
|
+
# @todo Implement this method
|
155
|
+
#
|
156
|
+
def describe_instance_health( options = {} )
|
157
|
+
raise "Not yet implemented"
|
158
|
+
end
|
159
|
+
|
160
|
+
# Not yet implemented
|
161
|
+
#
|
162
|
+
# @todo Implement this method
|
163
|
+
#
|
164
|
+
def disable_availability_zones_for_load_balancer( options = {} )
|
165
|
+
raise "Not yet implemented"
|
166
|
+
end
|
167
|
+
|
168
|
+
# Not yet implemented
|
169
|
+
#
|
170
|
+
# @todo Implement this method
|
171
|
+
#
|
172
|
+
def enable_availability_zones_for_load_balancer( options = {} )
|
173
|
+
raise "Not yet implemented"
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#--
|
2
|
+
# AWS EC2 CLIENT ERROR CODES
|
3
|
+
# AWS EC2 can throw error exceptions that contain a '.' in them.
|
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
|
6
|
+
# the granularity of the exception.
|
7
|
+
#++
|
8
|
+
|
9
|
+
module AWS
|
10
|
+
|
11
|
+
# All AWS errors are superclassed by Error < RuntimeError
|
12
|
+
class Error < RuntimeError; end
|
13
|
+
|
14
|
+
# CLIENT : A client side argument error
|
15
|
+
class ArgumentError < Error; end
|
16
|
+
|
17
|
+
# EC2 : User not authorized.
|
18
|
+
class AuthFailure < Error; end
|
19
|
+
|
20
|
+
# EC2 : Invalid AWS Account
|
21
|
+
class InvalidClientTokenId < Error; end
|
22
|
+
|
23
|
+
# EC2 : Invalid Parameters for Value
|
24
|
+
class InvalidParameterValue < Error; end
|
25
|
+
|
26
|
+
# EC2 : Specified AMI has an unparsable manifest.
|
27
|
+
class InvalidManifest < Error; end
|
28
|
+
|
29
|
+
# EC2 : Specified AMI ID is not valid.
|
30
|
+
class InvalidAMIIDMalformed < Error; end
|
31
|
+
|
32
|
+
# EC2 : Specified AMI ID does not exist.
|
33
|
+
class InvalidAMIIDNotFound < Error; end
|
34
|
+
|
35
|
+
# EC2 : Specified AMI ID has been deregistered and is no longer available.
|
36
|
+
class InvalidAMIIDUnavailable < Error; end
|
37
|
+
|
38
|
+
# EC2 : Specified instance ID is not valid.
|
39
|
+
class InvalidInstanceIDMalformed < Error; end
|
40
|
+
|
41
|
+
# EC2 : Specified instance ID does not exist.
|
42
|
+
class InvalidInstanceIDNotFound < Error; end
|
43
|
+
|
44
|
+
# EC2 : Specified keypair name does not exist.
|
45
|
+
class InvalidKeyPairNotFound < Error; end
|
46
|
+
|
47
|
+
# EC2 : Attempt to create a duplicate keypair.
|
48
|
+
class InvalidKeyPairDuplicate < Error; end
|
49
|
+
|
50
|
+
# EC2 : Specified group name does not exist.
|
51
|
+
class InvalidGroupNotFound < Error; end
|
52
|
+
|
53
|
+
# EC2 : Attempt to create a duplicate group.
|
54
|
+
class InvalidGroupDuplicate < Error; end
|
55
|
+
|
56
|
+
# EC2 : Specified group can not be deleted because it is in use.
|
57
|
+
class InvalidGroupInUse < Error; end
|
58
|
+
|
59
|
+
# EC2 : Specified group name is a reserved name.
|
60
|
+
class InvalidGroupReserved < Error; end
|
61
|
+
|
62
|
+
# EC2 : Attempt to authorize a permission that has already been authorized.
|
63
|
+
class InvalidPermissionDuplicate < Error; end
|
64
|
+
|
65
|
+
# EC2 : Specified permission is invalid.
|
66
|
+
class InvalidPermissionMalformed < Error; end
|
67
|
+
|
68
|
+
# EC2 : Specified reservation ID is invalid.
|
69
|
+
class InvalidReservationIDMalformed < Error; end
|
70
|
+
|
71
|
+
# EC2 : Specified reservation ID does not exist.
|
72
|
+
class InvalidReservationIDNotFound < Error; end
|
73
|
+
|
74
|
+
# EC2 : User has reached max allowed concurrent running instances.
|
75
|
+
class InstanceLimitExceeded < Error; end
|
76
|
+
|
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
|
82
|
+
|
83
|
+
# EC2 : The user ID is neither in the form of an AWS account ID or one
|
84
|
+
# of the special values accepted by the owner or executableBy flags
|
85
|
+
# in the DescribeImages call.
|
86
|
+
class InvalidUserIDMalformed < Error; end
|
87
|
+
|
88
|
+
# EC2 : The value of an item added to, or removed from, an image attribute is invalid.
|
89
|
+
class InvalidAMIAttributeItemValue < Error; end
|
90
|
+
|
91
|
+
# ELB : The Load balancer specified was not found.
|
92
|
+
class LoadBalancerNotFound < Error; end
|
93
|
+
|
94
|
+
# ELB :
|
95
|
+
class ValidationError < Error; end
|
96
|
+
|
97
|
+
# ELB :
|
98
|
+
class DuplicateLoadBalancerName < Error; end
|
99
|
+
|
100
|
+
# ELB :
|
101
|
+
class TooManyLoadBalancers < Error; end
|
102
|
+
|
103
|
+
# ELB :
|
104
|
+
class InvalidInstance < Error; end
|
105
|
+
|
106
|
+
# ELB :
|
107
|
+
class InvalidConfigurationRequest < Error; end
|
108
|
+
|
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
|
114
|
+
|
115
|
+
# Server : The server is overloaded and cannot handle the request.
|
116
|
+
class Unavailable < Error; end
|
117
|
+
|
118
|
+
# Server : The provided signature does not match.
|
119
|
+
class SignatureDoesNotMatch < Error; end
|
120
|
+
|
121
|
+
end
|
122
|
+
|