extirpate : ex·tir·pate : to completely erase or eradicate
The OCI Extirpater is a command line tool that deletes everything within a compartment in every OCI region.
The tool uses the OCI SDK to
- find every compartment underneath the specified root
- find every object within that compartment
- delete the object
The code for each object type is actually quite small (see ociclients/template.py).
In short that code declares:
- the class in the OCI SDK to be used
- (optionally) the "composite class" to be used
- the name (both singular and plural) for human-readable logging
- the method in the class used to list and delete the object
- (optionally) specific formatters to generate a "one-liner" for the object
A class may also override some of the stuff in OCIClient.py in cases where the client class works differently than typical.
This was inspired by Richard Garsthagen's work on OCI Super Delete.
I wanted to try my hand at something similar but that was less "code" and more "declaritive". Mostly because I thought it would be nice to be able to add new object types to be deleted by simply declaring them rather than needing to write a bunch of code.
In the end I'm not sure my approach was better or worse (OCIClient.py is practically unreadable) but it was a good learning experience!
- adding more objects
- trying to use the Search service instead of iterating over every object type