]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/rgw/rgw_multi/conn.py
import ceph quincy 17.2.6
[ceph.git] / ceph / src / test / rgw / rgw_multi / conn.py
index 1099664df201b55c09685bde9985a984127238fe..59bc2fdd3d2f7b1a3246ad4019d2bdfdcea2334b 100644 (file)
@@ -1,6 +1,6 @@
 import boto
 import boto.s3.connection
-
+import boto.iam.connection
 
 def get_gateway_connection(gateway, credentials):
     """ connect to the given gateway """
@@ -14,3 +14,28 @@ def get_gateway_connection(gateway, credentials):
                 calling_format = boto.s3.connection.OrdinaryCallingFormat())
     return gateway.connection
 
+def get_gateway_secure_connection(gateway, credentials):
+    """ secure connect to the given gateway """
+    if gateway.ssl_port == 0:
+        return None
+    if gateway.secure_connection is None:
+        gateway.secure_connection = boto.connect_s3(
+            aws_access_key_id = credentials.access_key,
+            aws_secret_access_key = credentials.secret,
+            host = gateway.host,
+            port = gateway.ssl_port,
+            is_secure = True,
+            validate_certs=False,
+            calling_format = boto.s3.connection.OrdinaryCallingFormat())
+    return gateway.secure_connection
+
+def get_gateway_iam_connection(gateway, credentials):
+    """ connect to iam api of the given gateway """
+    if gateway.iam_connection is None:
+        gateway.iam_connection = boto.connect_iam(
+                aws_access_key_id = credentials.access_key,
+                aws_secret_access_key = credentials.secret,
+                host = gateway.host,
+                port = gateway.port,
+                is_secure = False)
+    return gateway.iam_connection