Enable swagger validation for each PR

* Update swagger:operation's to pass validation
* 'name' path parameter now used throughout API
* Added #/response/ok for 200 returns, TBD values have been replaced
  with legal values.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2020-01-22 10:41:35 -07:00
parent c42383f70a
commit da1186ae63
14 changed files with 815 additions and 762 deletions

View File

@ -2,12 +2,12 @@ export GO111MODULE=off
SWAGGER_OUT ?= swagger.yaml SWAGGER_OUT ?= swagger.yaml
validate: ${SWAGGER_OUT}
swagger validate ${SWAGGER_OUT}
.PHONY: ${SWAGGER_OUT} .PHONY: ${SWAGGER_OUT}
${SWAGGER_OUT}: ${SWAGGER_OUT}:
# generate doesn't remove file on error # generate doesn't remove file on error
rm -f ${SWAGGER_OUT} rm -f ${SWAGGER_OUT}
swagger generate spec -o ${SWAGGER_OUT} -w ./ swagger generate spec -o ${SWAGGER_OUT} -i tags.yaml -w ./
# TODO: when pass validation move it under swagger.
validate:
swagger validate ${SWAGGER_OUT}

View File

@ -96,9 +96,7 @@ type swagLibpodInspectContainerResponse struct {
// swagger:response ListPodsResponse // swagger:response ListPodsResponse
type swagListPodsResponse struct { type swagListPodsResponse struct {
// in:body // in:body
Body struct { Body []libpod.PodInspect
libpod.PodInspect
}
} }
// Inspect pod // Inspect pod

View File

@ -27,34 +27,34 @@ func Error(w http.ResponseWriter, apiMessage string, code int, err error) {
WriteJSON(w, code, em) WriteJSON(w, code, em)
} }
func VolumeNotFound(w http.ResponseWriter, nameOrId string, err error) { func VolumeNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchVolume { if errors.Cause(err) != define.ErrNoSuchVolume {
InternalServerError(w, err) InternalServerError(w, err)
} }
msg := fmt.Sprintf("No such volume: %s", nameOrId) msg := fmt.Sprintf("No such volume: %s", name)
Error(w, msg, http.StatusNotFound, err) Error(w, msg, http.StatusNotFound, err)
} }
func ContainerNotFound(w http.ResponseWriter, nameOrId string, err error) { func ContainerNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchCtr { if errors.Cause(err) != define.ErrNoSuchCtr {
InternalServerError(w, err) InternalServerError(w, err)
} }
msg := fmt.Sprintf("No such container: %s", nameOrId) msg := fmt.Sprintf("No such container: %s", name)
Error(w, msg, http.StatusNotFound, err) Error(w, msg, http.StatusNotFound, err)
} }
func ImageNotFound(w http.ResponseWriter, nameOrId string, err error) { func ImageNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchImage { if errors.Cause(err) != define.ErrNoSuchImage {
InternalServerError(w, err) InternalServerError(w, err)
} }
msg := fmt.Sprintf("No such image: %s", nameOrId) msg := fmt.Sprintf("No such image: %s", name)
Error(w, msg, http.StatusNotFound, err) Error(w, msg, http.StatusNotFound, err)
} }
func PodNotFound(w http.ResponseWriter, nameOrId string, err error) { func PodNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchPod { if errors.Cause(err) != define.ErrNoSuchPod {
InternalServerError(w, err) InternalServerError(w, err)
} }
msg := fmt.Sprintf("No such pod: %s", nameOrId) msg := fmt.Sprintf("No such pod: %s", name)
Error(w, msg, http.StatusNotFound, err) Error(w, msg, http.StatusNotFound, err)
} }
@ -73,9 +73,11 @@ func BadRequest(w http.ResponseWriter, key string, value string, err error) {
} }
type ErrorModel struct { type ErrorModel struct {
// root cause // API root cause formatted for automated parsing
// example: API root cause
Because string `json:"cause"` Because string `json:"cause"`
// error message // human error message, formatted for a human to read
// example: human error message
Message string `json:"message"` Message string `json:"message"`
} }

29
pkg/api/server/docs.go Normal file
View File

@ -0,0 +1,29 @@
// Package api Provides a container compatible interface. (Experimental)
//
// This documentation describes the HTTP Libpod interface. It is to be considered
// only as experimental as this point. The endpoints, parameters, inputs, and
// return values can all change.
//
// Terms Of Service:
//
// Schemes: http, https
// Host: podman.io
// BasePath: /
// Version: 0.0.1
// License: Apache-2.0 https://opensource.org/licenses/Apache-2.0
// Contact: Podman <podman@lists.podman.io> https://podman.io/community/
// Extensions:
// x-logo:
// - url: https://raw.githubusercontent.com/containers/libpod/master/logo/podman-logo.png
// - altText: "Podman logo"
//
// Produces:
// - application/json
// - text/plain
// - text/html
//
// Consumes:
// - application/json
// - application/x-tar
// swagger:meta
package server

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,6 @@ import (
) )
func (s *APIServer) RegisterDistributionHandlers(r *mux.Router) error { func (s *APIServer) RegisterDistributionHandlers(r *mux.Router) error {
r.HandleFunc(VersionedPath("/distribution/{name:..*}/json"), handlers.UnsupportedHandler) r.HandleFunc(VersionedPath("/distribution/{name}/json"), handlers.UnsupportedHandler)
return nil return nil
} }

View File

@ -8,24 +8,29 @@ import (
func (s *APIServer) RegisterEventsHandlers(r *mux.Router) error { func (s *APIServer) RegisterEventsHandlers(r *mux.Router) error {
// swagger:operation GET /events system getEvents // swagger:operation GET /events system getEvents
// --- // ---
// tags:
// - system
// summary: Returns events filtered on query parameters // summary: Returns events filtered on query parameters
// description: Returns events filtered on query parameters
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - name: since // - name: since
// type: string
// in: query // in: query
// description: start streaming events from this time // description: start streaming events from this time
// - name: until // - name: until
// type: string
// in: query // in: query
// description: stop streaming events later than this // description: stop streaming events later than this
// - name: filters // - name: filters
// type: string
// in: query // in: query
// description: JSON encoded map[string][]string of constraints // description: JSON encoded map[string][]string of constraints
// responses: // responses:
// "200": // 200:
// description: OK // $ref: "#/responses/ok"
// "500": // 500:
// description: Failed
// "$ref": "#/responses/InternalError" // "$ref": "#/responses/InternalError"
r.Handle(VersionedPath("/events"), APIHandler(s.Context, handlers.GetEvents)) r.Handle(VersionedPath("/events"), APIHandler(s.Context, handlers.GetEvents))
return nil return nil

View File

@ -8,6 +8,6 @@ import (
) )
func (s *APIServer) registerHealthCheckHandlers(r *mux.Router) error { func (s *APIServer) registerHealthCheckHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/libpod/containers/{name:..*}/runhealthcheck"), APIHandler(s.Context, libpod.RunHealthCheck)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/containers/{name}/runhealthcheck"), APIHandler(s.Context, libpod.RunHealthCheck)).Methods(http.MethodGet)
return nil return nil
} }

View File

@ -11,11 +11,10 @@ import (
func (s *APIServer) registerImagesHandlers(r *mux.Router) error { func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// swagger:operation POST /images/create compat createImage // swagger:operation POST /images/create compat createImage
//
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
// summary: Create an image from an image // summary: Create an image
// description: Create an image by either pulling it from a registry or importing it. // description: Create an image by either pulling it from a registry or importing it.
// produces: // produces:
// - application/json // - application/json
@ -25,53 +24,30 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// type: string // type: string
// description: needs description // description: needs description
// - in: query // - in: query
// name: tag
// type: string
// description: needs description
// responses:
// '200':
// schema:
// items:
// $ref: "to be determined"
// '404':
// description: repo or image does not exist
// schema:
// $ref: "#/responses/InternalError"
// '500':
// description: unexpected error
// schema:
// $ref: '#/responses/GenericError'
r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
// swagger:operation POST /images/create compat createImage
// ---
// tags:
// - images (compat)
// summary: Create an image from Source
// description: Create an image by either pulling it from a registry or importing it.
// produces:
// - application/json
// parameters:
// - in: query
// name: fromSrc // name: fromSrc
// type: string // type: string
// description: needs description // description: needs description
// - in: query // - in: query
// name: changes // name: tag
// type: to be determined // type: string
// description: needs description // description: needs description
// - in: header
// name: X-Registry-Auth
// type: string
// description: A base64-encoded auth configuration.
// - in: body
// name: request
// schema:
// type: string
// description: Image content if fromSrc parameter was used
// responses: // responses:
// '200': // 200:
// schema: // $ref: "#/responses/ok"
// items: // 404:
// $ref: "to be determined" // $ref: "#/responses/NoSuchImage"
// '404': // 500:
// description: repo or image does not exist // $ref: "#/responses/InternalError"
// schema: r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
// $ref: "#/responses/InternalError"
// '500':
// description: unexpected error
// schema:
// $ref: '#/responses/GenericError'
r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}") r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}")
// swagger:operation GET /images/json compat listImages // swagger:operation GET /images/json compat listImages
// --- // ---
@ -82,17 +58,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// schema: // $ref: "#/responses/DockerImageSummary"
// type: array // 500:
// items: // $ref: '#/responses/InternalError'
// schema:
// $ref: "#/responses/DockerImageSummary"
// '500':
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/json"), APIHandler(s.Context, generic.GetImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/images/json"), APIHandler(s.Context, generic.GetImages)).Methods(http.MethodGet)
// swagger:operation POST /images/load compat loadImage // swagger:operation POST /images/load compat loadImage
//
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
@ -101,19 +72,20 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// parameters: // parameters:
// - in: query // - in: query
// name: quiet // name: quiet
// type: bool // type: boolean
// description: not supported // description: not supported
// - in: body // - in: body
// name: request
// description: tarball of container image // description: tarball of container image
// type: string // schema:
// format: binary // type: string
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// description: no error // description: no error
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/load"), APIHandler(s.Context, handlers.LoadImage)).Methods(http.MethodPost) r.Handle(VersionedPath("/images/load"), APIHandler(s.Context, handlers.LoadImage)).Methods(http.MethodPost)
// swagger:operation POST /images/prune compat pruneImages // swagger:operation POST /images/prune compat pruneImages
// --- // ---
@ -135,12 +107,10 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// schema: // $ref: "#/responses/DocsImageDeleteResponse"
// items: // 500:
// $ref: "#/responses/DocsImageDeleteResponse" // $ref: '#/responses/InternalError'
// '500':
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/prune"), APIHandler(s.Context, generic.PruneImages)).Methods(http.MethodPost) r.Handle(VersionedPath("/images/prune"), APIHandler(s.Context, generic.PruneImages)).Methods(http.MethodPost)
// swagger:operation GET /images/search compat searchImages // swagger:operation GET /images/search compat searchImages
// --- // ---
@ -155,7 +125,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: term to search // description: term to search
// - in: query // - in: query
// name: limit // name: limit
// type: int // type: integer
// description: maximum number of results // description: maximum number of results
// - in: query // - in: query
// name: filters // name: filters
@ -168,39 +138,44 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsSearchResponse" // $ref: "#/responses/DocsSearchResponse"
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/search"), APIHandler(s.Context, handlers.SearchImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/images/search"), APIHandler(s.Context, handlers.SearchImages)).Methods(http.MethodGet)
// swagger:operation DELETE /images/{nameOrID} compat removeImage // swagger:operation DELETE /images/{name} compat removeImage
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
// summary: Remove Image // summary: Remove Image
// description: Delete an image from local storage // description: Delete an image from local storage
// parameters: // parameters:
// - in: path
// name: name
// type: string
// required: true
// description: name or ID of image to delete
// - in: query // - in: query
// name: force // name: force
// type: bool // type: boolean
// description: remove the image even if used by containers or has other tags // description: remove the image even if used by containers or has other tags
// - in: query // - in: query
// name: noprune // name: noprune
// type: bool // type: boolean
// description: not supported. will be logged as an invalid parameter if enabled // description: not supported. will be logged as an invalid parameter if enabled
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsImageDeleteResponse" // $ref: "#/responses/DocsImageDeleteResponse"
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '409': // 409:
// $ref: '#/responses/ConflictError' // $ref: '#/responses/ConflictError'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:..*}"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete) r.Handle(VersionedPath("/images/name"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete)
// swagger:operation GET /images/{nameOrID}/get compat exportImage // swagger:operation GET /images/{name}/get compat exportImage
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
@ -208,21 +183,22 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Export an image in tarball format // description: Export an image in tarball format
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// description: no error // description: no error
// schema: // schema:
// type: string // type: string
// format: binary // format: binary
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:..*}/get"), APIHandler(s.Context, generic.ExportImage)).Methods(http.MethodGet) r.Handle(VersionedPath("/images/{name}/get"), APIHandler(s.Context, generic.ExportImage)).Methods(http.MethodGet)
// swagger:operation GET /images/{nameOrID}/history compat imageHistory // swagger:operation GET /images/{name}/history compat imageHistory
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
@ -230,20 +206,21 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return parent layers of an image. // description: Return parent layers of an image.
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsHistory" // $ref: "#/responses/DocsHistory"
// '404': // 404:
// $ref: "#/responses/NoSuchImage" // $ref: "#/responses/NoSuchImage"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/images/{name:..*}/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet) r.Handle(VersionedPath("/images/{name}/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet)
// swagger:operation GET /images/{nameOrID}/json compat inspectImage // swagger:operation GET /images/{name}/json compat inspectImage
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
@ -251,20 +228,21 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return low-level information about an image. // description: Return low-level information about an image.
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsImageInspect" // $ref: "#/responses/DocsImageInspect"
// '404': // 404:
// $ref: "#/responses/NoSuchImage" // $ref: "#/responses/NoSuchImage"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/images/{name:..*}/json"), APIHandler(s.Context, generic.GetImage)) r.Handle(VersionedPath("/images/{name}/json"), APIHandler(s.Context, generic.GetImage))
// swagger:operation POST /images/{nameOrID}/tag compat tagImage // swagger:operation POST /images/{name}/tag compat tagImage
// --- // ---
// tags: // tags:
// - images (compat) // - images (compat)
@ -272,7 +250,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Tag an image so that it becomes part of a repository. // description: Tag an image so that it becomes part of a repository.
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// - in: query // - in: query
@ -296,7 +275,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// $ref: '#/responses/ConflictError' // $ref: '#/responses/ConflictError'
// 500: // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/images/{name:..*}/tag"), APIHandler(s.Context, handlers.TagImage)).Methods(http.MethodPost) r.Handle(VersionedPath("/images/{name}/tag"), APIHandler(s.Context, handlers.TagImage)).Methods(http.MethodPost)
// swagger:operation POST /commit/ compat commitContainer // swagger:operation POST /commit/ compat commitContainer
// --- // ---
// tags: // tags:
@ -325,7 +304,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: author of the image // description: author of the image
// - in: query // - in: query
// name: pause // name: pause
// type: bool // type: boolean
// description: pause the container before committing it // description: pause the container before committing it
// - in: query // - in: query
// name: changes // name: changes
@ -334,12 +313,12 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '201': // 201:
// description: no error // description: no error
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/commit"), APIHandler(s.Context, generic.CommitContainer)).Methods(http.MethodPost) r.Handle(VersionedPath("/commit"), APIHandler(s.Context, generic.CommitContainer)).Methods(http.MethodPost)
// swagger:operation POST /build images buildImage // swagger:operation POST /build images buildImage
@ -534,23 +513,28 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// - application/json // - application/json
// responses: // responses:
// 200: // 200:
// description: OK (As of version 1.xx) // description: OK (As of version 1.xx)
// schema: // schema:
// type: object // type: object
// required: // required:
// - stream // - stream
// properties: // properties:
// stream: // stream:
// type: string // type: string
// example: | // description: output from build process
// (build details...) // example: |
// Successfully built 8ba084515c724cbf90d447a63600c0a6 // (build details...)
// Successfully built 8ba084515c724cbf90d447a63600c0a6
// 400:
// $ref: "#/responses/BadParamError"
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/build"), APIHandler(s.Context, handlers.BuildImage)).Methods(http.MethodPost) r.Handle(VersionedPath("/build"), APIHandler(s.Context, handlers.BuildImage)).Methods(http.MethodPost)
/* /*
libpod endpoints libpod endpoints
*/ */
// swagger:operation POST /libpod/images/{nameOrID}/exists libpod libpodImageExists // swagger:operation POST /libpod/images/{name}/exists libpod libpodImageExists
// --- // ---
// tags: // tags:
// - images // - images
@ -558,21 +542,22 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Check if image exists in local store // description: Check if image exists in local store
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '204': // 204:
// description: image exists // description: image exists
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:..*}/exists"), APIHandler(s.Context, libpod.ImageExists)) r.Handle(VersionedPath("/libpod/images/{name}/exists"), APIHandler(s.Context, libpod.ImageExists))
r.Handle(VersionedPath("/libpod/images/{name:..*}/tree"), APIHandler(s.Context, libpod.ImageTree)) r.Handle(VersionedPath("/libpod/images/{name}/tree"), APIHandler(s.Context, libpod.ImageTree))
// swagger:operation GET /libpod/images/{nameOrID}/history libpod libpodImageHistory // swagger:operation GET /libpod/images/{name}/history libpod libpodImageHistory
// --- // ---
// tags: // tags:
// - images // - images
@ -580,21 +565,20 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return parent layers of an image. // description: Return parent layers of an image.
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// schema: // $ref: "#/responses/DocsHistory"
// items: // 404:
// $ref: "#/responses/HistoryResponse" // $ref: '#/responses/NoSuchImage'
// '404': // 500:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/InternalError'
// '500': r.Handle(VersionedPath("/libpod/images/{name}/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet)
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet)
// swagger:operation GET /libpod/images/json libpod libpodListImages // swagger:operation GET /libpod/images/json libpod libpodListImages
// --- // ---
// tags: // tags:
@ -604,10 +588,10 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DockerImageSummary" // $ref: "#/responses/DockerImageSummary"
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/json"), APIHandler(s.Context, libpod.GetImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/images/json"), APIHandler(s.Context, libpod.GetImages)).Methods(http.MethodGet)
// swagger:operation POST /libpod/images/load libpod libpodLoadImage // swagger:operation POST /libpod/images/load libpod libpodLoadImage
// --- // ---
@ -618,18 +602,20 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// parameters: // parameters:
// - in: query // - in: query
// name: quiet // name: quiet
// type: bool // type: boolean
// description: not supported // description: not supported
// - in: body // - in: body
// name: request
// description: tarball of container image // description: tarball of container image
// type: string // required: true
// format: binary // schema:
// type: string
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// description: no error // description: no error
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/load"), APIHandler(s.Context, handlers.LoadImage)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/images/load"), APIHandler(s.Context, handlers.LoadImage)).Methods(http.MethodPost)
// swagger:operation POST /libpod/images/prune libpod libpodPruneImages // swagger:operation POST /libpod/images/prune libpod libpodPruneImages
@ -651,16 +637,15 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels. // - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels.
// - in: query // - in: query
// name: all // name: all
// type: bool // type: boolean
// description: prune all images // description: prune all images
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// items: // $ref: "#/responses/DocsImageDeleteResponse"
// $ref: "#/responses/DocsImageDeleteResponse" // 500:
// '500': // $ref: '#/responses/InternalError'
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/prune"), APIHandler(s.Context, libpod.PruneImages)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/images/prune"), APIHandler(s.Context, libpod.PruneImages)).Methods(http.MethodPost)
// swagger:operation GET /libpod/images/search libpod libpodSearchImages // swagger:operation GET /libpod/images/search libpod libpodSearchImages
// --- // ---
@ -675,7 +660,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: term to search // description: term to search
// - in: query // - in: query
// name: limit // name: limit
// type: int // type: integer
// description: maximum number of results // description: maximum number of results
// - in: query // - in: query
// name: filters // name: filters
@ -688,37 +673,42 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// schema: // $ref: "#/responses/DocsSearchResponse"
// items: // 500:
// $ref: "#/responses/DocsSearchResponse"
// '500':
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/search"), APIHandler(s.Context, handlers.SearchImages)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/images/search"), APIHandler(s.Context, handlers.SearchImages)).Methods(http.MethodGet)
// swagger:operation DELETE /libpod/images/{nameOrID} libpod libpodRemoveImage // swagger:operation DELETE /libpod/images/{name} libpod libpodRemoveImage
// --- // ---
// tags: // tags:
// - images // - images
// summary: Remove Image // summary: Remove Image
// description: Delete an image from local store // description: Delete an image from local store
// parameters: // parameters:
// - in: path
// name: name
// type: string
// required: true
// description: name or ID of image to delete
// - in: query // - in: query
// name: force // name: force
// type: bool // type: boolean
// description: remove the image even if used by containers or has other tags // description: remove the image even if used by containers or has other tags
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsImageDeleteResponse" // $ref: "#/responses/DocsImageDeleteResponse"
// '404': // 400:
// $ref: '#/responses/NoSuchImage' // $ref: "#/responses/BadParamError"
// '409': // 404:
// $ref: '#/responses/ConflictError' // $ref: '#/responses/NoSuchImage'
// '500': // 409:
// $ref: '#/responses/InternalError' // $ref: '#/responses/ConflictError'
r.Handle(VersionedPath("/libpod/images/{name:..*}"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete) // 500:
// swagger:operation GET /libpod/images/{nameOrID}/get libpod libpoodExportImage // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/name"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete)
// swagger:operation GET /libpod/images/{name}/get libpod libpoodExportImage
// --- // ---
// tags: // tags:
// - images // - images
@ -726,33 +716,32 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Export an image as a tarball // description: Export an image as a tarball
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// - in: query // - in: query
// name: format // name: format
// type: string // type: string
// description: format for exported image // description: format for exported image
// default: oci-archive
// - in: query // - in: query
// name: compress // name: compress
// type: bool // type: boolean
// description: use compression on image // description: use compression on image
// default: false
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// description: no error // description: no error
// schema: // schema:
// type: string // type: string
// format: binary // format: binary
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:..*}/get"), APIHandler(s.Context, libpod.ExportImage)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/images/{name}/get"), APIHandler(s.Context, libpod.ExportImage)).Methods(http.MethodGet)
// swagger:operation GET /libpod/images/{nameOrID}/json libpod libpodInspectImage // swagger:operation GET /libpod/images/{name}/json libpod libpodInspectImage
// --- // ---
// tags: // tags:
// - images // - images
@ -760,20 +749,21 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Obtain low-level information about an image // description: Obtain low-level information about an image
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/DocsLibpodInspectImageResponse" // $ref: "#/responses/DocsLibpodInspectImageResponse"
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:..*}/json"), APIHandler(s.Context, libpod.GetImage)) r.Handle(VersionedPath("/libpod/images/{name}/json"), APIHandler(s.Context, libpod.GetImage))
// swagger:operation POST /libpod/images/{nameOrID}/tag libpod libpodTagImage // swagger:operation POST /libpod/images/{name}/tag libpod libpodTagImage
// --- // ---
// tags: // tags:
// - images // - images
@ -781,7 +771,8 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Tag an image so that it becomes part of a repository. // description: Tag an image so that it becomes part of a repository.
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the container // description: the name or ID of the container
// - in: query // - in: query
@ -795,17 +786,17 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '201': // 201:
// description: no error // description: no error
// '400': // 400:
// $ref: '#/responses/BadParamError' // $ref: '#/responses/BadParamError'
// '404': // 404:
// $ref: '#/responses/NoSuchImage' // $ref: '#/responses/NoSuchImage'
// '409': // 409:
// $ref: '#/responses/ConflictError' // $ref: '#/responses/ConflictError'
// '500': // 500:
// $ref: '#/responses/InternalError' // $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:..*}/tag"), APIHandler(s.Context, handlers.TagImage)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/images/{name}/tag"), APIHandler(s.Context, handlers.TagImage)).Methods(http.MethodPost)
return nil return nil
} }

View File

@ -10,15 +10,17 @@ import (
func (s *APIServer) registerInfoHandlers(r *mux.Router) error { func (s *APIServer) registerInfoHandlers(r *mux.Router) error {
// swagger:operation GET /info libpod libpodGetInfo // swagger:operation GET /info libpod libpodGetInfo
// --- // ---
// tags:
// - system
// summary: Get info // summary: Get info
// description: Returns information on the system and libpod configuration // description: Returns information on the system and libpod configuration
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '200': // 200:
// description: to be determined // description: to be determined
// '500': // 500:
// "$ref": "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/info"), APIHandler(s.Context, generic.GetInfo)).Methods(http.MethodGet) r.Handle(VersionedPath("/info"), APIHandler(s.Context, generic.GetInfo)).Methods(http.MethodGet)
return nil return nil
} }

View File

@ -16,17 +16,15 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// parameters: // parameters:
// - in: query // - in: query
// name: filters // name: filters
// descriptions: needs description and plumbing for filters // type: string
// description: needs description and plumbing for filters
// responses: // responses:
// '200': // 200:
// properties: // $ref: "#/responses/ListPodsResponse"
// items: // 400:
// $ref: "#/responses/ListPodsResponse" // $ref: "#/responses/BadParamError"
// type: array // 500:
// '400': // $ref: "#/responses/InternalError"
// $ref: "#/responses/BadParamError"
// '500':
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/json"), APIHandler(s.Context, libpod.Pods)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/pods/json"), APIHandler(s.Context, libpod.Pods)).Methods(http.MethodGet)
r.Handle(VersionedPath("/libpod/pods/create"), APIHandler(s.Context, libpod.PodCreate)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/create"), APIHandler(s.Context, libpod.PodCreate)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/prune pods PrunePods // swagger:operation POST /libpod/pods/prune pods PrunePods
@ -36,61 +34,63 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - in: query // - in: query
// name: force // name: force
// description: force delete // description: force delete
// type: bool // type: boolean
// default: false // default: false
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '400': // 400:
// $ref: "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/prune"), APIHandler(s.Context, libpod.PodPrune)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/prune"), APIHandler(s.Context, libpod.PodPrune)).Methods(http.MethodPost)
// swagger:operation DELETE /libpod/pods/{nameOrID} pods removePod // swagger:operation DELETE /libpod/pods/{name} pods removePod
// --- // ---
// summary: Remove pod // summary: Remove pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// - in: query // - in: query
// name: force // name: force
// type: bool // type: boolean
// description: force delete // description: force delete
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '400': // 400:
// $ref: "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}"), APIHandler(s.Context, libpod.PodDelete)).Methods(http.MethodDelete) r.Handle(VersionedPath("/libpod/pods/{name}"), APIHandler(s.Context, libpod.PodDelete)).Methods(http.MethodDelete)
// swagger:operation GET /libpod/pods/{nameOrID}/json pods inspectPod // swagger:operation GET /libpod/pods/{name}/json pods inspectPod
// --- // ---
// summary: Inspect pod // summary: Inspect pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '200': // 200:
// $ref: "#/responses/InspectPodResponse" // $ref: "#/responses/InspectPodResponse"
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/json"), APIHandler(s.Context, libpod.PodInspect)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/pods/{name}/json"), APIHandler(s.Context, libpod.PodInspect)).Methods(http.MethodGet)
// swagger:operation GET /libpod/pods/{nameOrID}/exists pods podExists // swagger:operation GET /libpod/pods/{name}/exists pods podExists
// --- // ---
// summary: Pod exists // summary: Pod exists
// description: Check if a pod exists by name or ID // description: Check if a pod exists by name or ID
@ -98,25 +98,27 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '204': // 204:
// description: pod exists // description: pod exists
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/exists"), APIHandler(s.Context, libpod.PodExists)).Methods(http.MethodGet) r.Handle(VersionedPath("/libpod/pods/{name}/exists"), APIHandler(s.Context, libpod.PodExists)).Methods(http.MethodGet)
// swagger:operation POST /libpod/pods/{nameOrID}/kill pods killPod // swagger:operation POST /libpod/pods/{name}/kill pods killPod
// --- // ---
// summary: Kill a pod // summary: Kill a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// - in: query // - in: query
@ -125,116 +127,122 @@ func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
// description: signal to be sent to pod // description: signal to be sent to pod
// default: SIGKILL // default: SIGKILL
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '400': // 400:
// $ref: "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '409': // 409:
// $ref: "#/responses/ConflictError" // $ref: "#/responses/ConflictError"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/kill"), APIHandler(s.Context, libpod.PodKill)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/kill"), APIHandler(s.Context, libpod.PodKill)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{nameOrID}/pause pods pausePod // swagger:operation POST /libpod/pods/{name}/pause pods pausePod
// --- // ---
// summary: Pause a pod // summary: Pause a pod
// description: Pause a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/pause"), APIHandler(s.Context, libpod.PodPause)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/pause"), APIHandler(s.Context, libpod.PodPause)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{nameOrID}/restart pods restartPod // swagger:operation POST /libpod/pods/{name}/restart pods restartPod
// --- // ---
// summary: Restart a pod // summary: Restart a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/restart"), APIHandler(s.Context, libpod.PodRestart)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/restart"), APIHandler(s.Context, libpod.PodRestart)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{nameOrID}/start pods startPod // swagger:operation POST /libpod/pods/{name}/start pods startPod
// --- // ---
// summary: Start a pod // summary: Start a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '304': // 304:
// $ref: "#/responses/PodAlreadyStartedError" // $ref: "#/responses/PodAlreadyStartedError"
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/start"), APIHandler(s.Context, libpod.PodStart)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/start"), APIHandler(s.Context, libpod.PodStart)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{nameOrID}/stop pods stopPod // swagger:operation POST /libpod/pods/{name}/stop pods stopPod
// --- // ---
// summary: Stop a pod // summary: Stop a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// - in: query // - in: query
// name: t // name: t
// type: int // type: integer
// description: timeout // description: timeout
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '304': // 304:
// $ref: "#/responses/PodAlreadyStoppedError" // $ref: "#/responses/PodAlreadyStoppedError"
// '400': // 400:
// $ref: "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/stop"), APIHandler(s.Context, libpod.PodStop)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/stop"), APIHandler(s.Context, libpod.PodStop)).Methods(http.MethodPost)
// swagger:operation POST /libpod/pods/{nameOrID}/unpause pods unpausePod // swagger:operation POST /libpod/pods/{name}/unpause pods unpausePod
// --- // ---
// summary: Unpause a pod // summary: Unpause a pod
// produces: // produces:
// - application/json // - application/json
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the pod // description: the name or ID of the pod
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '404': // 404:
// $ref: "#/responses/NoSuchPod" // $ref: "#/responses/NoSuchPod"
// '500': // 500:
// $ref: "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/pods/{name:..*}/unpause"), APIHandler(s.Context, libpod.PodUnpause)).Methods(http.MethodPost) r.Handle(VersionedPath("/libpod/pods/{name}/unpause"), APIHandler(s.Context, libpod.PodUnpause)).Methods(http.MethodPost)
return nil return nil
} }

View File

@ -31,12 +31,13 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
// '500': // '500':
// "$ref": "#/responses/InternalError" // "$ref": "#/responses/InternalError"
r.Handle("/libpod/volumes/prune", APIHandler(s.Context, libpod.PruneVolumes)).Methods(http.MethodPost) r.Handle("/libpod/volumes/prune", APIHandler(s.Context, libpod.PruneVolumes)).Methods(http.MethodPost)
// swagger:operation GET /volumes/{nameOrID}/json volumes inspectVolume // swagger:operation GET /volumes/{name}/json volumes inspectVolume
// --- // ---
// summary: Inspect volume // summary: Inspect volume
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the volume // description: the name or ID of the volume
// produces: // produces:
@ -48,30 +49,31 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
// "$ref": "#/responses/NoSuchVolume" // "$ref": "#/responses/NoSuchVolume"
// '500': // '500':
// "$ref": "#/responses/InternalError" // "$ref": "#/responses/InternalError"
r.Handle("/libpod/volumes/{name:..*}/json", APIHandler(s.Context, libpod.InspectVolume)).Methods(http.MethodGet) r.Handle("/libpod/volumes/{name}/json", APIHandler(s.Context, libpod.InspectVolume)).Methods(http.MethodGet)
// swagger:operation DELETE /volumes/{nameOrID} volumes removeVolume // swagger:operation DELETE /volumes/{name} volumes removeVolume
// --- // ---
// summary: Remove volume // summary: Remove volume
// parameters: // parameters:
// - in: path // - in: path
// name: nameOrID // name: name
// type: string
// required: true // required: true
// description: the name or ID of the volume // description: the name or ID of the volume
// - in: query // - in: query
// name: force // name: force
// type: bool // type: boolean
// description: force removal // description: force removal
// produces: // produces:
// - application/json // - application/json
// responses: // responses:
// '204': // 204:
// description: no error // description: no error
// '400': // 400:
// "$ref": "#/responses/BadParamError" // $ref: "#/responses/BadParamError"
// '404': // 404:
// "$ref": "#/responses/NoSuchVolume" // $ref: "#/responses/NoSuchVolume"
// '500': // 500:
// "$ref": "#/responses/InternalError" // $ref: "#/responses/InternalError"
r.Handle("/libpod/volumes/{name:..*}", APIHandler(s.Context, libpod.RemoveVolume)).Methods(http.MethodDelete) r.Handle("/libpod/volumes/{name}", APIHandler(s.Context, libpod.RemoveVolume)).Methods(http.MethodDelete)
return nil return nil
} }

View File

@ -1,44 +1,3 @@
// Package api Provides a container compatible interface.
//
// This documentation describes the HTTP Libpod interface. It is to be consider
// only as experimental as this point. The endpoints, parameters, inputs, and
// return values can all change.
//
// Schemes: http, https
// Host: podman.io
// BasePath: /
// Version: 0.0.1
// License: Apache-2.0 https://opensource.org/licenses/Apache-2.0
// Contact: Podman <podman@lists.podman.io> https://podman.io/community/
// InfoExtensions:
// x-logo:
// - url: https://raw.githubusercontent.com/containers/libpod/master/logo/podman-logo.png
// - altText: "Podman logo"
//
// Consumes:
// - application/json
// - application/x-tar
//
// Produces:
// - application/json
// - text/plain
// - text/html
//
// tags:
// - name: containers
// description: Actions related to containers
// - name: images
// description: Actions related to images
// - name: pods
// description: Actions related to pods
// - name: volumes
// description: Actions related to volumes
// - name: containers (compat)
// description: Actions related to containers for the compatibility endpoints
// - name: images (compat)
// description: Actions related to images for the compatibility endpoints
//
// swagger:meta
package server package server
import ( import (

View File

@ -41,7 +41,7 @@ type swagErrNoSuchPod struct {
} }
} }
// Internal error // Internal server error
// swagger:response InternalError // swagger:response InternalError
type swagInternalError struct { type swagInternalError struct {
// in:body // in:body
@ -59,7 +59,7 @@ type swagGenericError struct {
} }
} }
// Conflict error // Conflict error in operation
// swagger:response ConflictError // swagger:response ConflictError
type swagConflictError struct { type swagConflictError struct {
// in:body // in:body
@ -68,7 +68,7 @@ type swagConflictError struct {
} }
} }
// Bad parameter // Bad parameter in request
// swagger:response BadParamError // swagger:response BadParamError
type swagBadParamError struct { type swagBadParamError struct {
// in:body // in:body
@ -134,3 +134,23 @@ type swagListContainers struct {
// swagger:response tbd // swagger:response tbd
type swagTBD struct { type swagTBD struct {
} }
// Success
// swagger:response
type swag struct {
// in:body
Body struct {
// example: OK
ok string
}
}
// Success
// swagger:response
type ok struct {
// in:body
Body struct {
// example: OK
ok string
}
}