- 19 Dec 2023
- 1 Minute to read
- Print
- PDF
How to modify Delete After Retention Compliance settings using Python Script?
- Updated on 19 Dec 2023
- 1 Minute to read
- Print
- PDF
This Python script has been created to modify (enable/disable) the Delete After Retention (DAR) Compliance settings along with a provision to modify Retention Time (in Days) for a bucket.
PRE-REQUISITES
Install Python 3+ version to run this script
Install Python requests module
EXECUTION
When the script is executed, it presents the list of available regions as can be seen below:
After displaying the list of available regions, the script continues and the following information is requested:
Wasabi Access Key
Wasabi Secret Access Key
Wasabi Bucket Name
Region
Note: The above inputs should be valid and are mandatory for the script to continue with the execution. If any information is either invalid or missing, the script will terminate with an appropriate message.
After validating the input, the script will display the current compliance setting for the bucket & will give additional options to enable delete after retention/disable delete after retention/quit
Note:
If compliance is disabled on the bucket, the script will display the Compliance status and will terminate.
Only If ConditionalHold is enabled then the script will display the status for ConditionalHold:
If "Y" is selected to enable delete after retention, then an additional prompt to modify the retention time will be displayed by the script. After validating the input, the script will proceed to modify the delete after the retention flag along with retention time (in days). If the customer chose not to modify retention time, then only the delete after retention flag will be modified. After setting the DAR flag to true on the bucket, the script will display the status along with modified compliance settings. It will also prompt with options to enable delete after retention/disable delete after retention/quit.
Note: Retention Time (in days) should be greater than ZERO. If ZERO is entered as input then the script will continue to prompt with options to enable delete after retention/disable delete after retention/quit
If "N" is selected to disable delete after retention, the script will proceed to disable the delete after retention for the bucket. After setting the DAR flag to false on the bucket, the script will display the status along with modified compliance settings. It will also prompt with options to enable delete after retention/disable delete after retention/quit.
If "Q" is selected the script will terminate with the message "Program Ended..."