Last active
September 13, 2022 01:19
-
-
Save gsweene2/37cf454beb9934c87448b6f135e77eb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_bucket_contents_and_get_table_details(): | |
""" | |
Method 1: Create the clients & class instances inside our method | |
""" | |
# Create Clients | |
s3_client = boto3.client("s3") | |
s3_util = S3Util(s3_client) | |
dynamo_client = boto3.client("dynamo") | |
dynamo_util = DynamoUtil(dynamo_client) | |
# Get bucket contents & table details | |
bucket_objects = s3_util.list_objects("garretts-sample-bucket") | |
table_details = dynamo_util.describe_table("blob-my-infra-dev") | |
return bucket_objects, table_details | |
def get_bucket_contents_and_get_table_details_from_clients(s3_util, dynamo_util): | |
""" | |
Method 2: Inject our class instances as arguments | |
""" | |
# Get bucket contents & table details | |
bucket_objects = s3_util.list_objects("garretts-sample-bucket") | |
table_details = dynamo_util.describe_table("blob-my-infra-dev") | |
return bucket_objects, table_details |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment