Skip to content

Commit

Permalink
[elb] Adding ELB-specific indexed_param
Browse files Browse the repository at this point in the history
  • Loading branch information
demonbane authored and Wesley Beary committed May 3, 2010
1 parent 63415a4 commit fc29d82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/fog/aws/elb.rb
Expand Up @@ -19,12 +19,21 @@ def self.new(options={})
Fog::AWS::ELB::Real.new(options)
end

def self.indexed_param(key, values, idx_offset = 0)
params = {}
key.concat(".%") unless key.include?("%")
[*values].each_with_index do |value, index|
params["#{key.gsub("%", (index + idx_offset).to_s)}"] = value
end
return params
end

class Real

# Initialize connection to ELB
#
# ==== Notes
# options parameter must include values for :aws_access_key_id and
# options parameter must include values for :aws_access_key_id and
# :aws_secret_access_key in order to create a connection
#
# ==== Examples
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/elb/describe_load_balancers.rb
Expand Up @@ -36,7 +36,7 @@ class Real
# * 'AvailabilityZones'<~Array> - list of availability zones covered by this load balancer
# * 'Instances'<~Array> - list of instances that the load balancer balances between
def describe_load_balancers(lb_name = [])
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
params = ELB.indexed_param('LoadBalancerNames.member', [*lb_name], 1)
request({
'Action' => 'DescribeLoadBalancers',
:parser => Fog::Parsers::AWS::ELB::DescribeLoadBalancers.new
Expand Down

0 comments on commit fc29d82

Please sign in to comment.