from minio import Minio from minio.error import S3Error users = { # create manually "asdf": "fjsgJ78y9GRCsiq", # via setup.sh "group0": "fjsgJ78y9GRCsiq", "group1": "sdfsdfsdfg46RCsiq", "group2": "409z8jdfhj45jz", #"group3": "rtpihn80435hg9r", } clients = {key: Minio("minio:9000", access_key=key, secret_key=users[key], secure=False) for key in users} root = clients["asdf"] for user in clients: client = clients[user] print(f"* {user}") for bucket in client.list_buckets(): print(f"\t{bucket.name}, {bucket.creation_date}") if not root.bucket_exists("roots-bucket"): print("== make buckets ==") root.make_bucket("roots-bucket") root.make_bucket("proj-group4545") #for i in range(4): #root.make_bucket(f"group{i}") for user in clients: client = clients[user] print(f"* {user}") client.make_bucket(f"proj-{user}-foo") print(" == check again == ") for user in clients: client = clients[user] print(f"* {user}") for bucket in client.list_buckets(): print(f"\t{bucket.name}, {bucket.creation_date}") print(" == try access == ") for user in clients: client = clients[user] print(f"* {user}") for bucket in client.list_buckets(): print(f"\t* {bucket.name}, {bucket.creation_date}") try: for obj in client.list_objects(bucket.name): print(f"\t\t* {obj}") client.fput_object(bucket.name, "testupoload", "Dockerfile") except S3Error as e: print("\t\t", e)