mirror of
https://github.com/containers/podman.git
synced 2025-06-29 15:08:09 +08:00
[CI:DOCS]update apiv2 documentation with swagger goods
Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
2
Makefile
2
Makefile
@ -153,7 +153,7 @@ lint: .gopathok varlink_generate ## Execute the source code linter
|
|||||||
@./.tool/lint
|
@./.tool/lint
|
||||||
|
|
||||||
golangci-lint: .gopathok varlink_generate .install.golangci-lint
|
golangci-lint: .gopathok varlink_generate .install.golangci-lint
|
||||||
$(GOBIN)/golangci-lint run --tests=false
|
$(GOBIN)/golangci-lint run --tests=false --skip-files swagger.go
|
||||||
|
|
||||||
gofmt: ## Verify the source code gofmt
|
gofmt: ## Verify the source code gofmt
|
||||||
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
||||||
|
@ -137,9 +137,6 @@ func Pods(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodInspect(w http.ResponseWriter, r *http.Request) {
|
func PodInspect(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
pod, err := runtime.LookupPod(name)
|
pod, err := runtime.LookupPod(name)
|
||||||
@ -222,10 +219,6 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodStart(w http.ResponseWriter, r *http.Request) {
|
func PodStart(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 304 no modified
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
allContainersRunning := true
|
allContainersRunning := true
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
@ -267,9 +260,6 @@ func PodStart(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodDelete(w http.ResponseWriter, r *http.Request) {
|
func PodDelete(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
||||||
@ -295,13 +285,10 @@ func PodDelete(w http.ResponseWriter, r *http.Request) {
|
|||||||
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
|
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusOK, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func PodRestart(w http.ResponseWriter, r *http.Request) {
|
func PodRestart(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
pod, err := runtime.LookupPod(name)
|
pod, err := runtime.LookupPod(name)
|
||||||
@ -318,8 +305,6 @@ func PodRestart(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodPrune(w http.ResponseWriter, r *http.Request) {
|
func PodPrune(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
pods []*libpod.Pod
|
pods []*libpod.Pod
|
||||||
@ -357,13 +342,10 @@ func PodPrune(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusOK, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func PodPause(w http.ResponseWriter, r *http.Request) {
|
func PodPause(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
pod, err := runtime.LookupPod(name)
|
pod, err := runtime.LookupPod(name)
|
||||||
@ -376,7 +358,7 @@ func PodPause(w http.ResponseWriter, r *http.Request) {
|
|||||||
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
|
utils.Error(w, "Something went wrong", http.StatusInternalServerError, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusOK, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func PodUnpause(w http.ResponseWriter, r *http.Request) {
|
func PodUnpause(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -399,10 +381,6 @@ func PodUnpause(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodKill(w http.ResponseWriter, r *http.Request) {
|
func PodKill(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 409 has conflict
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
||||||
@ -451,9 +429,6 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodExists(w http.ResponseWriter, r *http.Request) {
|
func PodExists(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal (needs work)
|
|
||||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
_, err := runtime.LookupPod(name)
|
_, err := runtime.LookupPod(name)
|
||||||
|
@ -63,23 +63,9 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InspectVolume(w http.ResponseWriter, r *http.Request) {
|
func InspectVolume(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
|
||||||
)
|
)
|
||||||
query := struct {
|
|
||||||
}{
|
|
||||||
// override any golang type defaults
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
|
||||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
|
||||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
name := mux.Vars(r)["name"]
|
name := mux.Vars(r)["name"]
|
||||||
vol, err := runtime.GetVolume(name)
|
vol, err := runtime.GetVolume(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -115,22 +101,9 @@ func ListVolumes(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PruneVolumes(w http.ResponseWriter, r *http.Request) {
|
func PruneVolumes(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
|
||||||
)
|
)
|
||||||
query := struct {
|
|
||||||
}{
|
|
||||||
// override any golang type defaults
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
|
||||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
|
||||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pruned, errs := runtime.PruneVolumes(r.Context())
|
pruned, errs := runtime.PruneVolumes(r.Context())
|
||||||
if errs != nil {
|
if errs != nil {
|
||||||
if len(errs) > 1 {
|
if len(errs) > 1 {
|
||||||
@ -144,9 +117,6 @@ func PruneVolumes(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RemoveVolume(w http.ResponseWriter, r *http.Request) {
|
func RemoveVolume(w http.ResponseWriter, r *http.Request) {
|
||||||
// 200 ok
|
|
||||||
// 404 no such
|
|
||||||
// 500 internal
|
|
||||||
var (
|
var (
|
||||||
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
runtime = r.Context().Value("runtime").(*libpod.Runtime)
|
||||||
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
decoder = r.Context().Value("decoder").(*schema.Decoder)
|
||||||
@ -170,5 +140,5 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err := runtime.RemoveVolume(r.Context(), vol, query.Force); err != nil {
|
if err := runtime.RemoveVolume(r.Context(), vol, query.Force); err != nil {
|
||||||
utils.InternalServerError(w, err)
|
utils.InternalServerError(w, err)
|
||||||
}
|
}
|
||||||
utils.WriteResponse(w, http.StatusOK, "")
|
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||||
}
|
}
|
||||||
|
126
pkg/api/handlers/swagger.go
Normal file
126
pkg/api/handlers/swagger.go
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containers/libpod/cmd/podman/shared"
|
||||||
|
"github.com/containers/libpod/libpod"
|
||||||
|
"github.com/containers/libpod/libpod/image"
|
||||||
|
"github.com/containers/libpod/pkg/inspect"
|
||||||
|
"github.com/docker/docker/api/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// History response
|
||||||
|
// swagger:response DocsHistory
|
||||||
|
type swagHistory struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
HistoryResponse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect response
|
||||||
|
// swagger:response DocsImageInspect
|
||||||
|
type swagImageInspect struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
ImageInspect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete response
|
||||||
|
// swagger:response DocsImageDeleteResponse
|
||||||
|
type swagImageDeleteResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
image.ImageDeleteResponse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search results
|
||||||
|
// swagger:response DocsSearchResponse
|
||||||
|
type swagSearchResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
image.SearchResult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect image
|
||||||
|
// swagger:response DocsLibpodInspectImageResponse
|
||||||
|
type swagLibpodInspectImageResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
inspect.ImageData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prune containers
|
||||||
|
// swagger:response DocsContainerPruneReport
|
||||||
|
type swagContainerPruneReport struct {
|
||||||
|
// in: body
|
||||||
|
Body struct {
|
||||||
|
ContainersPruneReport
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect container
|
||||||
|
// swagger:response DocsContainerInspectResponse
|
||||||
|
type swagContainerInspectResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
types.ContainerJSON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List processes in container
|
||||||
|
// swagger:response DockerTopResponse
|
||||||
|
type swagDockerTopResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
ContainerTopOKBody
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List containers
|
||||||
|
// swagger:response LibpodListContainersResponse
|
||||||
|
type swagLibpodListContainersResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
shared.PsContainerOutput
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect container
|
||||||
|
// swagger:response LibpodInspectContainerResponse
|
||||||
|
type swagLibpodInspectContainerResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
libpod.InspectContainerData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List pods
|
||||||
|
// swagger:response ListPodsResponse
|
||||||
|
type swagListPodsResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
libpod.PodInspect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect pod
|
||||||
|
// swagger:response InspectPodResponse
|
||||||
|
type swagInspectPodResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
libpod.PodInspect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inspect volume
|
||||||
|
// swagger:response InspectVolumeResponse
|
||||||
|
type swagInspectVolumeResponse struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
libpod.InspectVolumeData
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/containers/libpod/libpod/define"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/containers/libpod/libpod/define"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -73,7 +73,9 @@ func BadRequest(w http.ResponseWriter, key string, value string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ErrorModel struct {
|
type ErrorModel struct {
|
||||||
|
// root cause
|
||||||
Because string `json:"cause"`
|
Because string `json:"cause"`
|
||||||
|
// error message
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,25 +24,15 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// description: container name
|
// description: container name
|
||||||
// responses:
|
// responses:
|
||||||
// '201':
|
// '201':
|
||||||
// schema:
|
// description: tbd
|
||||||
// items:
|
|
||||||
// "$ref": "#/ctrCreateResponse"
|
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// "$ref": "#/responses/BadParamError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// "$ref": "#/types/ConflictError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/types/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/create"), APIHandler(s.Context, generic.CreateContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/create"), APIHandler(s.Context, generic.CreateContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation GET /containers/json containers listContainers
|
// swagger:operation GET /containers/json containers listContainers
|
||||||
//
|
//
|
||||||
@ -56,15 +46,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/types/Container"
|
// "$ref": "#/responses/Container"
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// "$ref": "#/responses/BadParamError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/json"), APIHandler(s.Context, generic.ListContainers)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/containers/json"), APIHandler(s.Context, generic.ListContainers)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /containers/prune containers pruneContainers
|
// swagger:operation POST /containers/prune containers pruneContainers
|
||||||
//
|
//
|
||||||
@ -80,12 +66,9 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// "$ref": "#/responses/DocsContainerPruneReport"
|
||||||
// "$ref": "#/types/ContainerPruneReport"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/prune"), APIHandler(s.Context, generic.PruneContainers)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/prune"), APIHandler(s.Context, generic.PruneContainers)).Methods(http.MethodPost)
|
||||||
// swagger:operation DELETE /containers/{nameOrID} containers removeContainer
|
// swagger:operation DELETE /containers/{nameOrID} containers removeContainer
|
||||||
//
|
//
|
||||||
@ -112,27 +95,16 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '204':
|
||||||
// schema:
|
// description: no error
|
||||||
// type: array
|
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/Container"
|
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// "$ref": "#/responses/BadParamError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// "$ref": "#/responses/ConflictError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}"), APIHandler(s.Context, generic.RemoveContainer)).Methods(http.MethodDelete)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}"), APIHandler(s.Context, generic.RemoveContainer)).Methods(http.MethodDelete)
|
||||||
// swagger:operation GET /containers/{nameOrID}/json containers getContainer
|
// swagger:operation GET /containers/{nameOrID}/json containers getContainer
|
||||||
//
|
//
|
||||||
@ -148,17 +120,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// "$ref": "#/responses/DocsContainerInspectResponse"
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/ContainerJSON"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/json"), APIHandler(s.Context, generic.GetContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/json"), APIHandler(s.Context, generic.GetContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /containers/{nameOrID}/kill containers killContainer
|
// swagger:operation POST /containers/{nameOrID}/kill containers killContainer
|
||||||
//
|
//
|
||||||
@ -179,19 +145,12 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// "$ref": "#/responses/ConflictError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/kill"), APIHandler(s.Context, generic.KillContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/kill"), APIHandler(s.Context, generic.KillContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation GET /containers/{nameOrID}/logs containers LogsFromContainer
|
// swagger:operation GET /containers/{nameOrID}/logs containers LogsFromContainer
|
||||||
//
|
//
|
||||||
@ -235,16 +194,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// description: no error
|
// description: tbd
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/logs"), APIHandler(s.Context, generic.LogsFromContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/logs"), APIHandler(s.Context, generic.LogsFromContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /containers/{nameOrID}/pause containers pauseContainer
|
// swagger:operation POST /containers/{nameOrID}/pause containers pauseContainer
|
||||||
//
|
//
|
||||||
@ -261,15 +215,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/pause"), APIHandler(s.Context, handlers.PauseContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/pause"), APIHandler(s.Context, handlers.PauseContainer)).Methods(http.MethodPost)
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/rename"), APIHandler(s.Context, handlers.UnsupportedHandler)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/rename"), APIHandler(s.Context, handlers.UnsupportedHandler)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /containers/{nameOrID}/restart containers restartContainer
|
// swagger:operation POST /containers/{nameOrID}/restart containers restartContainer
|
||||||
@ -291,15 +240,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/restart"), APIHandler(s.Context, handlers.RestartContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/restart"), APIHandler(s.Context, handlers.RestartContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /containers/{nameOrID}/start containers startContainer
|
// swagger:operation POST /containers/{nameOrID}/start containers startContainer
|
||||||
//
|
//
|
||||||
@ -321,21 +265,15 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '304':
|
// '304':
|
||||||
// description: container already started
|
// "$ref": "#/responses/ContainerAlreadyStartedError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/start"), APIHandler(s.Context, handlers.StartContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/start"), APIHandler(s.Context, handlers.StartContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation GET /containers/{nameOrID}/stats containers statsContainer
|
// swagger:operation GET /containers/{nameOrID}/stats containers statsContainer
|
||||||
//
|
//
|
||||||
// Get stats for a contrainer
|
// Get stats for a container
|
||||||
//
|
//
|
||||||
// ---
|
// ---
|
||||||
// parameters:
|
// parameters:
|
||||||
@ -350,22 +288,14 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '204':
|
||||||
// description: no error
|
// description: tbd
|
||||||
// schema:
|
|
||||||
// "ref": "#/handler/stats"
|
|
||||||
// '304':
|
// '304':
|
||||||
// description: container already started
|
// "$ref": "#/responses/ContainerAlreadyStartedError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/stats"), APIHandler(s.Context, generic.StatsContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/stats"), APIHandler(s.Context, generic.StatsContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /containers/{nameOrID}/stop containers stopContainer
|
// swagger:operation POST /containers/{nameOrID}/stop containers stopContainer
|
||||||
//
|
//
|
||||||
@ -387,17 +317,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '304':
|
// '304':
|
||||||
// description: container already stopped
|
// "$ref": "#/responses/ContainerAlreadyStoppedError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/stop"), APIHandler(s.Context, handlers.StopContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/stop"), APIHandler(s.Context, handlers.StopContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation GET /containers/{nameOrID}/top containers topContainer
|
// swagger:operation GET /containers/{nameOrID}/top containers topContainer
|
||||||
//
|
//
|
||||||
@ -417,17 +341,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// description: no error
|
// "ref": "#/responses/DockerTopResponse"
|
||||||
// schema:
|
|
||||||
// "ref": "#/types/ContainerTopBody"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/top"), APIHandler(s.Context, handlers.TopContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/top"), APIHandler(s.Context, handlers.TopContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /containers/{nameOrID}/unpause containers unpauseContainer
|
// swagger:operation POST /containers/{nameOrID}/unpause containers unpauseContainer
|
||||||
//
|
//
|
||||||
@ -446,13 +364,9 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
// schema:
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/unpause"), APIHandler(s.Context, handlers.UnpauseContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/unpause"), APIHandler(s.Context, handlers.UnpauseContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /containers/{nameOrID}/wait containers waitContainer
|
// swagger:operation POST /containers/{nameOrID}/wait containers waitContainer
|
||||||
//
|
//
|
||||||
@ -473,15 +387,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/containers/{name:..*}/wait"), APIHandler(s.Context, generic.WaitContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/containers/{name:..*}/wait"), APIHandler(s.Context, generic.WaitContainer)).Methods(http.MethodPost)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -501,15 +410,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// schema:
|
// schema:
|
||||||
// type: array
|
// type: array
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/shared/GetPsContainerOutput"
|
// "$ref": "#/responses/LibpodListContainersResponse"
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// "$ref": "#/responses/BadParamError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/json"), APIHandler(s.Context, libpod.ListContainers)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/json"), APIHandler(s.Context, libpod.ListContainers)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /libpod/containers/prune containers pruneContainers
|
// swagger:operation POST /libpod/containers/prune containers pruneContainers
|
||||||
//
|
//
|
||||||
@ -529,12 +434,9 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// description: TBD
|
||||||
// "$ref": "#/types/ContainerPruneReport"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/prune"), APIHandler(s.Context, libpod.PruneContainers)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/prune"), APIHandler(s.Context, libpod.PruneContainers)).Methods(http.MethodPost)
|
||||||
// swagger:operation GET /libpod/containers/showmounted containers showMounterContainers
|
// swagger:operation GET /libpod/containers/showmounted containers showMounterContainers
|
||||||
//
|
//
|
||||||
@ -545,12 +447,13 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
|
// description: mounted containers
|
||||||
// schema:
|
// schema:
|
||||||
// "$ref": "TBD"
|
// type: object
|
||||||
|
// additionalProperties:
|
||||||
|
// type: string
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/showmounted"), APIHandler(s.Context, libpod.ShowMountedContainers)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/showmounted"), APIHandler(s.Context, libpod.ShowMountedContainers)).Methods(http.MethodGet)
|
||||||
// swagger:operation DELETE /libpod/containers/json containers removeContainer
|
// swagger:operation DELETE /libpod/containers/json containers removeContainer
|
||||||
//
|
//
|
||||||
@ -573,27 +476,16 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '204':
|
||||||
// schema:
|
// description: no error
|
||||||
// type: array
|
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/Container"
|
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// "$ref": "#/responses/BadParamError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// "$ref": "#/responses/ConflictError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}"), APIHandler(s.Context, libpod.RemoveContainer)).Methods(http.MethodDelete)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}"), APIHandler(s.Context, libpod.RemoveContainer)).Methods(http.MethodDelete)
|
||||||
// swagger:operation GET /libpod/containers/{nameOrID}/json containers getContainer
|
// swagger:operation GET /libpod/containers/{nameOrID}/json containers getContainer
|
||||||
//
|
//
|
||||||
@ -613,17 +505,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// "$ref": "#/responses/LibpodInspectContainerResponse"
|
||||||
// items:
|
|
||||||
// "$ref": "#InspectContainerData"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/json"), APIHandler(s.Context, libpod.GetContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/json"), APIHandler(s.Context, libpod.GetContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/kill containers killContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/kill containers killContainer
|
||||||
//
|
//
|
||||||
@ -645,19 +531,12 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// "$ref": "#/responses/ConflictError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/kill"), APIHandler(s.Context, libpod.KillContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/kill"), APIHandler(s.Context, libpod.KillContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation GET /libpod/containers/{nameOrID}/mount containers mountContainer
|
// swagger:operation GET /libpod/containers/{nameOrID}/mount containers mountContainer
|
||||||
//
|
//
|
||||||
@ -673,18 +552,16 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
|
// description: mounted container
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// description: id
|
||||||
// "$ref": "string"
|
// type: string
|
||||||
|
// example: 3c784de79b791b4ebd3ac55e511f97fedc042328499554937a3f8bfd9c1a2cb8
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/mount"), APIHandler(s.Context, libpod.MountContainer)).Methods(http.MethodPost)
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/mount"), APIHandler(s.Context, libpod.LogsFromContainer)).Methods(http.MethodPost)
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/logs"), APIHandler(s.Context, libpod.LogsFromContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/logs"), APIHandler(s.Context, libpod.LogsFromContainer)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/pause containers pauseContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/pause containers pauseContainer
|
||||||
//
|
//
|
||||||
@ -701,15 +578,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/pause"), APIHandler(s.Context, handlers.PauseContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/pause"), APIHandler(s.Context, handlers.PauseContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/restart containers restartContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/restart containers restartContainer
|
||||||
//
|
//
|
||||||
@ -730,15 +602,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/restart"), APIHandler(s.Context, handlers.RestartContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/restart"), APIHandler(s.Context, handlers.RestartContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/start containers startContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/start containers startContainer
|
||||||
//
|
//
|
||||||
@ -760,17 +627,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '304':
|
// '304':
|
||||||
// description: container already started
|
// "$ref": "#/responses/ContainerAlreadyStartedError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/start"), APIHandler(s.Context, handlers.StartContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/start"), APIHandler(s.Context, handlers.StartContainer)).Methods(http.MethodPost)
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/stats"), APIHandler(s.Context, libpod.StatsContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/stats"), APIHandler(s.Context, libpod.StatsContainer)).Methods(http.MethodGet)
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/top"), APIHandler(s.Context, handlers.TopContainer)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/top"), APIHandler(s.Context, handlers.TopContainer)).Methods(http.MethodGet)
|
||||||
@ -789,15 +650,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/unpause"), APIHandler(s.Context, handlers.UnpauseContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/unpause"), APIHandler(s.Context, handlers.UnpauseContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/wait containers waitContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/wait containers waitContainer
|
||||||
//
|
//
|
||||||
@ -818,15 +674,10 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/wait"), APIHandler(s.Context, libpod.WaitContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/wait"), APIHandler(s.Context, libpod.WaitContainer)).Methods(http.MethodPost)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/exists containers containerExists
|
// swagger:operation POST /libpod/containers/{nameOrID}/exists containers containerExists
|
||||||
//
|
//
|
||||||
@ -842,16 +693,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: container exists
|
||||||
// schema:
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/exists"), APIHandler(s.Context, libpod.ContainerExists)).Methods(http.MethodGet)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/exists"), APIHandler(s.Context, libpod.ContainerExists)).Methods(http.MethodGet)
|
||||||
// swagger:operation POST /libpod/containers/{nameOrID}/stop containers stopContainer
|
// swagger:operation POST /libpod/containers/{nameOrID}/stop containers stopContainer
|
||||||
//
|
//
|
||||||
@ -873,17 +719,11 @@ func (s *APIServer) RegisterContainersHandlers(r *mux.Router) error {
|
|||||||
// '204':
|
// '204':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '304':
|
// '304':
|
||||||
// description: container already stopped
|
// "$ref": "#/responses/ContainerAlreadyStoppedError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such container
|
// "$ref": "#/responses/NoSuchContainer"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// "$ref": "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/stop"), APIHandler(s.Context, handlers.StopContainer)).Methods(http.MethodPost)
|
r.HandleFunc(VersionedPath("/libpod/containers/{name:..*}/stop"), APIHandler(s.Context, handlers.StopContainer)).Methods(http.MethodPost)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,15 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "TBD"
|
// $ref: "TBD"
|
||||||
// '404':
|
// '404':
|
||||||
// description: repo or image does not exist
|
// description: repo or image does not exist
|
||||||
// schema:
|
// schema:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $ref: "#/responses/generalError"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// description: unexpected error
|
||||||
// schema:
|
// schema:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $ref: '#/responses/GenericError'
|
||||||
r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
|
r.Handle(VersionedPath("/images/create"), APIHandler(s.Context, generic.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}")
|
||||||
// swagger:operation POST /images/create images createImage
|
// swagger:operation POST /images/create images createImage
|
||||||
//
|
//
|
||||||
@ -60,15 +60,15 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "TBD"
|
// $ref: "TBD"
|
||||||
// '404':
|
// '404':
|
||||||
// description: repo or image does not exist
|
// description: repo or image does not exist
|
||||||
// schema:
|
// schema:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $ref: "#/responses/generalError"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// description: unexpected error
|
||||||
// schema:
|
// schema:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $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 images listImages
|
// swagger:operation GET /images/json images listImages
|
||||||
//
|
//
|
||||||
@ -79,13 +79,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// type: array
|
||||||
// "$ref": "#/types/ImageSummary"
|
// items:
|
||||||
|
// schema:
|
||||||
|
// $ref: "#/responses/DockerImageSummary"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images loadImage
|
// swagger:operation POST /images/load images loadImage
|
||||||
//
|
//
|
||||||
@ -101,13 +101,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// description: TBD
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/ImageSummary"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images pruneImages
|
// swagger:operation POST /images/prune images pruneImages
|
||||||
//
|
//
|
||||||
@ -125,11 +121,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/ImageDeleteResponse"
|
// $ref: "#/responses/DocsImageDeleteResponse"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images searchImages
|
// swagger:operation GET /images/search images searchImages
|
||||||
//
|
//
|
||||||
@ -153,14 +147,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// $ref: "#/responses/DocsSearchResponse"
|
||||||
// items:
|
|
||||||
// "$ref": "#/images.SearchResult"
|
|
||||||
// description: no error
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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} images removeImage
|
// swagger:operation DELETE /images/{nameOrID} images removeImage
|
||||||
//
|
//
|
||||||
@ -177,25 +166,16 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// type: bool
|
// type: bool
|
||||||
// description: not supported
|
// description: not supported
|
||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// $ref: "#/responses/DocsImageDeleteResponse"
|
||||||
// items:
|
|
||||||
// "$ref": "TBD"
|
|
||||||
// description: no error
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/BadParamError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// $ref: '#/responses/ConflictError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images exportImage
|
// swagger:operation GET /images/{nameOrID}/get images exportImage
|
||||||
//
|
//
|
||||||
@ -208,17 +188,14 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// 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:
|
// schema:
|
||||||
// items:
|
// $ref: "TBD"
|
||||||
// "$ref": "TBD"
|
// description: TBD
|
||||||
// description: no error
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images imageHistory
|
// swagger:operation GET /images/{nameOrID}/history images imageHistory
|
||||||
//
|
//
|
||||||
@ -234,17 +211,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// $ref: "#/responses/DocsHistory"
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/HistoryResponse"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: "#/responses/NoSuchImage"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images inspectImage
|
// swagger:operation GET /images/{nameOrID}/json images inspectImage
|
||||||
//
|
//
|
||||||
@ -260,17 +231,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// $ref: "#/responses/DocsImageInspect"
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/imageInspect"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: "#/responses/NoSuchImage"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: "#/responses/InternalError"
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images tagImage
|
// swagger:operation POST /images/{nameOrID}/tag images tagImage
|
||||||
//
|
//
|
||||||
@ -293,24 +258,16 @@ 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:
|
||||||
// description: bad parameter
|
// $ref: '#/responses/BadParamError'
|
||||||
// schema:
|
// 404:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// '404':
|
// 409:
|
||||||
// description: no such image
|
// $ref: '#/responses/ConflictError'
|
||||||
// schema:
|
// 500:
|
||||||
// "$ref": "#/types/ErrorModel"
|
// $ref: '#/responses/InternalError'
|
||||||
// '409':
|
|
||||||
// description: conflict
|
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
|
||||||
// description: unexpected error
|
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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/ commit commitContainer
|
// swagger:operation POST /commit/ commit commitContainer
|
||||||
//
|
//
|
||||||
@ -352,13 +309,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '201':
|
// '201':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.Handle(VersionedPath("/commit"), APIHandler(s.Context, generic.CommitContainer)).Methods(http.MethodPost)
|
r.Handle(VersionedPath("/commit"), APIHandler(s.Context, generic.CommitContainer)).Methods(http.MethodPost)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -390,13 +343,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '204':
|
// '204':
|
||||||
// description: image exists
|
// description: image exists
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images imageHistory
|
// swagger:operation GET /libpod/images/{nameOrID}/history images imageHistory
|
||||||
@ -415,15 +364,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/types/HistoryResponse"
|
// $ref: "#/responses/HistoryResponse"
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.Handle(VersionedPath("/libpod/images/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet)
|
r.Handle(VersionedPath("/libpod/images/history"), APIHandler(s.Context, handlers.HistoryImage)).Methods(http.MethodGet)
|
||||||
// swagger:operation GET /libpod/images/json images listImages
|
// swagger:operation GET /libpod/images/json images listImages
|
||||||
//
|
//
|
||||||
@ -436,11 +381,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/types/ImageSummary"
|
// $ref: "#/responses/DockerImageSummary"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images loadImage
|
// swagger:operation POST /libpod/images/load images loadImage
|
||||||
//
|
//
|
||||||
@ -456,13 +399,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// description: TBD
|
||||||
// items:
|
|
||||||
// "$ref": "#/types/ImageSummary"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images pruneImages
|
// swagger:operation POST /libpod/images/prune images pruneImages
|
||||||
//
|
//
|
||||||
@ -484,11 +423,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/ImageDeleteResponse"
|
// $ref: "#/responses/DocsImageDeleteResponse"
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images searchImages
|
// swagger:operation GET /libpod/images/search images searchImages
|
||||||
//
|
//
|
||||||
@ -514,12 +451,9 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/images.SearchResult"
|
// $ref: "#/responses/DocsSearchResponse"
|
||||||
// description: no error
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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} images removeImage
|
// swagger:operation DELETE /libpod/images/{nameOrID} images removeImage
|
||||||
//
|
//
|
||||||
@ -541,20 +475,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "TBD"
|
// $ref: "#/responses/DocsIageDeleteResponse"
|
||||||
// description: no error
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// $ref: '#/responses/ConflictError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
r.Handle(VersionedPath("/libpod/images/{name:..*}"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete)
|
r.Handle(VersionedPath("/libpod/images/{name:..*}"), APIHandler(s.Context, handlers.RemoveImage)).Methods(http.MethodDelete)
|
||||||
// swagger:operation GET /libpod/images/{nameOrID}/get images exportImage
|
// swagger:operation GET /libpod/images/{nameOrID}/get images exportImage
|
||||||
//
|
//
|
||||||
@ -578,18 +505,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// - application/json
|
// - application/json
|
||||||
// responses:
|
// responses:
|
||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// description: TBD
|
||||||
// items:
|
|
||||||
// "$ref": "TBD"
|
|
||||||
// description: no error
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images inspectImage
|
// swagger:operation GET /libpod/images/{nameOrID}/json images inspectImage
|
||||||
//
|
//
|
||||||
@ -607,15 +527,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '200':
|
// '200':
|
||||||
// schema:
|
// schema:
|
||||||
// items:
|
// items:
|
||||||
// "$ref": "#/inspect/ImageData"
|
// $ref: "#/responses/DocsLibpodInspectImageResponse"
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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 images tagImage
|
// swagger:operation POST /libpod/images/{nameOrID}/tag images tagImage
|
||||||
//
|
//
|
||||||
@ -641,21 +557,13 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
|
|||||||
// '201':
|
// '201':
|
||||||
// description: no error
|
// description: no error
|
||||||
// '400':
|
// '400':
|
||||||
// description: bad parameter
|
// $ref: '#/responses/BadParamError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '404':
|
// '404':
|
||||||
// description: no such image
|
// $ref: '#/responses/NoSuchImage'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '409':
|
// '409':
|
||||||
// description: conflict
|
// $ref: '#/responses/ConflictError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
// '500':
|
// '500':
|
||||||
// description: unexpected error
|
// $ref: '#/responses/InternalError'
|
||||||
// schema:
|
|
||||||
// "$ref": "#/types/ErrorModel"
|
|
||||||
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)
|
||||||
|
|
||||||
r.Handle(VersionedPath("/build"), APIHandler(s.Context, handlers.BuildImage)).Methods(http.MethodPost)
|
r.Handle(VersionedPath("/build"), APIHandler(s.Context, handlers.BuildImage)).Methods(http.MethodPost)
|
||||||
|
@ -8,17 +8,249 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
|
func (s *APIServer) registerPodsHandlers(r *mux.Router) error {
|
||||||
|
// swagger:operation GET /libpod/pods/json pods ListPods
|
||||||
|
//
|
||||||
|
// List Pods
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: query
|
||||||
|
// name: filters
|
||||||
|
// descriptions: needs description and plumbing for filters
|
||||||
|
// responses:
|
||||||
|
// '200':
|
||||||
|
// $ref: "#/responses/ListPodsResponse"
|
||||||
|
// '400':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Prune unused pods
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// parameters:
|
||||||
|
// - in: query
|
||||||
|
// name: force
|
||||||
|
// description: force delete
|
||||||
|
// type: bool
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '400':
|
||||||
|
// $ref: "#/responses/BadParamError"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Remove Pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// - in: query
|
||||||
|
// name: force
|
||||||
|
// type: bool
|
||||||
|
// description: force delete
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '400':
|
||||||
|
// $ref: "#/responses/BadParamError"
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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)
|
||||||
r.Handle(VersionedPath("/libpod/pods/{name:..*}"), APIHandler(s.Context, libpod.PodInspect)).Methods(http.MethodGet)
|
// swagger:operation GET /libpod/pods/{nameOrID}/json pods inspectPod
|
||||||
|
//
|
||||||
|
// Inspect Pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '200':
|
||||||
|
// $ref: "#/responses/InspectPodResponse"
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $ref: "#responses/InternalError"
|
||||||
|
r.Handle(VersionedPath("/libpod/pods/{name:..*}/json"), APIHandler(s.Context, libpod.PodInspect)).Methods(http.MethodGet)
|
||||||
|
// swagger:operation GET /libpod/pods/{nameOrID}/exists pods podExists
|
||||||
|
//
|
||||||
|
// Inspect Pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: pod exists
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Kill a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// - in: query
|
||||||
|
// name: signal
|
||||||
|
// type: int
|
||||||
|
// description: signal to be sent to pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '400':
|
||||||
|
// $ref: "#/responses/BadParamError"
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '409':
|
||||||
|
// $ref: "#/responses/ConflictError"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Pause a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Restart a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Start a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '304':
|
||||||
|
// $ref: "#/responses/PodAlreadyStartedError"
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Stop a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// - in: query
|
||||||
|
// name: t
|
||||||
|
// type: int
|
||||||
|
// description: timeout
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '304':
|
||||||
|
// $ref: "#/responses/PodAlreadyStoppedError"
|
||||||
|
// '400':
|
||||||
|
// $ref: "#/responses/BadParamError"
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
|
//
|
||||||
|
// Unpause a pod
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the pod
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '404':
|
||||||
|
// $ref: "#/responses/NoSuchPod"
|
||||||
|
// '500':
|
||||||
|
// $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
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,78 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
|
func (s *APIServer) registerVolumeHandlers(r *mux.Router) error {
|
||||||
|
// swagger:operation POST /libpod/volumes/create volumes createVolume
|
||||||
|
//
|
||||||
|
// Create a volume
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// responses:
|
||||||
|
// '200':
|
||||||
|
// description: tbd
|
||||||
|
// '500':
|
||||||
|
// "$ref": "#/responses/InternalError"
|
||||||
r.Handle("/libpod/volumes/create", APIHandler(s.Context, libpod.CreateVolume)).Methods(http.MethodPost)
|
r.Handle("/libpod/volumes/create", APIHandler(s.Context, libpod.CreateVolume)).Methods(http.MethodPost)
|
||||||
r.Handle("/libpod/volumes/json", APIHandler(s.Context, libpod.ListVolumes)).Methods(http.MethodGet)
|
r.Handle("/libpod/volumes/json", APIHandler(s.Context, libpod.ListVolumes)).Methods(http.MethodGet)
|
||||||
|
// swagger:operation POST /volumes/prune volumes pruneVolumes
|
||||||
|
//
|
||||||
|
// Prune volumes
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '500':
|
||||||
|
// "$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
|
||||||
|
//
|
||||||
|
// Inspect volume
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the volume
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// responses:
|
||||||
|
// '200':
|
||||||
|
// "$ref": "#/responses/InspectVolumeResponse"
|
||||||
|
// '404':
|
||||||
|
// "$ref": "#/responses/NoSuchVolume"
|
||||||
|
// '500':
|
||||||
|
// "$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
|
||||||
|
//
|
||||||
|
// Inspect volume
|
||||||
|
//
|
||||||
|
// ---
|
||||||
|
// parameters:
|
||||||
|
// - in: path
|
||||||
|
// name: nameOrID
|
||||||
|
// required: true
|
||||||
|
// description: the name or ID of the volume
|
||||||
|
// - in: query
|
||||||
|
// name: force
|
||||||
|
// type: bool
|
||||||
|
// description: force removal
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
|
// responses:
|
||||||
|
// '204':
|
||||||
|
// description: no error
|
||||||
|
// '400':
|
||||||
|
// "$ref": "#/responses/BadParamError"
|
||||||
|
// '404':
|
||||||
|
// "$ref": "#/responses/NoSuchVolume"
|
||||||
|
// '500':
|
||||||
|
// "$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
|
||||||
}
|
}
|
||||||
|
133
pkg/api/server/swagger.go
Normal file
133
pkg/api/server/swagger.go
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containers/libpod/pkg/api/handlers"
|
||||||
|
"github.com/containers/libpod/pkg/api/handlers/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
// No such image
|
||||||
|
// swagger:response NoSuchImage
|
||||||
|
type swagErrNoSuchImage struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No such container
|
||||||
|
// swagger:response NoSuchContainer
|
||||||
|
type swagErrNoSuchContainer struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No such volume
|
||||||
|
// swagger:response NoSuchVolume
|
||||||
|
type swagErrNoSuchVolume struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No such pod
|
||||||
|
// swagger:response NoSuchPod
|
||||||
|
type swagErrNoSuchPod struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal error
|
||||||
|
// swagger:response InternalError
|
||||||
|
type swagInternalError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic error
|
||||||
|
// swagger:response GenericError
|
||||||
|
type swagGenericError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conflict error
|
||||||
|
// swagger:response ConflictError
|
||||||
|
type swagConflictError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bad parameter
|
||||||
|
// swagger:response BadParamError
|
||||||
|
type swagBadParamError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Container already started
|
||||||
|
// swagger:response ContainerAlreadyStartedError
|
||||||
|
type swagContainerAlreadyStartedError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Container already stopped
|
||||||
|
// swagger:response ContainerAlreadyStoppedError
|
||||||
|
type swagContainerAlreadyStopped struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pod already started
|
||||||
|
// swagger:response PodAlreadyStartedError
|
||||||
|
type swagPodAlreadyStartedError struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pod already stopped
|
||||||
|
// swagger:response PodAlreadyStoppedError
|
||||||
|
type swagPodAlreadyStopped struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
utils.ErrorModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Image summary
|
||||||
|
// swagger:response DockerImageSummary
|
||||||
|
type swagImageSummary struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
handlers.ImageSummary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// List Containers
|
||||||
|
// swagger:response DocsListContainer
|
||||||
|
type swagListContainers struct {
|
||||||
|
// in:body
|
||||||
|
Body struct {
|
||||||
|
// This causes go-swagger to crash
|
||||||
|
//handlers.Container
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user