Kami commented on a change in pull request #1476:
URL: https://github.com/apache/libcloud/pull/1476#discussion_r470646392



##########
File path: libcloud/compute/drivers/outscale.py
##########
@@ -0,0 +1,1109 @@
+# 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.
+"""
+Outscale SDK
+"""
+
+import json
+
+import requests
+
+from libcloud.compute.base import NodeDriver
+from libcloud.compute.types import Provider
+from libcloud.common.osc import OSCRequestSignerAlgorithmV4
+from libcloud.common.base import ConnectionUserAndKey
+
+
+class OutscaleNodeDriver(NodeDriver):
+    """
+    Outscale SDK node driver
+    """
+
+    type = Provider.OUTSCALE
+    name = 'Outscale API'
+    website = 'http://www.outscale.com'
+
+    def __init__(self,
+                 key=None,
+                 secret=None,
+                 region='eu-west-2',
+                 service='api',
+                 version='latest'
+                 ):
+        self.key = key
+        self.secret = secret
+        self.region = region
+        self.connection = ConnectionUserAndKey(self.key, self.secret)
+        self.connection.region_name = region
+        self.connection.service_name = service
+        self.service_name = service
+        self.version = version
+
+    def list_locations(self, dry_run=False):
+        """
+        Lists available regions details.
+
+        :return: regions details
+        :rtype: ``dict``
+        """
+        action = "ReadRegions"
+        data = json.dumps({"DryRun": dry_run})
+        signer = OSCRequestSignerAlgorithmV4(access_key=self.key,

Review comment:
       Looks like the next couple of lines are duplicated across all the driver 
methods.
   
   To avoid duplication it would be good to refactor that in some common method.
   
   In addition to that, it looks like ``OSCRequestSignerAlgorithmV4`` could 
also be instantiated inside the driver constructor since it doesn't seem to 
depend on any method specific arguments.




----------------------------------------------------------------
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:
[email protected]


Reply via email to