@@ -1386,14 +1386,17 @@ def validate_buckets(filename, comp_ids):
1386
1386
if columnvalue .lower () not in ['standard' ,'archive' ]:
1387
1387
log (f'ROW { i + 3 } : Value of "Storage Tier" can be only either "Standard" or "Archive".' )
1388
1388
buckets_invalid_check = True
1389
-
1389
+ elif columnvalue .lower () == 'archive' :
1390
+ auto_tiering_index = dfcolumns .index ('Auto Tiering' )
1391
+ if auto_tiering_index != - 1 and str (dfbuckets .loc [i , 'Auto Tiering' ]).strip ().lower () == 'enabled' :
1392
+ log (f'ROW { i + 3 } : Auto Tiering cannot be "Enabled" when Storage Tier is "Archive".' )
1393
+ buckets_invalid_check = True
1390
1394
1391
1395
if columnname == 'Auto Tiering' :
1392
1396
if columnvalue .lower () not in ['enabled' ,'disabled' ]:
1393
1397
log (f'ROW { i + 3 } : Value of "Auto Tiering" can be only either "Enabled" or "Disabled".' )
1394
1398
buckets_invalid_check = True
1395
1399
1396
-
1397
1400
if columnname == 'Object Versioning' :
1398
1401
if columnvalue .lower () not in ['enabled' ,'disabled' ]:
1399
1402
log (f'ROW { i + 3 } : Value of "Object Versioning" can be only either "Enabled" or "Disabled".' )
@@ -1410,7 +1413,7 @@ def validate_buckets(filename, comp_ids):
1410
1413
log (f'ROW { i + 3 } : Value of "Visibility" can be only either "Private" or "Public".' )
1411
1414
buckets_invalid_check = True
1412
1415
1413
- #Check for valid destination region for enabling the replication policy
1416
+ # Check for valid destination region for enabling the replication policy
1414
1417
if columnname == 'Replication Policy' and columnvalue != "nan" :
1415
1418
columnvalue = columnvalue .split ("::" )
1416
1419
if len (columnvalue ) == 3 :
@@ -1430,6 +1433,8 @@ def validate_buckets(filename, comp_ids):
1430
1433
log (f'ROW { i + 3 } : The replication policy format is incorrect.' )
1431
1434
buckets_invalid_check = True
1432
1435
1436
+ # Get the current time
1437
+ current_time = datetime .datetime .utcnow ()
1433
1438
#Check for the retention policy details
1434
1439
if columnname == 'Retention Rules' :
1435
1440
rule_values = columnvalue .split ("\n " )
@@ -1481,6 +1486,21 @@ def validate_buckets(filename, comp_ids):
1481
1486
log (f'ROW { i + 3 } : "time_rule_locked" of retention rule is not in valid format. It should be in the format "dd-mm-yyyy".' )
1482
1487
buckets_invalid_check = True
1483
1488
continue
1489
+ # Parse the time_rule_locked into a datetime object
1490
+ try :
1491
+ time_rule_locked_datetime = datetime .datetime .strptime (time_rule_locked , "%Y-%m-%dT%H:%M:%SZ" )
1492
+ except ValueError :
1493
+ log (f'ROW { i + 3 } : "time_rule_locked" of retention rule is not in valid format. It should be in the format "YYYY-MM-DDThh:mm:ssZ".' )
1494
+ buckets_invalid_check = True
1495
+ continue
1496
+
1497
+ # Calculate the difference between current time and time_rule_locked
1498
+ time_difference = time_rule_locked_datetime - current_time
1499
+
1500
+ # Check if the difference is less than 14 days
1501
+ if time_difference .days < 14 :
1502
+ log (f'ROW { i + 3 } : "time_rule_locked" of retention rule must be more than 14 days from the current time.' )
1503
+ buckets_invalid_check = True
1484
1504
1485
1505
# Check for the Lifecycle Policy Details
1486
1506
if lifecycle_input == True :
@@ -1494,7 +1514,6 @@ def validate_buckets(filename, comp_ids):
1494
1514
'multipart-uploads::Abort'
1495
1515
]
1496
1516
1497
-
1498
1517
# Check if "Lifecycle Target and Action" is empty
1499
1518
if columnname == 'Lifecycle Target and Action' :
1500
1519
if columnvalue != 'nan' and columnvalue not in valid_options :
0 commit comments