add class KeyCertificateConnection which accepts both key_file and cert_file. 
It can be used for tls connection.


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

Branch: refs/heads/trunk
Commit: 48d80637fb5bb1ea60ee605884ed1baf2fb6fdc4
Parents: 873f776
Author: johnnyWalnut <ikaryd...@gmail.com>
Authored: Fri Jun 2 13:21:44 2017 +0200
Committer: Anthony Shaw <anthonys...@apache.org>
Committed: Fri Aug 11 14:43:39 2017 +1000

----------------------------------------------------------------------
 libcloud/common/base.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/48d80637/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 063f52b..f860a23 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -865,6 +865,33 @@ class CertificateConnection(Connection):
         self.cert_file = cert_file
 
 
+class KeyCertificateConnection(CertificateConnection):
+    """
+    Base connection class which accepts both ``key_file`` and ``cert_file``
+    argument.
+    """
+
+    key_file=None
+
+    def __init__(self, key_file, cert_file, secure=True, host=None, port=None,
+                 url=None, proxy_url=None, timeout=None, backoff=None,
+                 retry_delay=None):
+        """
+        Initialize `cert_file`; set `secure` to an ``int`` based on
+        passed value.
+        """
+        super(KeyCertificateConnection, self).__init__(cert_file,
+                                                       secure=secure,
+                                                       host=host,
+                                                       port=port, url=url,
+                                                       timeout=timeout,
+                                                       backoff=backoff,
+                                                       retry_delay=retry_delay,
+                                                       proxy_url=proxy_url)
+
+        self.key_file = key_file
+
+
 class ConnectionUserAndKey(ConnectionKey):
     """
     Base connection class which accepts a ``user_id`` and ``key`` argument.

Reply via email to