# Demonstration program only to explore the objects.

import boto3
from botocore.client import BaseClient

# session is picked up from the ~/.aws/credentials file

# Uncomment for TR session generated by cloud-tool
#boto3.setup_default_session(profile_name='cloud-tool-default')
session = boto3.session.Session()

# s3_client = session.client('s3') # is the non-explicit version.
s3_client: BaseClient = session.client('s3')

print("\nHere is a list of the S3 buckets:\n")

s3 = boto3.resource('s3')


for bucket in s3.buckets.all():

    acl = bucket.Acl()
    print(acl)
    for grant in acl.grants:
        print(grant)
print("--------------")
for bucket in s3.buckets.all():

    for grant in acl.grants:
        print(grant['Grantee']["Type"], grant['Permission'])
