1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #339 from bgentry/elb_2011_api_update

[aws|elb] 2011-04-05 API update
This commit is contained in:
Wesley Beary 2011-05-31 10:43:04 -07:00
commit 377188973b
5 changed files with 35 additions and 23 deletions

View file

@ -58,7 +58,7 @@ module Fog
#
# ==== Parameters
# * options<~Hash> - config arguments for connection. Defaults to {}.
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1'i, 'ap-southeast-1']
# * region<~String> - optional region to use, in ['eu-west-1', 'us-east-1', 'us-west-1', 'ap-northeast-1', 'ap-southeast-1']
#
# ==== Returns
# * ELB object with connection to AWS.
@ -108,7 +108,7 @@ module Fog
:host => @host,
:path => @path,
:port => @port,
:version => '2010-07-01'
:version => '2011-04-05'
}
)
begin

View file

@ -6,11 +6,12 @@ module Fog
class LoadBalancer < Fog::Model
identity :id, :aliases => 'LoadBalancerName'
attribute :created_at, :aliases => 'CreatedTime'
attribute :health_check, :aliases => 'HealthCheck'
attribute :dns_name, :aliases => 'DNSName'
attribute :availability_zones, :aliases => 'AvailabilityZones'
attribute :created_at, :aliases => 'CreatedTime'
attribute :dns_name, :aliases => 'DNSName'
attribute :health_check, :aliases => 'HealthCheck'
attribute :instances, :aliases => 'Instances'
attribute :source_group, :aliases => 'SourceSecurityGroup'
def initialize(attributes={})
attributes[:availability_zones] ||= %w(us-east-1a us-east-1b us-east-1c us-east-1d)

View file

@ -14,7 +14,7 @@ module Fog
end
def reset_load_balancer
@load_balancer = { 'ListenerDescriptions' => [], 'Instances' => [], 'AvailabilityZones' => [], 'Policies' => {'AppCookieStickinessPolicies' => [], 'LBCookieStickinessPolicies' => [] }, 'HealthCheck' => {} }
@load_balancer = { 'ListenerDescriptions' => [], 'Instances' => [], 'AvailabilityZones' => [], 'Policies' => {'AppCookieStickinessPolicies' => [], 'LBCookieStickinessPolicies' => [] }, 'HealthCheck' => {}, 'SourceSecurityGroup' => {} }
end
def reset_listener_description
@ -66,7 +66,7 @@ module Fog
reset_load_balancer
end
when 'LoadBalancerName', 'DNSName'
when 'CanonicalHostedZoneName', 'CanonicalHostedZoneNameID', 'LoadBalancerName', 'DNSName'
@load_balancer[name] = value
when 'CreatedTime'
@load_balancer[name] = Time.parse(value)
@ -95,6 +95,9 @@ module Fog
when 'LBCookieStickinessPolicies'
@in_lb_cookies = false
when 'OwnerAlias', 'GroupName'
@load_balancer['SourceSecurityGroup'][name] = value
when 'Interval', 'HealthyThreshold', 'Timeout', 'UnhealthyThreshold'
@load_balancer['HealthCheck'][name] = value.to_i
when 'Target'

View file

@ -17,26 +17,31 @@ module Fog
# * 'RequestId'<~String> - Id of request
# * 'DescribeLoadBalancersResult'<~Hash>:
# * 'LoadBalancerDescriptions'<~Array>
# * 'LoadBalancerName'<~String> - name of load balancer
# * 'DNSName'<~String> - external DNS name of load balancer
# * 'AvailabilityZones'<~Array> - list of availability zones covered by this load balancer
# * 'CanonicalHostedZoneName'<~String> - name of the Route 53 hosted zone associated with the load balancer
# * 'CanonicalHostedZoneNameID'<~String> - ID of the Route 53 hosted zone associated with the load balancer
# * 'CreatedTime'<~Time> - time load balancer was created
# * 'ListenerDescriptions'<~Array>
# * 'PolicyNames'<~Array> - list of policies enabled
# * 'Listener'<~Hash>:
# * 'InstancePort'<~Integer> - port on instance that requests are sent to
# * 'Protocol'<~String> - transport protocol used for routing in [TCP, HTTP]
# * 'LoadBalancerPort'<~Integer> - port that load balancer listens on for requests
# * 'DNSName'<~String> - external DNS name of load balancer
# * 'HealthCheck'<~Hash>:
# * 'HealthyThreshold'<~Integer> - number of consecutive health probe successes required before moving the instance to the Healthy state
# * 'Timeout'<~Integer> - number of seconds after which no response means a failed health probe
# * 'Interval'<~Integer> - interval (in seconds) between health checks of an individual instance
# * 'UnhealthyThreshold'<~Integer> - number of consecutive health probe failures that move the instance to the unhealthy state
# * 'Target'<~String> - string describing protocol type, port and URL to check
# * 'Instances'<~Array> - list of instances that the load balancer balances between
# * 'ListenerDescriptions'<~Array>
# * 'PolicyNames'<~Array> - list of policies enabled
# * 'Listener'<~Hash>:
# * 'InstancePort'<~Integer> - port on instance that requests are sent to
# * 'Protocol'<~String> - transport protocol used for routing in [TCP, HTTP]
# * 'LoadBalancerPort'<~Integer> - port that load balancer listens on for requests
# * 'LoadBalancerName'<~String> - name of load balancer
# * 'Policies'<~Hash>:
# * 'LBCookieStickinessPolicies'<~Array> - list of Load Balancer Generated Cookie Stickiness policies for the LoadBalancer
# * 'AppCookieStickinessPolicies'<~Array> - list of Application Generated Cookie Stickiness policies for the LoadBalancer
# * 'AvailabilityZones'<~Array> - list of availability zones covered by this load balancer
# * 'Instances'<~Array> - list of instances that the load balancer balances between
# * 'SourceSecurityGroup'<~Hash>:
# * 'GroupName'<~String> - Name of the source security group to use with inbound security group rules
# * 'OwnerAlias'<~String> - Owner of the source security group
def describe_load_balancers(lb_name = [])
params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name])
request({

View file

@ -7,14 +7,17 @@ class AWS
}
LOAD_BALANCER = {
"CreatedTime" => Time,
"ListenerDescriptions" => Array,
"HealthCheck" => {"HealthyThreshold" => Integer, "Timeout" => Integer, "UnhealthyThreshold" => Integer, "Interval" => Integer, "Target" => String},
"Policies" => {"LBCookieStickinessPolicies" => Array, "AppCookieStickinessPolicies" => Array},
"AvailabilityZones" => Array,
"CanonicalHostedZoneName" => String,
"CanonicalHostedZoneNameID" => String,
"CreatedTime" => Time,
"DNSName" => String,
"LoadBalancerName"=> String,
"Instances"=> Array
"HealthCheck" => {"HealthyThreshold" => Integer, "Timeout" => Integer, "UnhealthyThreshold" => Integer, "Interval" => Integer, "Target" => String},
"Instances" => Array,
"ListenerDescriptions" => Array,
"LoadBalancerName" => String,
"Policies" => {"LBCookieStickinessPolicies" => Array, "AppCookieStickinessPolicies" => Array},
"SourceSecurityGroup" => {"GroupName" => String, "OwnerAlias" => String},
}
CREATE_LOAD_BALANCER = BASIC.merge({