Skip to content

Commit

Permalink
Merge pull request #35 from SafeExamBrowser/SEBSP-188
Browse files Browse the repository at this point in the history
SEBSP-188 remove hardcoded s3 bucket lifecycle
  • Loading branch information
NadimETH authored Jan 20, 2025
2 parents 8ec7dbf + 2327a20 commit fa279a5
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/main/java/ch/ethz/seb/sps/server/datalayer/dao/impl/S3DAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public class S3DAO {

private String BUCKET_NAME;

private final int BUCKET_LIFECYCLE_DAYS = 365;

public S3DAO(final Environment environment) {
this.environment = environment;
}
Expand All @@ -73,7 +71,6 @@ public void init() throws Exception {

if(!isBucketExisting()){
createBucket();
// setBucketLifecycle();
// getBucketLifecycle();
}
}
Expand Down Expand Up @@ -155,35 +152,6 @@ private void createBucket() throws Exception {
}
}

private void setBucketLifecycle() throws Exception {
try{
List<LifecycleRule> rules = new LinkedList<>();
rules.add(
new LifecycleRule(
Status.ENABLED,
null,
new Expiration((ZonedDateTime) null, BUCKET_LIFECYCLE_DAYS, null),
new RuleFilter("logs/"),
"rule1",
null,
null,
null));
LifecycleConfiguration config = new LifecycleConfiguration(rules);

this.minioClient.setBucketLifecycle(
SetBucketLifecycleArgs
.builder()
.bucket(BUCKET_NAME)
.config(config)
.build());

log.info("Bucket {} lifecycle set to {} days", BUCKET_NAME, BUCKET_LIFECYCLE_DAYS);

}catch(Exception e){
throw new Exception("Failed to set lifecycle of bucket: " + BUCKET_NAME, e);
}
}

private void printAllBucketsInService(){
try{
List<Bucket> bucketList = this.minioClient.listBuckets();
Expand Down

0 comments on commit fa279a5

Please sign in to comment.