alter components api,change docker sdk version

This commit is contained in:
yanmingfan
2018-06-16 17:36:32 +08:00
parent a83c797df3
commit c7bbe1d004
4 changed files with 204 additions and 206 deletions

View File

@@ -31,6 +31,10 @@ func Register(ws *restful.WebService, subPath string) {
Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON)
ws.Route(ws.GET(subPath+"/{namespace}").To(handleGetComponentsByNamespace).Filter(route.RouteLogging)).
Consumes(restful.MIME_JSON, restful.MIME_XML).
Produces(restful.MIME_JSON)
}
//get all components
@@ -50,3 +54,22 @@ func handleGetComponents(request *restful.Request, response *restful.Response) {
}
}
//get components from ns
func handleGetComponentsByNamespace(request *restful.Request, response *restful.Response) {
ns := request.PathParameter("namespace")
result, err := models.GetComponentsByNamespace(ns)
if err != nil {
response.WriteHeaderAndEntity(http.StatusInternalServerError, constants.MessageResponse{Message: err.Error()})
} else {
response.WriteAsJson(result)
}
}