8000 Define additional properties in create bucket snip · DirkHaehnel/python-docs-samples@4fb7649 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fb7649

Browse files
authored
Define additional properties in create bucket snip
1 parent 22550a9 commit 4fb7649

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

storage/cloud-client/snippets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
def create_bucket(bucket_name):
3232
"""Creates a new bucket."""
3333
storage_client = storage.Client()
34-
bucket = storage_client.create_bucket(bucket_name)
35-
print('Bucket {} created'.format(bucket.name))
36-
34+
bucket = storage_client.bucket(bucket_name)
35+
bucket.location = 'ASIA'
36+
bucket.storage_class = 'COLDLINE'
37+
bucket.create()
38+
print('Bucket {} created.'.format(bucket.name))
3739

3840
def delete_bucket(bucket_name):
3941
"""Deletes a bucket. The bucket must be empty."""

0 commit comments

Comments
 (0)
0