Automatic API generation via go-restful

Partially addresses #1052.

There's lots more work left to do here, but I got this working, so I thought I'd share it.

go-restful provides a more structured handler registration mechanism, with the ability to document a number of aspects of the API. The object definitions are extracted via reflection and their descriptions are extracted from field tags (added by the author of go-restful upon my request). It uses https://github.com/swagger-api/swagger-ui for the doc UI, and also provides a discovery API that can be used to query available endpoints and json schemas.

In order for the initial version of this to be merged, two main things need to be done:
1. Fix apiserver_test and make all the tests pass
2. Update and merge the PR that adds go-restful to Godeps

Beyond that, I'd like to iterate on cleaning this up and adding documentation in other PRs:
* Customize the swagger UI for our needs
* Figure out how to copy https://github.com/swagger-api/swagger-ui/dist to the master
* Figure out what to do with the custom verbs (watch, proxy, redirect)
* Convert all handlers to native go-restful style
* Convert handler parameters to go-restful parameters
* Perhaps split REST handlers into per-verb handlers
* Add descriptions to all handlers
* Add description tags to all types.go object fields
* Add documentation of other details (return codes, input/output mime types, etc.)
* Fix go-restful bugs

/cc @lavalamp @smarterclayton @erictune 
Agreed


> On Nov 12, 2014, at 8:36 PM, Daniel Smith <notifications@github.com> wrote:
> 
> In pkg/master/master.go:
> 
> > +}
> > +
> > +//TODO: Unify with RecoverPanics?
> > +func logStackOnRecover(panicReason interface{}, httpWriter http.ResponseWriter) {
> > +	var buffer bytes.Buffer
> > +	buffer.WriteString(fmt.Sprintf("recover from panic situation: - %v\r\n", panicReason))
> > +	for i := 2; ; i += 1 {
> > +		_, file, line, ok := rt.Caller(i)
> > +		if !ok {
> > +			break
> > +		}
> > +		buffer.WriteString(fmt.Sprintf("    %s:%d\r\n", file, line))
> > +	}
> > +	glog.Errorln(buffer.String())
> > +	httpWriter.WriteHeader(http.StatusInternalServerError)
> > +	httpWriter.Write(buffer.Bytes())
> Writing a stack trace out seems like a security no-no; perhaps log stack trace only locally?
> 
> —
> Reply to this email directly or view it on GitHub.
>