add ability to get svc client for s3config set of apis

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 6d3f574a8e)
This commit is contained in:
Abhishek Lekshmanan 2020-01-22 17:03:10 +01:00
parent 94168194fd
commit 19947bd541
2 changed files with 13 additions and 0 deletions

View file

@ -293,6 +293,18 @@ def get_bad_auth_client(aws_access_key_id='badauth'):
config=Config(signature_version='s3v4'))
return client
def get_svc_client(client_config=None, svc='s3'):
if client_config == None:
client_config = Config(signature_version='s3v4')
client = boto3.client(service_name=svc,
aws_access_key_id=config.main_access_key,
aws_secret_access_key=config.main_secret_key,
endpoint_url=config.default_endpoint,
use_ssl=config.default_is_secure,
config=client_config)
return client
bucket_counter = itertools.count(1)
def get_new_bucket_name():

View file

@ -69,6 +69,7 @@ from . import (
get_objects_list,
get_main_kms_keyid,
get_secondary_kms_keyid,
get_svc_client,
nuke_prefixed_buckets,
)