-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
Add two Python scripts for auditing and restoring GCS bucket objects to a previous point-in-time using object versioning.
Scripts
gcs_version_audit.py (read-only)
- Lists all object versions in a GCS bucket
- Classifies each object: already correct, needs restore, or created after target date
- Reports total restore size and estimated Coldline retrieval cost
- Supports
--limitfor testing,--show-all-versionsfor verbose output, and--prefixfor scoping
gcs_restore.py (write, with safeguards)
- Restores all objects to their state at a given target datetime
- Dry-run by default — requires
--executeflag to make changes - Even with
--execute, prompts for interactiveyesconfirmation - Parallel execution with configurable worker count
- Optional
--delete-newflag to remove objects created after the target date
Use case
When a GCS bucket with object versioning enabled needs to be rolled back to a known-good state (e.g., after accidental bulk deletions or overwrites), these scripts provide a safe audit-then-restore workflow.
Requirements
google-cloud-storagePython package- GCP credentials with read access (audit) or read+write access (restore)
- Object versioning must be enabled on the target bucket
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels