Skip to content

Commit a201e32

Browse files
author
psainics
committed
Skip bucket creation if exist (copy/move action)
1 parent 0910734 commit a201e32

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/io/cdap/plugin/gcp/gcs/StorageClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public void mapMetaDataForAllBlobs(String path, Consumer<Map<String, String>> fu
147147
*/
148148
public void createBucketIfNotExists(GCSPath path, @Nullable String location, @Nullable CryptoKeyName cmekKeyName) {
149149
try {
150+
if (storage.get(path.getBucket()) != null) {
151+
LOG.info("Bucket {} already exists, skipping creation.", path.getBucket());
152+
return;
153+
}
150154
GCPUtils.createBucket(storage, path.getBucket(), location, cmekKeyName);
151155
LOG.info("Bucket {} has been created successfully", path.getBucket());
152156
} catch (StorageException e) {

0 commit comments

Comments
 (0)