candlepin/subscription-manager — pull request #789 by alikins (2013-10-01 18:38:07+00:00)
Title: RFC: Add an "api" subcommand for making api requests.

ie, make candlepin/rhsm api request using the local client setup (including consumer auth).
A replacement for curl/cpc/etc.

for example:

subscription-manager api --auth user --method /owners/donaldduck

(will request username and password, or can use --username/--password)

subscription-manager api --method /consumers/{c}

Default http verb is "GET", default auth is consumer auth.

Some aliases are supported in method names, in this case "{c}" meaning the local
consumers uuid. {consumer_uuid} also works.

-X get
-d@filename to post/put a file

There is bash completion for the method names, generated from the api def json file. (Currently hardcoded in the completion for speed, but could read from a test file, etc). Aka, "subscription-manager api --method /consumer" would auto complete the available /consumers/ methods.

Could use some refinement (bash completion, for example, could take the request type into account). Possibly more method aliases (though, client doesn't really know anymore).