diff --git a/README.md b/README.md index f87d4cb..4fa1827 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,13 @@ allow_create = UpdateKeyRequestAllow(create_bucket=True) keys.update_key(kinfo.access_key_id, UpdateKeyRequest(allow=allow_create)) # Create a bucket, allow key, set quotas -doc = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) -doc = buckets.allow_bucket_key(AllowBucketKeyRequest( - bucket_id=doc.id, +binfo = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) +binfo = buckets.allow_bucket_key(AllowBucketKeyRequest( + bucket_id=binfo.id, access_key_id=kinfo.access_key_id, permissions=AllowBucketKeyRequestPermissions(read=True, write=True, owner=True), )) -doc = buckets.update_bucket(doc.id, UpdateBucketRequest( +binfo = buckets.update_bucket(binfo.id, UpdateBucketRequest( quotas=UpdateBucketRequestQuotas(max_size=19029801,max_objects=1500))) # Display key @@ -67,7 +67,8 @@ print(f""" cluster ready key id is {kinfo.access_key_id} secret key is {kinfo.secret_access_key} -bucket {doc.global_aliases[0]} contains {doc.objects}/{doc.quotas.max_objects} objects +bucket {binfo.global_aliases[0]} contains {binfo.objects}/{binfo.quotas.max_objects} objects +""") ``` *This example is named `short.py` in the example folder. Other python examples are also available.* diff --git a/example/short.py b/example/short.py index a5298a6..9c82253 100644 --- a/example/short.py +++ b/example/short.py @@ -27,7 +27,7 @@ layout.add_layout({ layout.apply_layout(LayoutVersion( version = current.version + 1 )) - + # Create key, allow it to create buckets kinfo = keys.add_key(AddKeyRequest(name="openapi")) @@ -35,13 +35,13 @@ allow_create = UpdateKeyRequestAllow(create_bucket=True) keys.update_key(kinfo.access_key_id, UpdateKeyRequest(allow=allow_create)) # Create a bucket, allow key, set quotas -doc = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) -doc = buckets.allow_bucket_key(AllowBucketKeyRequest( - bucket_id=doc.id, +binfo = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) +binfo = buckets.allow_bucket_key(AllowBucketKeyRequest( + bucket_id=binfo.id, access_key_id=kinfo.access_key_id, permissions=AllowBucketKeyRequestPermissions(read=True, write=True, owner=True), )) -doc = buckets.update_bucket(doc.id, UpdateBucketRequest( +binfo = buckets.update_bucket(binfo.id, UpdateBucketRequest( quotas=UpdateBucketRequestQuotas(max_size=19029801,max_objects=1500))) # Display key @@ -49,5 +49,5 @@ print(f""" cluster ready key id is {kinfo.access_key_id} secret key is {kinfo.secret_access_key} -bucket {doc.global_aliases[0]} contains {doc.objects}/{doc.quotas.max_objects} objects +bucket {binfo.global_aliases[0]} contains {binfo.objects}/{binfo.quotas.max_objects} objects """)