You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/11/10 01:04:08 UTC

[1/6] libcloud git commit: added LB_ALB_PARAMS to secrets.py-dist

Repository: libcloud
Updated Branches:
  refs/heads/trunk a58a6e5fa -> ef3363df8


added LB_ALB_PARAMS to secrets.py-dist


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/74e3398d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/74e3398d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/74e3398d

Branch: refs/heads/trunk
Commit: 74e3398d0f4d1549eee3d37f09cf0c93ee31a2d0
Parents: 3ef8d41
Author: Anton Kozyrev <an...@gmail.com>
Authored: Wed Nov 2 13:21:14 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:31:25 2016 +1100

----------------------------------------------------------------------
 libcloud/test/secrets.py-dist | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/74e3398d/libcloud/test/secrets.py-dist
----------------------------------------------------------------------
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index e2e6165..8c73f54 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -64,6 +64,7 @@ STORAGE_AZURE_BLOBS_PARAMS = ('account', 'cGFzc3dvcmQ=')
 # Loadbalancer
 LB_BRIGHTBOX_PARAMS = ('user', 'key')
 LB_ELB_PARAMS = ('access_id', 'secret', 'region')
+LB_ALB_PARAMS = ('access_id', 'secret', 'region')
 LB_SLB_PARAMS = ('access_id', 'secret', 'region')
 
 # DNS


[6/6] libcloud git commit: update provider tables

Posted by an...@apache.org.
update provider tables


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ef3363df
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ef3363df
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ef3363df

Branch: refs/heads/trunk
Commit: ef3363df892a7dfdca68712623c372b5bf79fc79
Parents: feb18f7
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Nov 10 11:54:29 2016 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:54:29 2016 +1100

----------------------------------------------------------------------
 docs/compute/_supported_methods_block_storage.rst       | 4 ++--
 docs/compute/_supported_methods_key_pair_management.rst | 2 +-
 docs/container/_supported_methods.rst                   | 2 +-
 docs/loadbalancer/_supported_methods.rst                | 2 ++
 docs/loadbalancer/_supported_providers.rst              | 2 ++
 5 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef3363df/docs/compute/_supported_methods_block_storage.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst
index 877365d..2543ade 100644
--- a/docs/compute/_supported_methods_block_storage.rst
+++ b/docs/compute/_supported_methods_block_storage.rst
@@ -13,7 +13,7 @@ Provider                              list volumes create volume destroy volume
 `CloudSigma (API v2.0)`_              no           no            no             no            no            no             no             
 `CloudStack`_                         yes          yes           yes            yes           yes           no             yes            
 `Cloudwatt`_                          yes          yes           yes            yes           yes           yes            yes            
-`DigitalOcean`_                       yes          yes           yes            yes           yes           no             no             
+`DigitalOcean`_                       yes          yes           yes            yes           yes           yes            yes            
 `DimensionData`_                      no           no            no             no            no            no             no             
 `Amazon EC2`_                         yes          yes           yes            yes           yes           yes            yes            
 `Enomaly Elastic Computing Platform`_ no           no            no             no            no            no             no             
@@ -41,7 +41,7 @@ Provider                              list volumes create volume destroy volume
 `OpenStack`_                          yes          yes           yes            yes           yes           no             no             
 `Outscale INC`_                       yes          yes           yes            yes           yes           yes            yes            
 `Outscale SAS`_                       yes          yes           yes            yes           yes           yes            yes            
-`Ovh`_                                yes          yes           yes            yes           yes           no             no             
+`Ovh`_                                yes          yes           yes            yes           yes           yes            yes            
 `Packet`_                             no           no            no             no            no            no             no             
 `ProfitBricks`_                       yes          yes           yes            yes           yes           no             no             
 `Rackspace Cloud (Next Gen)`_         yes          yes           yes            yes           yes           yes            yes            

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef3363df/docs/compute/_supported_methods_key_pair_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst
index d9eadf5..0dc459a 100644
--- a/docs/compute/_supported_methods_key_pair_management.rst
+++ b/docs/compute/_supported_methods_key_pair_management.rst
@@ -56,7 +56,7 @@ Provider                              list key pairs get key pair create key pai
 `Voxel VoxCLOUD`_                     no             no           no              no                            no                          no             
 `vps.net`_                            no             no           no              no                            no                          no             
 `VMware vSphere`_                     no             no           no              no                            no                          no             
-`Vultr`_                              yes            no           no              no                            no                          no             
+`Vultr`_                              yes            no           yes             no                            no                          yes            
 ===================================== ============== ============ =============== ============================= =========================== ===============
 
 .. _`Abiquo`: http://www.abiquo.com/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef3363df/docs/container/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/container/_supported_methods.rst b/docs/container/_supported_methods.rst
index 5d073c7..b0be075 100644
--- a/docs/container/_supported_methods.rst
+++ b/docs/container/_supported_methods.rst
@@ -7,7 +7,7 @@ Provider                            install image list images deploy container g
 `Amazon Elastic Container Service`_ no            yes         yes              yes           yes             yes            yes               yes               yes             no             yes            yes             yes          
 `Joyent Triton`_                    yes           yes         yes              yes           yes             yes            yes               yes               yes             no             no             no              no           
 `Kubernetes`_                       no            no          yes              yes           no              no             no                yes               yes             no             yes            yes             yes          
-`Rancher`_                          no            no          yes              yes           no              yes            no                yes               yes             no             no             no              no           
+`Rancher`_                          no            no          yes              yes           yes             yes            no                yes               yes             no             no             no              no           
 =================================== ============= =========== ================ ============= =============== ============== ================= ================= =============== ============== ============== =============== =============
 
 .. _`Docker`: http://docker.io

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef3363df/docs/loadbalancer/_supported_methods.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/_supported_methods.rst b/docs/loadbalancer/_supported_methods.rst
index ddecad5..7e34af7 100644
--- a/docs/loadbalancer/_supported_methods.rst
+++ b/docs/loadbalancer/_supported_methods.rst
@@ -3,6 +3,7 @@
 ====================================== =============== ============== ============ ============= ============= ===================
 Provider                               create balancer list balancers list members attach member detach member attach compute node
 ====================================== =============== ============== ============ ============= ============= ===================
+`Amazon Application Load Balancing`_   no              yes            yes          no            no            no                 
 `Aliyun Server Load Balancer`_         yes             yes            yes          yes           yes           yes                
 `Brightbox`_                           yes             yes            yes          yes           yes           yes                
 `CloudStack`_                          yes             yes            yes          yes           yes           no                 
@@ -15,6 +16,7 @@ Provider                               create balancer list balancers list membe
 `Softlayer Load Balancing`_            no              yes            yes          yes           yes           no                 
 ====================================== =============== ============== ============ ============= ============= ===================
 
+.. _`Amazon Application Load Balancing`: http://aws.amazon.com/elasticloadbalancing/
 .. _`Aliyun Server Load Balancer`: https://www.aliyun.com/product/slb
 .. _`Brightbox`: http://www.brightbox.co.uk/
 .. _`CloudStack`: http://cloudstack.org/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ef3363df/docs/loadbalancer/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/_supported_providers.rst b/docs/loadbalancer/_supported_providers.rst
index ae14312..c99cecb 100644
--- a/docs/loadbalancer/_supported_providers.rst
+++ b/docs/loadbalancer/_supported_providers.rst
@@ -3,6 +3,7 @@
 ====================================== ================================================== ================= ============================ ================================================== ==============================
 Provider                               Documentation                                      Provider Constant Supported Regions            Module                                             Class Name                    
 ====================================== ================================================== ================= ============================ ================================================== ==============================
+`Amazon Application Load Balancing`_                                                      ALB               single region driver         :mod:`libcloud.loadbalancer.drivers.alb`           :class:`ApplicationLBDriver`  
 `Aliyun Server Load Balancer`_                                                            ALIYUN_SLB        single region driver         :mod:`libcloud.loadbalancer.drivers.slb`           :class:`SLBDriver`            
 `Brightbox`_                                                                              BRIGHTBOX         single region driver         :mod:`libcloud.loadbalancer.drivers.brightbox`     :class:`BrightboxLBDriver`    
 `CloudStack`_                                                                             CLOUDSTACK        single region driver         :mod:`libcloud.loadbalancer.drivers.cloudstack`    :class:`CloudStackLBDriver`   
@@ -15,6 +16,7 @@ Provider                               Documentation
 `Softlayer Load Balancing`_                                                               SOFTLAYER         single region driver         :mod:`libcloud.loadbalancer.drivers.softlayer`     :class:`SoftlayerLBDriver`    
 ====================================== ================================================== ================= ============================ ================================================== ==============================
 
+.. _`Amazon Application Load Balancing`: http://aws.amazon.com/elasticloadbalancing/
 .. _`Aliyun Server Load Balancer`: https://www.aliyun.com/product/slb
 .. _`Brightbox`: http://www.brightbox.co.uk/
 .. _`CloudStack`: http://cloudstack.org/


[5/6] libcloud git commit: changes for #936

Posted by an...@apache.org.
changes for #936


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/feb18f71
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/feb18f71
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/feb18f71

Branch: refs/heads/trunk
Commit: feb18f714f1c9d7b7ccdfa2bc6b13cb5ce9026ca
Parents: 4454f73
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Nov 10 11:42:45 2016 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:42:45 2016 +1100

----------------------------------------------------------------------
 CHANGES.rst | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/feb18f71/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 014f656..85a1bec 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -72,6 +72,13 @@ Container
   (GITHUB-918)
   [Pavlos Tzianos]
 
+Load Balancing
+~~~~~~~~~~~~~~
+
+- Introduce AWS Application Load Balancer (ALB) driver
+  (LIBCLOUD-869, GITHUB-936)
+  [Anton Kozyrev]
+
 Storage
 ~~~~~~~
 


[3/6] libcloud git commit: - AWS ALB driver tests for get methods

Posted by an...@apache.org.
- AWS ALB driver tests for get methods


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3ef8d410
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3ef8d410
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3ef8d410

Branch: refs/heads/trunk
Commit: 3ef8d410d929cadfc88d118323b2f0e3c86efa62
Parents: be673ee
Author: Anton Kozyrev <an...@gmail.com>
Authored: Tue Nov 1 17:35:26 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:31:25 2016 +1100

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/alb.py            |   4 +-
 .../alb/describe_load_balancer_listeters.xml    |  27 ++++
 .../alb/describe_load_balancer_rules.xml        |  21 +++
 .../describe_load_balancer_target_groups.xml    |  29 ++++
 .../fixtures/alb/describe_load_balancers.xml    |  31 ++++
 .../loadbalancer/fixtures/alb/describe_tags.xml |  18 +++
 .../fixtures/alb/describe_target_health.xml     |  19 +++
 libcloud/test/loadbalancer/test_alb.py          | 158 +++++++++++++++++++
 8 files changed, 305 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/loadbalancer/drivers/alb.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/alb.py b/libcloud/loadbalancer/drivers/alb.py
index 603bd7c..fb90515 100644
--- a/libcloud/loadbalancer/drivers/alb.py
+++ b/libcloud/loadbalancer/drivers/alb.py
@@ -148,7 +148,7 @@ class ApplicationLBDriver(Driver):
         return tags
 
     def _to_rule(self, el):
-        def __to_bool(val):
+        def __to_bool__(val):
             return val.lower() in ("yes", "true", "t", "1")
 
         id = findtext(element=el, xpath='RuleArn', namespace=NS)
@@ -165,7 +165,7 @@ class ApplicationLBDriver(Driver):
 
         rule = {
             'id': id,
-            'is_default': __to_bool(is_default),
+            'is_default': __to_bool__(is_default),
             'priority': priority,
             'target_group': target_group,
             'conditions': conditions

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_listeters.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_listeters.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_listeters.xml
new file mode 100644
index 0000000..273615c
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_listeters.xml
@@ -0,0 +1,27 @@
+<DescribeListenersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+    <DescribeListenersResult>
+        <Listeners>
+            <member>
+                <LoadBalancerArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/1111111111111111</LoadBalancerArn>
+                <Protocol>HTTPS</Protocol>
+                <Certificates>
+                    <member>
+                        <CertificateArn>arn:aws:iam::111111111111:server-certificate/test.certificate</CertificateArn>
+                    </member>
+                </Certificates>
+                <Port>1443</Port>
+                <ListenerArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:listener/app/Test-ALB/1111111111111111/1111111111111111</ListenerArn>
+                <SslPolicy>ELBSecurityPolicy-2015-05</SslPolicy>
+                <DefaultActions>
+                    <member>
+                        <Type>forward</Type>
+                        <TargetGroupArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/TEST-TARGET-GROUP1/1111111111111111</TargetGroupArn>
+                    </member>
+                </DefaultActions>
+            </member>
+        </Listeners>
+    </DescribeListenersResult>
+    <ResponseMetadata>
+        <RequestId>77834e15-a03a-11e6-a23e-41d3227189e3</RequestId>
+    </ResponseMetadata>
+</DescribeListenersResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_rules.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_rules.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_rules.xml
new file mode 100644
index 0000000..9282ab8
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_rules.xml
@@ -0,0 +1,21 @@
+<DescribeRulesResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+    <DescribeRulesResult>
+        <Rules>
+            <member>
+                <IsDefault>true</IsDefault>
+                <Conditions />
+                <Priority>default</Priority>
+                <Actions>
+                    <member>
+                        <Type>forward</Type>
+                        <TargetGroupArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/TEST-TARGET-GROUP1/1111111111111111</TargetGroupArn>
+                    </member>
+                </Actions>
+                <RuleArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:listener-rule/app/Test-Develop-App-LB/1111111111111111/1111111111111111/1111111111111111</RuleArn>
+            </member>
+        </Rules>
+    </DescribeRulesResult>
+    <ResponseMetadata>
+        <RequestId>a6519d8d-a03b-11e6-90ef-9138cf7efdbc</RequestId>
+    </ResponseMetadata>
+</DescribeRulesResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_target_groups.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_target_groups.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_target_groups.xml
new file mode 100644
index 0000000..e2f704a
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancer_target_groups.xml
@@ -0,0 +1,29 @@
+<DescribeTargetGroupsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+    <DescribeTargetGroupsResult>
+        <TargetGroups>
+            <member>
+                <TargetGroupArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/TEST-TARGET-GROUP1/1111111111111111</TargetGroupArn>
+                <HealthCheckTimeoutSeconds>5</HealthCheckTimeoutSeconds>
+                <HealthCheckPort>traffic-port</HealthCheckPort>
+                <Matcher>
+                    <HttpCode>200</HttpCode>
+                </Matcher>
+                <TargetGroupName>TEST-TARGET-GROUP1</TargetGroupName>
+                <HealthCheckProtocol>HTTPS</HealthCheckProtocol>
+                <HealthCheckPath>/apps/health</HealthCheckPath>
+                <Protocol>HTTPS</Protocol>
+                <Port>1443</Port>
+                <VpcId>vpc-11111111</VpcId>
+                <HealthyThresholdCount>5</HealthyThresholdCount>
+                <HealthCheckIntervalSeconds>30</HealthCheckIntervalSeconds>
+                <LoadBalancerArns>
+                    <member>arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/1111111111111111</member>
+                </LoadBalancerArns>
+                <UnhealthyThresholdCount>2</UnhealthyThresholdCount>
+            </member>
+        </TargetGroups>
+    </DescribeTargetGroupsResult>
+    <ResponseMetadata>
+        <RequestId>20eca3ac-a03c-11e6-a91a-7f816344a331</RequestId>
+    </ResponseMetadata>
+</DescribeTargetGroupsResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancers.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancers.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancers.xml
new file mode 100644
index 0000000..95ef7d2
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_load_balancers.xml
@@ -0,0 +1,31 @@
+<DescribeLoadBalancersResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+  <DescribeLoadBalancersResult>
+    <LoadBalancers>
+      <member>
+        <LoadBalancerArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/1111111111111111</LoadBalancerArn>
+        <Scheme>internal</Scheme>
+        <AvailabilityZones>
+          <member>
+            <SubnetId>subnet-11111111</SubnetId>
+            <ZoneName>us-east-1b</ZoneName>
+          </member>
+        </AvailabilityZones>
+        <DNSName>internal-Test-ALB-1111111111.us-east-1.elb.amazonaws.com</DNSName>
+        <Type>application</Type>
+        <LoadBalancerName>Test-ALB</LoadBalancerName>
+        <VpcId>vpc-11111111</VpcId>
+        <CanonicalHostedZoneId>11111111111111</CanonicalHostedZoneId>
+        <CreatedTime>2016-10-02T20:11:22.980Z</CreatedTime>
+        <SecurityGroups>
+          <member>sg-11111111</member>
+        </SecurityGroups>
+        <State>
+          <Code>active</Code>
+        </State>
+      </member>
+    </LoadBalancers>
+  </DescribeLoadBalancersResult>
+  <ResponseMetadata>
+    <RequestId>00904965-a037-11e6-b59a-ff82c1d23c14</RequestId>
+  </ResponseMetadata>
+</DescribeLoadBalancersResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_tags.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_tags.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_tags.xml
new file mode 100644
index 0000000..8b14caf
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_tags.xml
@@ -0,0 +1,18 @@
+<DescribeTagsResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+    <DescribeTagsResult>
+        <TagDescriptions>
+            <member>
+                <ResourceArn>arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/111111111111</ResourceArn>
+                <Tags>
+                    <member>
+                        <Value>lima</Value>
+                        <Key>project</Key>
+                    </member>
+                </Tags>
+            </member>
+        </TagDescriptions>
+    </DescribeTagsResult>
+    <ResponseMetadata>
+        <RequestId>34cba10d-a040-11e6-9d2a-7fea45a4c556</RequestId>
+    </ResponseMetadata>
+</DescribeTagsResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/fixtures/alb/describe_target_health.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/fixtures/alb/describe_target_health.xml b/libcloud/test/loadbalancer/fixtures/alb/describe_target_health.xml
new file mode 100644
index 0000000..9310f97
--- /dev/null
+++ b/libcloud/test/loadbalancer/fixtures/alb/describe_target_health.xml
@@ -0,0 +1,19 @@
+<DescribeTargetHealthResponse xmlns="http://elasticloadbalancing.amazonaws.com/doc/2015-12-01/">
+    <DescribeTargetHealthResult>
+        <TargetHealthDescriptions>
+            <member>
+                <HealthCheckPort>3443</HealthCheckPort>
+                <TargetHealth>
+                    <State>healthy</State>
+                </TargetHealth>
+                <Target>
+                    <Port>3443</Port>
+                    <Id>i-01111111111111111</Id>
+                </Target>
+            </member>
+        </TargetHealthDescriptions>
+    </DescribeTargetHealthResult>
+    <ResponseMetadata>
+        <RequestId>3e63f250-a03f-11e6-b07a-97abc256eba0</RequestId>
+    </ResponseMetadata>
+</DescribeTargetHealthResponse>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/3ef8d410/libcloud/test/loadbalancer/test_alb.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_alb.py b/libcloud/test/loadbalancer/test_alb.py
new file mode 100644
index 0000000..700c5a3
--- /dev/null
+++ b/libcloud/test/loadbalancer/test_alb.py
@@ -0,0 +1,158 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import unittest
+
+from libcloud.utils.py3 import httplib
+from libcloud.loadbalancer.drivers.alb import ApplicationLBDriver
+from libcloud.loadbalancer.types import State
+
+from libcloud.test import MockHttpTestCase
+from libcloud.test.secrets import LB_ALB_PARAMS
+from libcloud.test.file_fixtures import LoadBalancerFileFixtures
+
+
+class ApplicationLBTests(unittest.TestCase):
+    def setUp(self):
+        ApplicationLBMockHttp.test = self
+        ApplicationLBDriver.connectionCls.conn_classes = (None, ApplicationLBMockHttp)
+        ApplicationLBMockHttp.type = None
+        ApplicationLBMockHttp.use_param = 'Action'
+        self.driver = ApplicationLBDriver(*LB_ALB_PARAMS)
+
+    def test_instantiate_driver_with_token(self):
+        token = 'temporary_credentials_token'
+        driver = ApplicationLBDriver(*LB_ALB_PARAMS, **{'token': token})
+        self.assertTrue(hasattr(driver, 'token'), 'Driver has no attribute token')
+        self.assertEquals(token, driver.token, "Driver token does not match with provided token")
+
+    def test_driver_with_token_signature_version(self):
+        token = 'temporary_credentials_token'
+        driver = ApplicationLBDriver(*LB_ALB_PARAMS, **{'token': token})
+        kwargs = driver._ex_connection_class_kwargs()
+        self.assertTrue(('signature_version' in kwargs), 'Driver has no attribute signature_version')
+        self.assertEquals('4', kwargs['signature_version'], 'Signature version is not 4 with temporary credentials')
+
+    def test_list_protocols(self):
+        protocols = self.driver.list_protocols()
+        self.assertEqual(len(protocols), 2)
+        self.assertTrue('http' in protocols)
+        self.assertTrue('https' in protocols)
+
+    def test_list_balancers(self):
+        balancers = self.driver.list_balancers()
+        self.assertEqual(len(balancers), 1)
+        self.assertEqual(
+            balancers[0].id,
+            'arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/1111111111111111'
+        )
+        self.assertEqual(balancers[0].name, 'Test-ALB')
+
+    def test_get_balancer(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        self.assertEqual(
+            balancer.id,
+            'arn:aws:elasticloadbalancing:us-east-1:111111111111:loadbalancer/app/Test-ALB/1111111111111111'
+        )
+        self.assertEqual(balancer.name, 'Test-ALB')
+        self.assertEqual(balancer.state, State.UNKNOWN)
+
+    def test_balancer_list_members(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        members = balancer.list_members()
+        self.assertEqual(len(members), 1)
+        self.assertEqual(members[0].balancer, balancer)
+        self.assertEqual('i-01111111111111111', members[0].id)
+
+    def test_ex_balancer_list_listeners(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        self.assertTrue(('listeners' in balancer.extra), 'No listeners dict found in balancer.extra')
+        listeners = self.driver.ex_balancer_list_listeners(balancer)
+        self.assertEqual(len(listeners), 1)
+
+    def test_ex_get_balancer_tags(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        self.assertTrue(('tags' in balancer.extra), 'No tags dict found in balancer.extra')
+        tags = self.driver._ex_get_balancer_tags(balancer)
+        self.assertEqual(tags['project'], 'lima')
+
+    def test_ex_get_target_group_members(self):
+        target_group_members = self.driver._ex_get_target_group_members(
+            'arn:aws:elasticloadbalancing:us-east-1:111111111111:targetgroup/TEST-TARGET-GROUP1/1111111111111111'
+        )
+        self.assertEqual(len(target_group_members), 1)
+        self.assertTrue(('id' in target_group_members[0]), 'Target group member is missing "id" field')
+        self.assertTrue(('port' in target_group_members[0]), 'Target group member is missing "port" field')
+        self.assertTrue(('health' in target_group_members[0]), 'Target group member is missing "health" field')
+
+    def test_ex_get_balancer_target_groups(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        target_groups = self.driver._ex_get_balancer_target_groups(balancer)
+        self.assertEqual(len(target_groups), 1)
+        self.assertTrue(('id' in target_groups[0]), 'Target group is missing "id" field')
+        self.assertTrue(('name' in target_groups[0]), 'Target group is missing "port" field')
+        self.assertTrue(('members' in target_groups[0]), 'Target group is missing "members" field')
+
+    def test_ex_get_balancer_listeners(self):
+        balancer = self.driver.get_balancer(balancer_id='Test-ALB')
+        listeners = self.driver._ex_get_balancer_listeners(balancer)
+        self.assertEqual(len(listeners), 1)
+        self.assertTrue(('id' in listeners[0]), 'Listener is missing "id" field')
+        self.assertTrue(('port' in listeners[0]), 'Listener is missing "port" field')
+        self.assertTrue(('protocol' in listeners[0]), 'Listener is missing "protocol" field')
+        self.assertTrue(('rules' in listeners[0]), 'Listener is missing "rules" field')
+
+    def test_ex_get_rules_for_listener(self):
+        listener_rules = self.driver._ex_get_rules_for_listener(
+            'arn:aws:elasticloadbalancing:us-east-1:111111111111:listener/app/Test-ALB/1111111111111111/1111111111111111'
+        )
+        self.assertEqual(len(listener_rules), 1)
+        self.assertTrue(('id' in listener_rules[0]), 'Rule is missing "id" field')
+        self.assertTrue(('is_default' in listener_rules[0]), 'Rule is missing "port" field')
+        self.assertTrue(('priority' in listener_rules[0]), 'Rule is missing "priority" field')
+        self.assertTrue(('target_group' in listener_rules[0]), 'Rule is missing "target_group" field')
+        self.assertTrue(('conditions' in listener_rules[0]), 'Rule is missing "conditions" field')
+
+class ApplicationLBMockHttp(MockHttpTestCase):
+    fixtures = LoadBalancerFileFixtures('alb')
+
+    def _2015_12_01_DescribeLoadBalancers(self, method, url, body, headers):
+        body = self.fixtures.load('describe_load_balancers.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _2015_12_01_DescribeListeners(self, method, url, body, headers):
+        body = self.fixtures.load('describe_load_balancer_listeters.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _2015_12_01_DescribeRules(self, method, url, body, headers):
+        body = self.fixtures.load('describe_load_balancer_rules.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _2015_12_01_DescribeTargetGroups(self, method, url, body, headers):
+        body = self.fixtures.load('describe_load_balancer_target_groups.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _2015_12_01_DescribeTargetHealth(self, method, url, body, headers):
+        body = self.fixtures.load('describe_target_health.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+    def _2015_12_01_DescribeTags(self, method, url, body, headers):
+        body = self.fixtures.load('describe_tags.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+
+if __name__ == "__main__":
+    sys.exit(unittest.main())


[4/6] libcloud git commit: - fixes for tests Closes #936

Posted by an...@apache.org.
- fixes for tests
Closes #936


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4454f736
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4454f736
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4454f736

Branch: refs/heads/trunk
Commit: 4454f736a9a7e56236bba8d9a9584cb72a59efd2
Parents: 74e3398
Author: Anton Kozyrev <an...@gmail.com>
Authored: Wed Nov 2 13:35:42 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:32:09 2016 +1100

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/alb.py   | 52 +++++++++++++++++++++--------
 libcloud/test/loadbalancer/test_alb.py |  1 +
 2 files changed, 40 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4454f736/libcloud/loadbalancer/drivers/alb.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/alb.py b/libcloud/loadbalancer/drivers/alb.py
index fb90515..f712fa9 100644
--- a/libcloud/loadbalancer/drivers/alb.py
+++ b/libcloud/loadbalancer/drivers/alb.py
@@ -17,7 +17,6 @@ __all__ = [
     'ApplicationLBDriver'
 ]
 
-from libcloud.utils.py3 import httplib
 from libcloud.utils.xml import findtext, findall
 from libcloud.loadbalancer.types import State
 from libcloud.loadbalancer.base import Driver, LoadBalancer, Member
@@ -54,7 +53,9 @@ class ApplicationLBDriver(Driver):
 
     def __init__(self, access_id, secret, region, token=None):
         self.token = token
-        super(ApplicationLBDriver, self).__init__(access_id, secret, token=token)
+        super(ApplicationLBDriver, self).__init__(
+            access_id, secret, token=token
+        )
         self.region = region
         self.region_name = region
         self.connection.host = HOST % (region)
@@ -83,7 +84,9 @@ class ApplicationLBDriver(Driver):
 
     def _to_listeners(self, data):
         xpath = 'DescribeListenersResult/Listeners/member'
-        return [self._to_listener(el) for el in findall(element=data, xpath=xpath, namespace=NS)]
+        return [self._to_listener(el) for el in findall(
+            element=data, xpath=xpath, namespace=NS
+        )]
 
     def _to_listener(self, el):
         listener_arn = findtext(element=el, xpath='ListenerArn', namespace=NS)
@@ -97,10 +100,16 @@ class ApplicationLBDriver(Driver):
 
     def _to_targets(self, data):
         xpath = 'DefaultActions/member'
-        return [self._to_target(el) for el in findall(element=data, xpath=xpath, namespace=NS)]
+        return [self._to_target(el) for el in findall(
+            element=data, xpath=xpath, namespace=NS
+        )]
 
     def _to_target(self, el):
-        return findtext(element=el, xpath='DefaultActions/member/TargetGroupArn', namespace=NS)
+        return findtext(
+            element=el,
+            xpath='DefaultActions/member/TargetGroupArn',
+            namespace=NS
+        )
 
     def _to_balancer(self, el):
         name = findtext(element=el, xpath='LoadBalancerName', namespace=NS)
@@ -122,7 +131,10 @@ class ApplicationLBDriver(Driver):
             'tags': self._ex_get_balancer_tags(balancer)
         }
         balancer.extra = extra
-        balancer.port = extra['listeners'][0]['port'] if len(extra['listeners']) > 0 else None
+        if len(extra['listeners']) > 0:
+            balancer.port = extra['listeners'][0]['port']
+        else:
+            balancer.port = None
         balancer._members = self._ex_get_balancer_memebers(balancer)
 
         return balancer
@@ -154,13 +166,22 @@ class ApplicationLBDriver(Driver):
         id = findtext(element=el, xpath='RuleArn', namespace=NS)
         is_default = findtext(element=el, xpath='IsDefault', namespace=NS)
         priority = findtext(element=el, xpath='Priority', namespace=NS)
-        target_group = findtext(element=el, xpath='Actions/member/TargetGroupArn', namespace=NS)
+        target_group = findtext(
+            element=el,
+            xpath='Actions/member/TargetGroupArn',
+            namespace=NS
+        )
         conditions = {}
-
-        for cond_member in findall(element=el, xpath='Conditions/member', namespace=NS):
+        cond_members = findall(
+            element=el, xpath='Conditions/member', namespace=NS
+        )
+        for cond_member in cond_members:
             field = findtext(element=cond_member, xpath='Field', namespace=NS)
             conditions[field] = []
-            for value_member in findall(element=cond_member, xpath='Values/member', namespace=NS):
+            value_members = findall(
+                element=cond_member, xpath='Values/member', namespace=NS
+            )
+            for value_member in value_members:
                 conditions[field].append(value_member.text)
 
         rule = {
@@ -184,7 +205,9 @@ class ApplicationLBDriver(Driver):
                 for el in findall(element=data, xpath=xpath, namespace=NS)]
 
     def _to_target_group(self, el):
-        target_group_arn = findtext(element=el, xpath='TargetGroupArn', namespace=NS)
+        target_group_arn = findtext(
+            element=el, xpath='TargetGroupArn', namespace=NS
+        )
         name = findtext(element=el, xpath='TargetGroupName', namespace=NS)
         members = self._ex_get_target_group_members(target_group_arn)
 
@@ -198,7 +221,9 @@ class ApplicationLBDriver(Driver):
     def _to_target_group_member(self, el):
         id = findtext(element=el, xpath='Target/Id', namespace=NS)
         port = findtext(element=el, xpath='Target/Port', namespace=NS)
-        health = findtext(element=el, xpath='TargetHealth/State', namespace=NS)
+        health = findtext(
+            element=el, xpath='TargetHealth/State', namespace=NS
+        )
 
         return {'id': id, 'port': port, 'health': health}
 
@@ -277,7 +302,8 @@ class ApplicationLBDriver(Driver):
         return self._to_rules(data)
 
     def _ex_connection_class_kwargs(self):
-        kwargs = super(ApplicationLBDriver, self)._ex_connection_class_kwargs()
+        pdriver = super(ApplicationLBDriver, self)
+        kwargs = pdriver._ex_connection_class_kwargs()
         if hasattr(self, 'token') and self.token is not None:
             kwargs['token'] = self.token
             kwargs['signature_version'] = '4'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4454f736/libcloud/test/loadbalancer/test_alb.py
----------------------------------------------------------------------
diff --git a/libcloud/test/loadbalancer/test_alb.py b/libcloud/test/loadbalancer/test_alb.py
index 700c5a3..0f1d293 100644
--- a/libcloud/test/loadbalancer/test_alb.py
+++ b/libcloud/test/loadbalancer/test_alb.py
@@ -126,6 +126,7 @@ class ApplicationLBTests(unittest.TestCase):
         self.assertTrue(('target_group' in listener_rules[0]), 'Rule is missing "target_group" field')
         self.assertTrue(('conditions' in listener_rules[0]), 'Rule is missing "conditions" field')
 
+
 class ApplicationLBMockHttp(MockHttpTestCase):
     fixtures = LoadBalancerFileFixtures('alb')
 


[2/6] libcloud git commit: - AWS ALB driver with basic get methods

Posted by an...@apache.org.
- AWS ALB driver with basic get methods


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/be673ee0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/be673ee0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/be673ee0

Branch: refs/heads/trunk
Commit: be673ee01dde7ede7772f3a30388aaccbc44e184
Parents: a58a6e5
Author: Anton Kozyrev <an...@gmail.com>
Authored: Fri Oct 28 16:58:58 2016 +0300
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Nov 10 11:31:25 2016 +1100

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/alb.py | 295 ++++++++++++++++++++++++++++++
 libcloud/loadbalancer/providers.py   |   2 +
 libcloud/loadbalancer/types.py       |   1 +
 3 files changed, 298 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/be673ee0/libcloud/loadbalancer/drivers/alb.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/alb.py b/libcloud/loadbalancer/drivers/alb.py
new file mode 100644
index 0000000..603bd7c
--- /dev/null
+++ b/libcloud/loadbalancer/drivers/alb.py
@@ -0,0 +1,295 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+__all__ = [
+    'ApplicationLBDriver'
+]
+
+from libcloud.utils.py3 import httplib
+from libcloud.utils.xml import findtext, findall
+from libcloud.loadbalancer.types import State
+from libcloud.loadbalancer.base import Driver, LoadBalancer, Member
+from libcloud.common.aws import AWSGenericResponse, SignedAWSConnection
+
+
+VERSION = '2015-12-01'
+HOST = 'elasticloadbalancing.%s.amazonaws.com'
+ROOT = '/%s/' % (VERSION)
+NS = 'http://elasticloadbalancing.amazonaws.com/doc/%s/' % (VERSION, )
+
+
+class ALBResponse(AWSGenericResponse):
+    """
+    Amazon ALB response class.
+    """
+    namespace = NS
+    exceptions = {}
+    xpath = 'Error'
+
+
+class ALBConnection(SignedAWSConnection):
+    version = VERSION
+    host = HOST
+    responseCls = ALBResponse
+    service_name = 'elasticloadbalancing'
+
+
+class ApplicationLBDriver(Driver):
+    name = 'Amazon Application Load Balancing'
+    website = 'http://aws.amazon.com/elasticloadbalancing/'
+    connectionCls = ALBConnection
+    signature_version = '4'
+
+    def __init__(self, access_id, secret, region, token=None):
+        self.token = token
+        super(ApplicationLBDriver, self).__init__(access_id, secret, token=token)
+        self.region = region
+        self.region_name = region
+        self.connection.host = HOST % (region)
+
+    def list_protocols(self):
+        return ['http', 'https']
+
+    def list_balancers(self):
+        params = {'Action': 'DescribeLoadBalancers'}
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_balancers(data)
+
+    def balancer_list_members(self, balancer):
+        return balancer._members
+
+    def get_balancer(self, balancer_id):
+        params = {
+            'Action': 'DescribeLoadBalancers',
+            'LoadBalancerNames.member.1': balancer_id
+        }
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_balancers(data)[0]
+
+    def ex_balancer_list_listeners(self, balancer):
+        return balancer.extra.get('listeners', [])
+
+    def _to_listeners(self, data):
+        xpath = 'DescribeListenersResult/Listeners/member'
+        return [self._to_listener(el) for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_listener(self, el):
+        listener_arn = findtext(element=el, xpath='ListenerArn', namespace=NS)
+        listener = {
+            'id': listener_arn,
+            'protocol': findtext(element=el, xpath='Protocol', namespace=NS),
+            'port': findtext(element=el, xpath='Port', namespace=NS),
+            'rules': self._ex_get_rules_for_listener(listener_arn)
+        }
+        return listener
+
+    def _to_targets(self, data):
+        xpath = 'DefaultActions/member'
+        return [self._to_target(el) for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_target(self, el):
+        return findtext(element=el, xpath='DefaultActions/member/TargetGroupArn', namespace=NS)
+
+    def _to_balancer(self, el):
+        name = findtext(element=el, xpath='LoadBalancerName', namespace=NS)
+        id = findtext(element=el, xpath='LoadBalancerArn', namespace=NS)
+        dns_name = findtext(el, xpath='DNSName', namespace=NS)
+
+        balancer = LoadBalancer(
+            id=id,
+            name=name,
+            state=State.UNKNOWN,
+            ip=dns_name,
+            port=None,
+            driver=self.connection.driver
+        )
+
+        extra = {
+            'listeners': self._ex_get_balancer_listeners(balancer),
+            'target_groups': self._ex_get_balancer_target_groups(balancer),
+            'tags': self._ex_get_balancer_tags(balancer)
+        }
+        balancer.extra = extra
+        balancer.port = extra['listeners'][0]['port'] if len(extra['listeners']) > 0 else None
+        balancer._members = self._ex_get_balancer_memebers(balancer)
+
+        return balancer
+
+    def _to_balancers(self, data):
+        xpath = 'DescribeLoadBalancersResult/LoadBalancers/member'
+        return [self._to_balancer(el)
+                for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_tags(self, data):
+        """
+        return tags dict
+        """
+        tags = {}
+        xpath = 'DescribeTagsResult/TagDescriptions/member/Tags/member'
+
+        for el in findall(element=data, xpath=xpath, namespace=NS):
+            key = findtext(element=el, xpath='Key', namespace=NS)
+            value = findtext(element=el, xpath='Value', namespace=NS)
+            if key:
+                tags[key] = value
+
+        return tags
+
+    def _to_rule(self, el):
+        def __to_bool(val):
+            return val.lower() in ("yes", "true", "t", "1")
+
+        id = findtext(element=el, xpath='RuleArn', namespace=NS)
+        is_default = findtext(element=el, xpath='IsDefault', namespace=NS)
+        priority = findtext(element=el, xpath='Priority', namespace=NS)
+        target_group = findtext(element=el, xpath='Actions/member/TargetGroupArn', namespace=NS)
+        conditions = {}
+
+        for cond_member in findall(element=el, xpath='Conditions/member', namespace=NS):
+            field = findtext(element=cond_member, xpath='Field', namespace=NS)
+            conditions[field] = []
+            for value_member in findall(element=cond_member, xpath='Values/member', namespace=NS):
+                conditions[field].append(value_member.text)
+
+        rule = {
+            'id': id,
+            'is_default': __to_bool(is_default),
+            'priority': priority,
+            'target_group': target_group,
+            'conditions': conditions
+        }
+
+        return rule
+
+    def _to_rules(self, data):
+        xpath = 'DescribeRulesResult/Rules/member'
+        return [self._to_rule(el)
+                for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_target_groups(self, data):
+        xpath = 'DescribeTargetGroupsResult/TargetGroups/member'
+        return [self._to_target_group(el)
+                for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_target_group(self, el):
+        target_group_arn = findtext(element=el, xpath='TargetGroupArn', namespace=NS)
+        name = findtext(element=el, xpath='TargetGroupName', namespace=NS)
+        members = self._ex_get_target_group_members(target_group_arn)
+
+        return {'id': target_group_arn, 'name': name, 'members': members}
+
+    def _to_target_group_members(self, data):
+        xpath = 'DescribeTargetHealthResult/TargetHealthDescriptions/member'
+        return [self._to_target_group_member(el)
+                for el in findall(element=data, xpath=xpath, namespace=NS)]
+
+    def _to_target_group_member(self, el):
+        id = findtext(element=el, xpath='Target/Id', namespace=NS)
+        port = findtext(element=el, xpath='Target/Port', namespace=NS)
+        health = findtext(element=el, xpath='TargetHealth/State', namespace=NS)
+
+        return {'id': id, 'port': port, 'health': health}
+
+    def _ex_get_balancer_memebers(self, balancer):
+        balancer_members = []
+        for tg in balancer.extra['target_groups']:
+            for tg_member in tg['members']:
+                new_member = Member(
+                    tg_member['id'],
+                    None,
+                    tg_member['port'],
+                    balancer=balancer,
+                    extra={
+                        'health': tg_member['health'],
+                        'target_group': tg['name']
+                    }
+                )
+                balancer_members.append(new_member)
+
+        return balancer_members
+
+    def _ex_get_target_group_members(self, target_group_arn):
+        """
+        Return a list of target group member dicts.
+
+        :rtype: ``list`` of ``dict``
+        """
+        params = {
+            'Action': 'DescribeTargetHealth',
+            'TargetGroupArn': target_group_arn
+        }
+
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_target_group_members(data)
+
+    def _ex_get_balancer_target_groups(self, balancer):
+        """
+        Return a list of load balancer target groups with members.
+
+        :rtype: ``list`` of ``dict``
+        """
+        params = {
+            'Action': 'DescribeTargetGroups',
+            'LoadBalancerArn': balancer.id
+        }
+
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_target_groups(data)
+
+    def _ex_get_balancer_listeners(self, balancer):
+        """
+        Return a list of load balancer listeners dicts.
+
+        :rtype: ``list`` of ``dict``
+        """
+        params = {
+            'Action': 'DescribeListeners',
+            'LoadBalancerArn': balancer.id
+        }
+
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_listeners(data)
+
+    def _ex_get_rules_for_listener(self, listener_arn):
+        """
+        Return a list of listeners rule dicts.
+
+        :rtype: ``list`` of ``dict``
+        """
+        params = {
+            'Action': 'DescribeRules',
+            'ListenerArn': listener_arn
+        }
+
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_rules(data)
+
+    def _ex_connection_class_kwargs(self):
+        kwargs = super(ApplicationLBDriver, self)._ex_connection_class_kwargs()
+        if hasattr(self, 'token') and self.token is not None:
+            kwargs['token'] = self.token
+            kwargs['signature_version'] = '4'
+        else:
+            kwargs['signature_version'] = self.signature_version
+
+        return kwargs
+
+    def _ex_get_balancer_tags(self, balancer):
+        params = {
+            'Action': 'DescribeTags',
+            'ResourceArns.member.1': balancer.id
+        }
+        data = self.connection.request(ROOT, params=params).object
+        return self._to_tags(data)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/be673ee0/libcloud/loadbalancer/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/providers.py b/libcloud/loadbalancer/providers.py
index 49a0f3a..a778304 100644
--- a/libcloud/loadbalancer/providers.py
+++ b/libcloud/loadbalancer/providers.py
@@ -35,6 +35,8 @@ DRIVERS = {
     ('libcloud.loadbalancer.drivers.brightbox', 'BrightboxLBDriver'),
     Provider.ELB:
     ('libcloud.loadbalancer.drivers.elb', 'ElasticLBDriver'),
+    Provider.ALB:
+        ('libcloud.loadbalancer.drivers.alb', 'ApplicationLBDriver'),
     Provider.CLOUDSTACK:
     ('libcloud.loadbalancer.drivers.cloudstack', 'CloudStackLBDriver'),
     Provider.GCE:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/be673ee0/libcloud/loadbalancer/types.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/types.py b/libcloud/loadbalancer/types.py
index 391fdf7..5752622 100644
--- a/libcloud/loadbalancer/types.py
+++ b/libcloud/loadbalancer/types.py
@@ -42,6 +42,7 @@ class Provider(object):
 
     :cvar ALIYUN_SLB: Aliyun SLB loadbalancer driver
     """
+    ALB = 'alb'
     ALIYUN_SLB = 'aliyun_slb'
     BRIGHTBOX = 'brightbox'
     CLOUDSTACK = 'cloudstack'