Craig McClanahan
|
Posted: September 16, 2009 13:41 by Craig McClanahan
|
|
In the current version of the Sun Cloud API, we specify that requests can contain an open-ended set of name/value pairs in the following circumstances: * POST to a "controllers" URI on a Cluster * POST to a "controllers" URI on a VM * POST to the "attach" or "detach" URI on a VM It is likely that different implementations of the Sun Cloud API might support different sets of named values for these commands. If the server could indicate what options were recognized, along with other details (description, required flag, regular expression that must be matched), it would facilitate clients that wanted to dynamically present a user interface documenting the available options, and perform prevalidation on the user-entered values before submitting the request to the server. A reasonable way to accomplish this goal would be: * Add a new resource called Option that contains name (string), description (string), required (boolean), and regexp (string) fields. * Add a new resource called Options that contains a hash of Option structures, keyed by the command name they apply to. * Add an "options" field to the Cluster and VM resources, containing a URI that can be queried (with a GET) to retrieve all the options metadata for that particular Cluster and VM, without substantially increasing the size of the Cluster and VM representations for clients who do not care about this information. Given these changes, a client presenting a user interface could query for the options metadata whenever desired, and be in a better position to assemble a semantically valid set of options for the particular commands to be executed. To improve consistency, we should also consider making the "attach" and "detach" commands to a VM back into entries in the "controllers" hash, making the "uri" a required option in the corresponding options metadata. Comments? Craig |
Proposal: Annotating Supported Options on Commands
Replies: 2 - Last Post: September 20, 2009 18:05
by: yadieet
by: yadieet
showing 1 - 3 of 3
Tim Bray
|
Posted: September 18, 2009 19:24 by Tim Bray
|
I think this one may well have negative ROI. Essentially, this amounts to a miniature schema language provided by the server to constrain the messages that the client sends the server. My experience in this space (which may not be universal) would suggest that:
In my experience, human-readable specification of behavior is way more useful in practice than this sort of thing. Perhaps, as a useful alternative, each object should have an optional "API-notes" URI field which could be dereferenced to retrieve programmer-oriented documentation as to implementation quirks? Finally, I agree with the suggestion about "attach" and "detach" |
Replies: 2 - Last Post: September 20, 2009 18:05
by: yadieet
by: yadieet








