]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/rgw/rgw_multi/conn.py
import ceph quincy 17.2.6
[ceph.git] / ceph / src / test / rgw / rgw_multi / conn.py
CommitLineData
31f18b77
FG
1import boto
2import boto.s3.connection
39ae355f 3import boto.iam.connection
31f18b77
FG
4
5def get_gateway_connection(gateway, credentials):
6 """ connect to the given gateway """
7 if gateway.connection is None:
8 gateway.connection = boto.connect_s3(
9 aws_access_key_id = credentials.access_key,
10 aws_secret_access_key = credentials.secret,
11 host = gateway.host,
12 port = gateway.port,
13 is_secure = False,
14 calling_format = boto.s3.connection.OrdinaryCallingFormat())
15 return gateway.connection
16
9f95a23c
TL
17def get_gateway_secure_connection(gateway, credentials):
18 """ secure connect to the given gateway """
19 if gateway.ssl_port == 0:
20 return None
21 if gateway.secure_connection is None:
22 gateway.secure_connection = boto.connect_s3(
23 aws_access_key_id = credentials.access_key,
24 aws_secret_access_key = credentials.secret,
25 host = gateway.host,
26 port = gateway.ssl_port,
27 is_secure = True,
28 validate_certs=False,
29 calling_format = boto.s3.connection.OrdinaryCallingFormat())
30 return gateway.secure_connection
39ae355f
TL
31
32def get_gateway_iam_connection(gateway, credentials):
33 """ connect to iam api of the given gateway """
34 if gateway.iam_connection is None:
35 gateway.iam_connection = boto.connect_iam(
36 aws_access_key_id = credentials.access_key,
37 aws_secret_access_key = credentials.secret,
38 host = gateway.host,
39 port = gateway.port,
40 is_secure = False)
41 return gateway.iam_connection