summaryrefslogtreecommitdiff
path: root/pkg/api/server/register_pods.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2022-05-19 10:27:31 -0700
committerJhon Honce <jhonce@redhat.com>2022-05-19 15:24:18 -0700
commit5b79cf15a0226dc3dad5053615ee652823376cd3 (patch)
tree066e0b6e5fde4af49e7113ab48c277a55a60c22a /pkg/api/server/register_pods.go
parent913caaa9b1de2b63692c9bae15120208194c9eb3 (diff)
downloadpodman-5b79cf15a0226dc3dad5053615ee652823376cd3.tar.gz
podman-5b79cf15a0226dc3dad5053615ee652823376cd3.tar.bz2
podman-5b79cf15a0226dc3dad5053615ee652823376cd3.zip
Swagger refactor/cleanup
* Remove duplicate or unused types and constants * Move all documetation-only models and responses into swagger package * Remove all unecessary names, go-swagger will determine names from struct declarations * Use Libpod suffix to differentiate between compat and libpod models and responses. Taken from swagger:operation declarations. * Models and responses that start with lowercase are for swagger use only while uppercase are used "as is" in the code and swagger comments * Used gofumpt on new code ```release-note ``` Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/server/register_pods.go')
-rw-r--r--pkg/api/server/register_pods.go104
1 files changed, 52 insertions, 52 deletions
diff --git a/pkg/api/server/register_pods.go b/pkg/api/server/register_pods.go
index 7aeafe724..d54cc413e 100644
--- a/pkg/api/server/register_pods.go
+++ b/pkg/api/server/register_pods.go
@@ -31,11 +31,11 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - `ctr-number=<pod-ctr-number>` Number of containers in the pod.
// responses:
// 200:
- // $ref: "#/responses/ListPodsResponse"
+ // $ref: "#/responses/podsListResponse"
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/json"), s.APIHandler(libpod.Pods)).Methods(http.MethodGet)
// swagger:operation POST /libpod/pods/create pods PodCreateLibpod
// ---
@@ -53,14 +53,14 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// schema:
// $ref: "#/definitions/IDResponse"
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 409:
// description: status conflict
// schema:
// type: string
// description: message describing error
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/create"), s.APIHandler(libpod.PodCreate)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/prune pods PodPruneLibpod
// ---
@@ -69,13 +69,13 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - application/json
// responses:
// 200:
- // $ref: '#/responses/PodPruneReport'
+ // $ref: '#/responses/podPruneResponse'
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 409:
// description: pod already exists
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/prune"), s.APIHandler(libpod.PodPrune)).Methods(http.MethodPost)
// swagger:operation DELETE /libpod/pods/{name} pods PodDeleteLibpod
// ---
@@ -94,13 +94,13 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description : force removal of a running pod by first stopping all containers, then removing all containers in the pod
// responses:
// 200:
- // $ref: '#/responses/PodRmReport'
+ // $ref: '#/responses/podRmResponse'
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}"), s.APIHandler(libpod.PodDelete)).Methods(http.MethodDelete)
// swagger:operation GET /libpod/pods/{name}/json pods PodInspectLibpod
// ---
@@ -115,11 +115,11 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: the name or ID of the pod
// responses:
// 200:
- // $ref: "#/responses/InspectPodResponse"
+ // $ref: "#/responses/podInspectResponse"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/json"), s.APIHandler(libpod.PodInspect)).Methods(http.MethodGet)
// swagger:operation GET /libpod/pods/{name}/exists pods PodExistsLibpod
// ---
@@ -137,9 +137,9 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// 204:
// description: pod exists
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/exists"), s.APIHandler(libpod.PodExists)).Methods(http.MethodGet)
// swagger:operation POST /libpod/pods/{name}/kill pods PodKillLibpod
// ---
@@ -159,15 +159,15 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// default: SIGKILL
// responses:
// 200:
- // $ref: "#/responses/PodKillReport"
+ // $ref: "#/responses/podKillResponse"
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: "#/responses/PodKillReport"
+ // $ref: "#/responses/podKillResponse"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/kill"), s.APIHandler(libpod.PodKill)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{name}/pause pods PodPauseLibpod
// ---
@@ -183,13 +183,13 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: the name or ID of the pod
// responses:
// 200:
- // $ref: '#/responses/PodPauseReport'
+ // $ref: '#/responses/podPauseResponse'
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: '#/responses/PodPauseReport'
+ // $ref: '#/responses/podPauseResponse'
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/pause"), s.APIHandler(libpod.PodPause)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{name}/restart pods PodRestartLibpod
// ---
@@ -204,13 +204,13 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: the name or ID of the pod
// responses:
// 200:
- // $ref: '#/responses/PodRestartReport'
+ // $ref: '#/responses/podRestartResponse'
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: "#/responses/PodRestartReport"
+ // $ref: "#/responses/podRestartResponse"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/restart"), s.APIHandler(libpod.PodRestart)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{name}/start pods PodStartLibpod
// ---
@@ -225,15 +225,15 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: the name or ID of the pod
// responses:
// 200:
- // $ref: '#/responses/PodStartReport'
+ // $ref: '#/responses/podStartResponse'
// 304:
- // $ref: "#/responses/PodAlreadyStartedError"
+ // $ref: "#/responses/podAlreadyStartedError"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: '#/responses/PodStartReport'
+ // $ref: '#/responses/podStartResponse'
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/start"), s.APIHandler(libpod.PodStart)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{name}/stop pods PodStopLibpod
// ---
@@ -252,17 +252,17 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: timeout
// responses:
// 200:
- // $ref: '#/responses/PodStopReport'
+ // $ref: '#/responses/podStopResponse'
// 304:
- // $ref: "#/responses/PodAlreadyStoppedError"
+ // $ref: "#/responses/podAlreadyStoppedError"
// 400:
- // $ref: "#/responses/BadParamError"
+ // $ref: "#/responses/badParamError"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: "#/responses/PodStopReport"
+ // $ref: "#/responses/podStopResponse"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/stop"), s.APIHandler(libpod.PodStop)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{name}/unpause pods PodUnpauseLibpod
// ---
@@ -277,13 +277,13 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: the name or ID of the pod
// responses:
// 200:
- // $ref: '#/responses/PodUnpauseReport'
+ // $ref: '#/responses/podUnpauseResponse'
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 409:
- // $ref: '#/responses/PodUnpauseReport'
+ // $ref: '#/responses/podUnpauseResponse'
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/unpause"), s.APIHandler(libpod.PodUnpause)).Methods(http.MethodPost)
// swagger:operation GET /libpod/pods/{name}/top pods PodTopLibpod
// ---
@@ -315,17 +315,17 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// Requires ps(1) to be installed in the container if no ps(1) compatible AIX descriptors are used.
// responses:
// 200:
- // $ref: "#/responses/DocsPodTopResponse"
+ // $ref: "#/responses/podTopResponse"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/{name}/top"), s.APIHandler(libpod.PodTop)).Methods(http.MethodGet)
// swagger:operation GET /libpod/pods/stats pods PodStatsAllLibpod
// ---
// tags:
// - pods
- // summary: Get stats for one or more pods
+ // summary: Statistics for one or more pods
// description: Display a live stream of resource usage statistics for the containers in one or more pods
// parameters:
// - in: query
@@ -342,11 +342,11 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - application/json
// responses:
// 200:
- // $ref: "#/responses/DocsPodTopResponse"
+ // $ref: "#/responses/podStatsResponse"
// 404:
- // $ref: "#/responses/NoSuchPod"
+ // $ref: "#/responses/podNotFound"
// 500:
- // $ref: "#/responses/InternalError"
+ // $ref: "#/responses/internalError"
r.Handle(VersionedPath("/libpod/pods/stats"), s.APIHandler(libpod.PodStats)).Methods(http.MethodGet)
return nil
}