]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/rgw/rgw_multi/conn.py
2 import boto
.s3
.connection
3 import boto
.iam
.connection
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
,
14 calling_format
= boto
.s3
.connection
.OrdinaryCallingFormat())
15 return gateway
.connection
17 def get_gateway_secure_connection(gateway
, credentials
):
18 """ secure connect to the given gateway """
19 if gateway
.ssl_port
== 0:
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
,
26 port
= gateway
.ssl_port
,
29 calling_format
= boto
.s3
.connection
.OrdinaryCallingFormat())
30 return gateway
.secure_connection
32 def 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
,
41 return gateway
.iam_connection