There is currently (as of this writing) no public API for control of AirPods.
There have been a few threads asking similar questions on Apple's official Developer forums, to the same end answer.
In this case, it might be easier to think about it from Apple's perspective: if Apple did allow control of AirPods in this manner, it could open up huge possibilities for major end user confusion ("Why was noise cancelling disabled without my explicit say-so?", or users who wouldn't realize noise cancelling was disabled and instead believe their product is faulty). For Apple, a decision between utility and user experience generally tips toward the latter.
In this same line of thinking, I'm hard-pressed to come up with a situation where Apple would elect to publicly release an API enabling developers to control the functionality you describe in your question.