aws 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elb/right_elb_interface.rb +59 -20
- metadata +2 -2
@@ -5,12 +5,12 @@ module Aws
|
|
5
5
|
include AwsBaseInterface
|
6
6
|
|
7
7
|
|
8
|
-
#Amazon
|
9
|
-
API_VERSION = "
|
8
|
+
#Amazon ELB API version being used
|
9
|
+
API_VERSION = "2009-05-15"
|
10
10
|
DEFAULT_HOST = "elasticloadbalancing.amazonaws.com"
|
11
11
|
DEFAULT_PATH = '/'
|
12
|
-
DEFAULT_PROTOCOL = '
|
13
|
-
DEFAULT_PORT =
|
12
|
+
DEFAULT_PROTOCOL = 'https'
|
13
|
+
DEFAULT_PORT = 443
|
14
14
|
|
15
15
|
|
16
16
|
@@bench = AwsBenchmarkingBlock.new
|
@@ -94,11 +94,11 @@ module Aws
|
|
94
94
|
# eg: {:load_balancer_port=>80, :instance_port=>8080, :protocol=>"HTTP"}
|
95
95
|
def create_load_balancer(name, availability_zones, listeners)
|
96
96
|
params = hash_params('AvailabilityZones.member', availability_zones)
|
97
|
-
i =
|
97
|
+
i = 1
|
98
98
|
listeners.each do |l|
|
99
|
-
params["Listeners.member.#{i}.Protocol
|
100
|
-
params["Listeners.member.#{i}.LoadBalancerPort
|
101
|
-
params["Listeners.member.#{i}.
|
99
|
+
params["Listeners.member.#{i}.Protocol"] = "#{l[:protocol]}"
|
100
|
+
params["Listeners.member.#{i}.LoadBalancerPort"] = "#{l[:load_balancer_port]}"
|
101
|
+
params["Listeners.member.#{i}.InstancePort"] = "#{l[:instance_port]}"
|
102
102
|
i += 1
|
103
103
|
end
|
104
104
|
params['LoadBalancerName'] = name
|
@@ -113,13 +113,19 @@ module Aws
|
|
113
113
|
end
|
114
114
|
|
115
115
|
|
116
|
-
|
116
|
+
# name: name of load balancer
|
117
|
+
# instance_ids: array of instance_id's to add to load balancer
|
118
|
+
def register_instances_with_load_balancer(name, instance_ids)
|
117
119
|
params = {}
|
120
|
+
params['LoadBalancerName'] = name
|
118
121
|
|
119
|
-
|
120
|
-
|
122
|
+
i = 1
|
123
|
+
instance_ids.each do |l|
|
124
|
+
params["Instances.member.#{i}.InstanceId"] = "#{l}"
|
125
|
+
i += 1
|
126
|
+
end
|
121
127
|
|
122
|
-
@logger.info("Registering
|
128
|
+
@logger.info("Registering Instances #{instance_ids.join(',')} with Load Balancer '#{name}'")
|
123
129
|
|
124
130
|
link = generate_request("RegisterInstancesWithLoadBalancer", params)
|
125
131
|
resp = request_info(link, QElbRegisterInstanceParser.new(:logger => @logger))
|
@@ -143,6 +149,20 @@ module Aws
|
|
143
149
|
on_exception
|
144
150
|
end
|
145
151
|
|
152
|
+
def delete_load_balancer(name)
|
153
|
+
@logger.info("Deleting Load Balancer - " + name.to_s)
|
154
|
+
|
155
|
+
params = {}
|
156
|
+
params['LoadBalancerName'] = name
|
157
|
+
|
158
|
+
link = generate_request("DeleteLoadBalancer", params)
|
159
|
+
|
160
|
+
resp = request_info(link, QElbDeleteParser.new(:logger => @logger))
|
161
|
+
|
162
|
+
rescue Exception
|
163
|
+
on_exception
|
164
|
+
end
|
165
|
+
|
146
166
|
|
147
167
|
#-----------------------------------------------------------------
|
148
168
|
# PARSERS: Instances
|
@@ -171,15 +191,19 @@ module Aws
|
|
171
191
|
end
|
172
192
|
|
173
193
|
def tagstart(name, attributes)
|
174
|
-
|
175
|
-
|
176
|
-
end
|
177
|
-
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResult/LoadBalancersDescriptions/member/Listeners')
|
194
|
+
# puts 'tagstart ' + name + ' -- ' + @xmlpath
|
195
|
+
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/Listeners')
|
178
196
|
@listener = { }
|
179
197
|
end
|
180
|
-
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResult/
|
198
|
+
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/AvailabilityZones')
|
181
199
|
@availability_zone = { }
|
182
200
|
end
|
201
|
+
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/Instances')
|
202
|
+
@instance = {}
|
203
|
+
end
|
204
|
+
if (name == 'member' && @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions')
|
205
|
+
@member = { :listeners=>[], :availability_zones=>[], :health_check=>{}, :instances=>[] }
|
206
|
+
end
|
183
207
|
|
184
208
|
end
|
185
209
|
|
@@ -191,8 +215,12 @@ module Aws
|
|
191
215
|
@member[:name] = @text
|
192
216
|
when 'CreatedTime' then
|
193
217
|
@member[:created_time] = Time.parse(@text)
|
218
|
+
@member[:created] = @member[:created_time]
|
194
219
|
when 'DNSName' then
|
195
220
|
@member[:dns_name] = @text
|
221
|
+
# Instances
|
222
|
+
when 'InstanceId' then
|
223
|
+
@instance[:instance_id] = @text
|
196
224
|
# Listeners
|
197
225
|
when 'Protocol' then
|
198
226
|
@listener[:protocol] = @text
|
@@ -213,12 +241,14 @@ module Aws
|
|
213
241
|
@member[:health_check][:unhealthy_threshold] = @text.to_i
|
214
242
|
# AvailabilityZones
|
215
243
|
when 'member' then
|
216
|
-
if @xmlpath == 'DescribeLoadBalancersResult/
|
244
|
+
if @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/Listeners'
|
217
245
|
@member[:listeners] << @listener
|
218
|
-
elsif @xmlpath == 'DescribeLoadBalancersResult/
|
246
|
+
elsif @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/AvailabilityZones'
|
219
247
|
@availability_zone = @text
|
220
248
|
@member[:availability_zones] << @availability_zone
|
221
|
-
elsif @xmlpath == 'DescribeLoadBalancersResult/
|
249
|
+
elsif @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions/member/Instances'
|
250
|
+
@member[:instances] << @instance
|
251
|
+
elsif @xmlpath == 'DescribeLoadBalancersResponse/DescribeLoadBalancersResult/LoadBalancerDescriptions'
|
222
252
|
@result << @member
|
223
253
|
end
|
224
254
|
|
@@ -241,6 +271,15 @@ module Aws
|
|
241
271
|
end
|
242
272
|
end
|
243
273
|
|
274
|
+
class QElbDeleteParser < AwsParser
|
275
|
+
|
276
|
+
def reset
|
277
|
+
@result = true
|
278
|
+
end
|
279
|
+
|
280
|
+
|
281
|
+
end
|
282
|
+
|
244
283
|
|
245
284
|
end
|
246
285
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-11-
|
14
|
+
date: 2009-11-05 00:00:00 -08:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|