mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-26 16:52:25 +00:00
Upgraded from 99c19923, branch release-3.0. This required fetching or upgrading the following: * k8s.io/api to kubernetes-1.9.1 * k8s.io/apimachinery to kubernetes-1.9.1 * github.com/juju/ratelimit to 1.0.1 * github.com/spf13/pflag to 4c012f6d Also, update Scope's imports/function calls to be compatible with the new client.
34 lines
890 B
Go
34 lines
890 B
Go
package main
|
|
|
|
import restful "github.com/emicklei/go-restful"
|
|
import restfulspec "github.com/emicklei/go-restful-openapi"
|
|
|
|
type ExampleService struct{}
|
|
type ExampleReq struct{}
|
|
type ExampleResp struct{}
|
|
type ResponseMsg struct{}
|
|
|
|
func (s ExampleService) WebService() *restful.WebService {
|
|
ws := new(restful.WebService)
|
|
ws.
|
|
Path("/example").
|
|
Consumes(restful.MIME_JSON).
|
|
Produces(restful.MIME_JSON)
|
|
|
|
tags := []string{"example"}
|
|
|
|
ws.Route(ws.POST("/example").To(s.create).
|
|
Doc("create example thing").
|
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
|
Metadata(SecurityDefinitionKey, OAISecurity{Name: "jwt"}).
|
|
Writes(ExampleResp{}).
|
|
Reads(ExampleReq{}).
|
|
Returns(200, "OK", &ExampleResp{}).
|
|
Returns(404, "NotFound", &ResponseMsg{}).
|
|
Returns(500, "InternalServerError", &ResponseMsg{}))
|
|
|
|
return ws
|
|
|
|
}
|
|
func (s ExampleService) create(*restful.Request, *restful.Response) {}
|