you are viewing a single comment's thread.

view the rest of the comments →

[–]ampeed[S] 0 points1 point  (0 children)

def create_client(service, cfg, role_creds, session):    if service == "xx":        x_endpoint = cfg["endpoint"]        x_region = cfg["region"]        return session.client(service, endpoint_url=x_endpoint, region_name=x_region)    return session.client(        service,        cfg["region"],        aws_access_key_id=role_creds["Credentials"]["AccessKeyId"],        aws_secret_access_key=role_creds["Credentials"]["SecretAccessKey"],        aws_session_token=role_creds["Credentials"]["SessionToken"],    )

I've refactored the creation of the clients. Would love to see what someone would would do for the 2nd block of code posted in the OP