Better variable naming

This commit is contained in:
Quentin 2022-11-12 23:16:11 +01:00
parent 9686b38003
commit 83a5cadfd4
Signed by: quentin
GPG key ID: E9602264D639FF68
2 changed files with 12 additions and 11 deletions

View file

@ -53,13 +53,13 @@ allow_create = UpdateKeyRequestAllow(create_bucket=True)
keys.update_key(kinfo.access_key_id, UpdateKeyRequest(allow=allow_create)) keys.update_key(kinfo.access_key_id, UpdateKeyRequest(allow=allow_create))
# Create a bucket, allow key, set quotas # Create a bucket, allow key, set quotas
doc = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) binfo = buckets.create_bucket(CreateBucketRequest(global_alias="documentation"))
doc = buckets.allow_bucket_key(AllowBucketKeyRequest( binfo = buckets.allow_bucket_key(AllowBucketKeyRequest(
bucket_id=doc.id, bucket_id=binfo.id,
access_key_id=kinfo.access_key_id, access_key_id=kinfo.access_key_id,
permissions=AllowBucketKeyRequestPermissions(read=True, write=True, owner=True), 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))) quotas=UpdateBucketRequestQuotas(max_size=19029801,max_objects=1500)))
# Display key # Display key
@ -67,7 +67,8 @@ print(f"""
cluster ready cluster ready
key id is {kinfo.access_key_id} key id is {kinfo.access_key_id}
secret key is {kinfo.secret_access_key} 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.* *This example is named `short.py` in the example folder. Other python examples are also available.*

View file

@ -27,7 +27,7 @@ layout.add_layout({
layout.apply_layout(LayoutVersion( layout.apply_layout(LayoutVersion(
version = current.version + 1 version = current.version + 1
)) ))
# Create key, allow it to create buckets # Create key, allow it to create buckets
kinfo = keys.add_key(AddKeyRequest(name="openapi")) 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)) keys.update_key(kinfo.access_key_id, UpdateKeyRequest(allow=allow_create))
# Create a bucket, allow key, set quotas # Create a bucket, allow key, set quotas
doc = buckets.create_bucket(CreateBucketRequest(global_alias="documentation")) binfo = buckets.create_bucket(CreateBucketRequest(global_alias="documentation"))
doc = buckets.allow_bucket_key(AllowBucketKeyRequest( binfo = buckets.allow_bucket_key(AllowBucketKeyRequest(
bucket_id=doc.id, bucket_id=binfo.id,
access_key_id=kinfo.access_key_id, access_key_id=kinfo.access_key_id,
permissions=AllowBucketKeyRequestPermissions(read=True, write=True, owner=True), 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))) quotas=UpdateBucketRequestQuotas(max_size=19029801,max_objects=1500)))
# Display key # Display key
@ -49,5 +49,5 @@ print(f"""
cluster ready cluster ready
key id is {kinfo.access_key_id} key id is {kinfo.access_key_id}
secret key is {kinfo.secret_access_key} 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
""") """)