@@ -1386,14 +1386,17 @@ def validate_buckets(filename, comp_ids):
13861386 if columnvalue .lower () not in ['standard' ,'archive' ]:
13871387 log (f'ROW { i + 3 } : Value of "Storage Tier" can be only either "Standard" or "Archive".' )
13881388 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
13901394
13911395 if columnname == 'Auto Tiering' :
13921396 if columnvalue .lower () not in ['enabled' ,'disabled' ]:
13931397 log (f'ROW { i + 3 } : Value of "Auto Tiering" can be only either "Enabled" or "Disabled".' )
13941398 buckets_invalid_check = True
13951399
1396-
13971400 if columnname == 'Object Versioning' :
13981401 if columnvalue .lower () not in ['enabled' ,'disabled' ]:
13991402 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):
14101413 log (f'ROW { i + 3 } : Value of "Visibility" can be only either "Private" or "Public".' )
14111414 buckets_invalid_check = True
14121415
1413- #Check for valid destination region for enabling the replication policy
1416+ # Check for valid destination region for enabling the replication policy
14141417 if columnname == 'Replication Policy' and columnvalue != "nan" :
14151418 columnvalue = columnvalue .split ("::" )
14161419 if len (columnvalue ) == 3 :
@@ -1430,6 +1433,8 @@ def validate_buckets(filename, comp_ids):
14301433 log (f'ROW { i + 3 } : The replication policy format is incorrect.' )
14311434 buckets_invalid_check = True
14321435
1436+ # Get the current time
1437+ current_time = datetime .datetime .utcnow ()
14331438 #Check for the retention policy details
14341439 if columnname == 'Retention Rules' :
14351440 rule_values = columnvalue .split ("\n " )
@@ -1481,6 +1486,21 @@ def validate_buckets(filename, comp_ids):
14811486 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".' )
14821487 buckets_invalid_check = True
14831488 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
14841504
14851505 # Check for the Lifecycle Policy Details
14861506 if lifecycle_input == True :
@@ -1494,7 +1514,6 @@ def validate_buckets(filename, comp_ids):
14941514 'multipart-uploads::Abort'
14951515 ]
14961516
1497-
14981517 # Check if "Lifecycle Target and Action" is empty
14991518 if columnname == 'Lifecycle Target and Action' :
15001519 if columnvalue != 'nan' and columnvalue not in valid_options :
0 commit comments