It doesn’t cover all of your use cases, but take a look at this, particularly the examples, which includes a dry-run action.