with storage_client.batch():
for blob in blobs_to_delete:
blob.delete()
and it "just works". It should also "just work" for the Compute Engine API. The Python docs for GCS don't spell out this mode of operations but it follows the example from the Datastore docs:
The
googleapiclient.discovery
library supports the Compute Engine-specific batch operation interface:https://googleapis.github.io/google-api-python-client/docs/dyn/compute_v1.html#new_batch_http_request
Some of the other contemporary Python libraries for each Cloud API also support batch operations. For example:
https://github.com/googleapis/python-storage/blob/main/google/cloud/storage/batch.py
Can be used to run something like:
and it "just works". It should also "just work" for the Compute Engine API. The Python docs for GCS don't spell out this mode of operations but it follows the example from the Datastore docs:
https://cloud.google.com/python/docs/reference/datastore/latest/google.cloud.datastore.batch.Batch