diff --git a/pom.xml b/pom.xml
index f9e8ab6b7..f7dfea65f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -360,7 +360,7 @@ the License.-->
com.google.cloud
google-cloud-storage
- 2.1.3
+ 2.8.0
@@ -368,6 +368,12 @@ the License.-->
google-cloud-bigquery
2.1.8
+
+
+ com.google.apis
+ google-api-services-storage
+ v1-rev20220604-1.32.1
+
diff --git a/src/main/java/io/cdap/e2e/utils/StorageClient.java b/src/main/java/io/cdap/e2e/utils/StorageClient.java
index 638538b98..c5571461d 100644
--- a/src/main/java/io/cdap/e2e/utils/StorageClient.java
+++ b/src/main/java/io/cdap/e2e/utils/StorageClient.java
@@ -22,10 +22,15 @@
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.Bucket;
import com.google.cloud.storage.BucketInfo;
+import com.google.cloud.storage.BucketInfo.LifecycleRule;
+import com.google.cloud.storage.BucketInfo.LifecycleRule.LifecycleAction;
+import com.google.cloud.storage.BucketInfo.LifecycleRule.LifecycleCondition;
import com.google.cloud.storage.Storage;
+import com.google.cloud.storage.Storage.BucketField;
import com.google.cloud.storage.StorageException;
import com.google.cloud.storage.StorageOptions;
+import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
@@ -93,4 +98,18 @@ public static Blob uploadObject(String bucketName, String objectName, String fil
Files.readAllBytes(Paths.get(StorageClient.class.getResource("/" + filePath).toURI())));
}
+ /**
+ * @param bucketName , required random Bucket name to create in GCS.
+ * @param ageInDays Age has to be pass in days.
+ */
+ public static Bucket createBucketwithLifeCycle(String bucketName, int ageInDays) throws IOException {
+ return getStorageService().create(BucketInfo.of(bucketName)).toBuilder()
+ .setLifecycleRules(
+ ImmutableList.of(
+ new LifecycleRule(
+ LifecycleAction.newAbortIncompleteMPUploadAction(),
+ LifecycleCondition.newBuilder().setAge(ageInDays).build()))).build().update();
+ }
+
}
+