You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2019/09/08 16:49:56 UTC

[GitHub] [libcloud] Kami commented on a change in pull request #1349: Implemented create methods for AWS ALB driver

Kami commented on a change in pull request #1349: Implemented create methods for AWS ALB driver
URL: https://github.com/apache/libcloud/pull/1349#discussion_r322018780
 
 

 ##########
 File path: libcloud/loadbalancer/drivers/alb.py
 ##########
 @@ -60,26 +211,496 @@ def __init__(self, access_id, secret, region, token=None):
         )
 
     def list_protocols(self):
+        """
+        Return list of protocols supported by driver
+
+        :rtype: ``list`` of ``strings``
+        """
         return ['http', 'https']
 
     def list_balancers(self):
+        """
+        List all load balancers
+
+        :rtype: ``list`` of :class:`LoadBalancer`
+        """
         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):
+        """
+        Get a load balancer object by ARN
+
+        :param  balancer_id: ARN of load balancer you wish to fetch.
+        :type  balancer_id: ``str``
+
+        :rtype: :class:`LoadBalancer`
+        """
         params = {
             'Action': 'DescribeLoadBalancers',
-            'LoadBalancerNames.member.1': balancer_id
+            'LoadBalancerArns.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 create_balancer(self, name, port, protocol, algorithm, members,
+                        ex_scheme="", ex_security_groups=[], ex_subnets=[],
 
 Review comment:
   Please don't use mutable default arguments - https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
   
   So instead of ``ex_security_groups=[], ex_tags={}``, etc. do something like:
   
   ```python
   def(...ex_security_groups=None, eg_tags=None):
      ex_security_groups = ex_security_groups or []
      ex_tags = ex_tags or {}
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services