Skip to content

Commit b6afe9f

Browse files
committed
add deletion fn
1 parent c318004 commit b6afe9f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/webapp/gcsutil.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ def generate_download_signed_url(self, bucket_name: str, blob_name: str) -> str:
113113
)
114114
return url
115115

116+
def delete_bucket(self, bucket_name: str) -> None:
117+
storage_client = storage.Client()
118+
# Delete the GCS bucket. Force=True handles non-empty buckets.
119+
bucket = storage_client.get_bucket(bucket_name)
120+
bucket.delete(force=True)
121+
116122
def create_bucket(self, bucket_name: str) -> None:
117123
"""
118124
Create a new bucket in the US region with the standard storage

0 commit comments

Comments
 (0)