]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/rgw/rgw_multi/conn.py
b03db36735f4d9699b71406546e621afe45391f4
[ceph.git] / ceph / src / test / rgw / rgw_multi / conn.py
1 import boto
2 import boto.s3.connection
3
4
5 def 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
17 def 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