Skip to content
Permalink
Browse files

added unauthorized response code to the rest api v2

  • Loading branch information...
candysmurf committed Jun 9, 2017
1 parent c823d36 commit c1a0e5ced3d997ac73dbf48fe7cb026b12d962b7
Showing with 59 additions and 3 deletions.
  1. +3 −3 doc.go
  2. +14 −0 mgmt/rest/v2/api.go
  3. +42 −0 swagger.json
6 doc.go
@@ -28,9 +28,9 @@
// - basicAuth: []
//
// SecurityDefinitions:
// - basicAuth:
// type: basic
// description: HTTP basic authentication.
// basicAuth:
// type: basic
// description: HTTP basic authentication.
//
// swagger:meta
package main
@@ -69,6 +69,7 @@ func (s *apiV2) GetRoutes() []api.Route {
//
// Responses:
// 200: PluginsResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/plugins", Handle: s.getPlugins},
// swagger:route GET /plugins/{ptype}/{pname}/{pversion} plugins getPlugin
//
@@ -86,6 +87,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 400: ErrorResponse
// 404: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/plugins/:type/:name/:version", Handle: s.getPlugin},
// swagger:route POST /plugins plugins loadPlugin
//
@@ -107,6 +109,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 409: ErrorResponse
// 415: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "POST", Path: prefix + "/plugins", Handle: s.loadPlugin},
// swagger:route DELETE /plugins/{ptype}/{pname}/{pversion} plugins unloadPlugin
//
@@ -125,6 +128,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 404: ErrorResponse
// 409: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "DELETE", Path: prefix + "/plugins/:type/:name/:version", Handle: s.unloadPlugin},
// swagger:route GET /plugins/{ptype}/{pname}/{pversion}/config plugins getPluginConfigItem
//
@@ -140,6 +144,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// Responses:
// 200: PluginConfigResponse
// 400: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/plugins/:type/:name/:version/config", Handle: s.getPluginConfigItem},
// swagger:route PUT /plugins/{ptype}/{pname}/{pversion}/config plugins setPluginConfigItem
//
@@ -158,6 +163,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// Responses:
// 200: PluginConfigResponse
// 400: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "PUT", Path: prefix + "/plugins/:type/:name/:version/config", Handle: s.setPluginConfigItem},
// swagger:route DELETE /plugins/{ptype}/{pname}/{pversion}/config plugins deletePluginConfigItem
//
@@ -176,6 +182,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// Responses:
// 200: PluginConfigResponse
// 400: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "DELETE", Path: prefix + "/plugins/:type/:name/:version/config", Handle: s.deletePluginConfigItem},
// swagger:route GET /metrics plugins getMetrics
//
@@ -192,6 +199,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 200: MetricsResponse
// 404: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/metrics", Handle: s.getMetrics},
// swagger:route GET /tasks tasks getTasks
//
@@ -206,6 +214,7 @@ func (s *apiV2) GetRoutes() []api.Route {
//
// Responses:
// 200: TasksResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/tasks", Handle: s.getTasks},
// swagger:route GET /tasks/{id} tasks getTask
//
@@ -221,6 +230,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// Responses:
// 200: TaskResponse
// 404: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/tasks/:id", Handle: s.getTask},
// swagger:route GET /tasks/{id}/watch tasks watchTask
//
@@ -237,6 +247,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 200: TaskWatchResponse
// 404: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "GET", Path: prefix + "/tasks/:id/watch", Handle: s.watchTask},
// swagger:route POST /tasks tasks addTask
//
@@ -255,6 +266,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// Responses:
// 201: TaskResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "POST", Path: prefix + "/tasks", Handle: s.addTask},
// swagger:route PUT /tasks/{id} tasks updateTaskState
//
@@ -275,6 +287,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 400: ErrorResponse
// 409: ErrorResponse
// 500: ErrorResponse
// 401: ErrorResponse
api.Route{Method: "PUT", Path: prefix + "/tasks/:id", Handle: s.updateTaskState},
// swagger:route DELETE /tasks/{id} tasks removeTask
//
@@ -291,6 +304,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 204: TaskResponse
// 404: ErrorResponse
// 500: TaskErrorResponse
// 401: ErrorResponse
api.Route{Method: "DELETE", Path: prefix + "/tasks/:id", Handle: s.removeTask},
}
return routes
@@ -62,6 +62,9 @@
"200": {
"$ref": "#/responses/MetricsResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
},
@@ -114,6 +117,9 @@
"responses": {
"200": {
"$ref": "#/responses/PluginsResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
}
}
},
@@ -150,6 +156,9 @@
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"409": {
"$ref": "#/responses/ErrorResponse"
},
@@ -213,6 +222,9 @@
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
},
@@ -271,6 +283,9 @@
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
},
@@ -333,6 +348,9 @@
},
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
}
}
},
@@ -399,6 +417,9 @@
},
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
}
}
},
@@ -466,6 +487,9 @@
},
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
}
}
}
@@ -488,6 +512,9 @@
"responses": {
"200": {
"$ref": "#/responses/TasksResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
}
}
},
@@ -524,6 +551,9 @@
"201": {
"$ref": "#/responses/TaskResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"500": {
"$ref": "#/responses/ErrorResponse"
}
@@ -558,6 +588,9 @@
"200": {
"$ref": "#/responses/TaskResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
}
@@ -604,6 +637,9 @@
"400": {
"$ref": "#/responses/ErrorResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"409": {
"$ref": "#/responses/ErrorResponse"
},
@@ -639,6 +675,9 @@
"204": {
"$ref": "#/responses/TaskResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
},
@@ -676,6 +715,9 @@
"200": {
"$ref": "#/responses/TaskWatchResponse"
},
"401": {
"$ref": "#/responses/ErrorResponse"
},
"404": {
"$ref": "#/responses/ErrorResponse"
},

0 comments on commit c1a0e5c

Please sign in to comment.
You can’t perform that action at this time.