Skip to content

Commit 24831d6

Browse files
committed
✨ use single delete object command to be compliant with GCP
Issue: CLDSRV-867
1 parent a1961e0 commit 24831d6

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

.github/scripts/cleanupOldGCPBuckets.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const {
55
S3Client,
66
ListBucketsCommand,
77
ListObjectsV2Command,
8-
DeleteObjectsCommand,
8+
DeleteObjectCommand,
99
DeleteBucketCommand,
1010
ListMultipartUploadsCommand,
1111
AbortMultipartUploadCommand,
@@ -90,13 +90,12 @@ async function deleteAllObjects(client, bucketName) {
9090
const objects = res.Contents || [];
9191
if (objects.length > 0) {
9292
console.log(` Deleting ${objects.length} object(s)...`);
93-
await client.send(new DeleteObjectsCommand({
94-
Bucket: bucketName,
95-
Delete: {
96-
Objects: objects.map(o => ({ Key: o.Key })),
97-
Quiet: true,
98-
},
99-
}));
93+
for (const obj of objects) {
94+
await client.send(new DeleteObjectCommand({
95+
Bucket: bucketName,
96+
Key: obj.Key,
97+
}));
98+
}
10099
}
101100

102101
continuationToken = res.NextContinuationToken;

0 commit comments

Comments
 (0)