From ba59bd3183b093566fca6235e65512a470889364 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Mon, 30 May 2011 14:34:24 -0700 Subject: [PATCH 1/4] [aws|elb] Update ELB API to version 2011-04-05 --- lib/fog/aws/elb.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fog/aws/elb.rb b/lib/fog/aws/elb.rb index 1da7b2870..94cec3542 100644 --- a/lib/fog/aws/elb.rb +++ b/lib/fog/aws/elb.rb @@ -108,7 +108,7 @@ module Fog :host => @host, :path => @path, :port => @port, - :version => '2010-07-01' + :version => '2011-04-05' } ) begin From e281b14069082e0b47a126dcc5987f570495abd4 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Mon, 30 May 2011 14:45:46 -0700 Subject: [PATCH 2/4] [aws|elb] Fix typo in usage documentation and add 'ap-northeast-1' to regions list. --- lib/fog/aws/elb.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fog/aws/elb.rb b/lib/fog/aws/elb.rb index 94cec3542..d513b0925 100644 --- a/lib/fog/aws/elb.rb +++ b/lib/fog/aws/elb.rb @@ -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. From 9ea567cbcf18eef0aa44c47831d3ecd8e5b8ce04 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Mon, 30 May 2011 15:08:58 -0700 Subject: [PATCH 3/4] [aws|elb] Rearrange DescribeLoadBalancersResult contents to alphabetical order to match the official AWS docs and make it easier to update the list. --- lib/fog/aws/models/elb/load_balancer.rb | 6 +++--- .../requests/elb/describe_load_balancers.rb | 20 +++++++++---------- tests/aws/requests/elb/helper.rb | 12 +++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/fog/aws/models/elb/load_balancer.rb b/lib/fog/aws/models/elb/load_balancer.rb index c36c38c98..f0820806b 100644 --- a/lib/fog/aws/models/elb/load_balancer.rb +++ b/lib/fog/aws/models/elb/load_balancer.rb @@ -6,10 +6,10 @@ 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' def initialize(attributes={}) diff --git a/lib/fog/aws/requests/elb/describe_load_balancers.rb b/lib/fog/aws/requests/elb/describe_load_balancers.rb index ed3f49414..1560611c6 100644 --- a/lib/fog/aws/requests/elb/describe_load_balancers.rb +++ b/lib/fog/aws/requests/elb/describe_load_balancers.rb @@ -17,26 +17,26 @@ 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 # * '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 def describe_load_balancers(lb_name = []) params = AWS.indexed_param('LoadBalancerNames.member', [*lb_name]) request({ diff --git a/tests/aws/requests/elb/helper.rb b/tests/aws/requests/elb/helper.rb index 6c24c4cab..ee5a944fa 100644 --- a/tests/aws/requests/elb/helper.rb +++ b/tests/aws/requests/elb/helper.rb @@ -7,14 +7,14 @@ 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, + "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}, } CREATE_LOAD_BALANCER = BASIC.merge({ From cc2ab5e8ec7cbc33d89ca2d4701dcaec71992aef Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Mon, 30 May 2011 15:57:07 -0700 Subject: [PATCH 4/4] [aws|elb] Add new attributes for 2011-04-05 API. --- lib/fog/aws/models/elb/load_balancer.rb | 1 + lib/fog/aws/parsers/elb/describe_load_balancers.rb | 7 +++++-- lib/fog/aws/requests/elb/describe_load_balancers.rb | 5 +++++ tests/aws/requests/elb/helper.rb | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/fog/aws/models/elb/load_balancer.rb b/lib/fog/aws/models/elb/load_balancer.rb index f0820806b..3041c0517 100644 --- a/lib/fog/aws/models/elb/load_balancer.rb +++ b/lib/fog/aws/models/elb/load_balancer.rb @@ -11,6 +11,7 @@ module Fog 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) diff --git a/lib/fog/aws/parsers/elb/describe_load_balancers.rb b/lib/fog/aws/parsers/elb/describe_load_balancers.rb index 1025b29d5..8efbfa641 100644 --- a/lib/fog/aws/parsers/elb/describe_load_balancers.rb +++ b/lib/fog/aws/parsers/elb/describe_load_balancers.rb @@ -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' diff --git a/lib/fog/aws/requests/elb/describe_load_balancers.rb b/lib/fog/aws/requests/elb/describe_load_balancers.rb index 1560611c6..a828c9961 100644 --- a/lib/fog/aws/requests/elb/describe_load_balancers.rb +++ b/lib/fog/aws/requests/elb/describe_load_balancers.rb @@ -18,6 +18,8 @@ module Fog # * 'DescribeLoadBalancersResult'<~Hash>: # * 'LoadBalancerDescriptions'<~Array> # * '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 # * 'DNSName'<~String> - external DNS name of load balancer # * 'HealthCheck'<~Hash>: @@ -37,6 +39,9 @@ module Fog # * '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 + # * '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({ diff --git a/tests/aws/requests/elb/helper.rb b/tests/aws/requests/elb/helper.rb index ee5a944fa..7ee8dcfb1 100644 --- a/tests/aws/requests/elb/helper.rb +++ b/tests/aws/requests/elb/helper.rb @@ -8,6 +8,8 @@ class AWS LOAD_BALANCER = { "AvailabilityZones" => Array, + "CanonicalHostedZoneName" => String, + "CanonicalHostedZoneNameID" => String, "CreatedTime" => Time, "DNSName" => String, "HealthCheck" => {"HealthyThreshold" => Integer, "Timeout" => Integer, "UnhealthyThreshold" => Integer, "Interval" => Integer, "Target" => String}, @@ -15,6 +17,7 @@ class AWS "ListenerDescriptions" => Array, "LoadBalancerName" => String, "Policies" => {"LBCookieStickinessPolicies" => Array, "AppCookieStickinessPolicies" => Array}, + "SourceSecurityGroup" => {"GroupName" => String, "OwnerAlias" => String}, } CREATE_LOAD_BALANCER = BASIC.merge({