diff options
Diffstat (limited to 'pkg/api/server')
25 files changed, 162 insertions, 39 deletions
diff --git a/pkg/api/server/handler_api.go b/pkg/api/server/handler_api.go index dbdb7f17b..b0fd932ba 100644 --- a/pkg/api/server/handler_api.go +++ b/pkg/api/server/handler_api.go @@ -6,7 +6,7 @@ import ( "net/http" "runtime" - "github.com/containers/libpod/pkg/api/handlers/utils" + "github.com/containers/libpod/v2/pkg/api/handlers/utils" log "github.com/sirupsen/logrus" ) diff --git a/pkg/api/server/register_archive.go b/pkg/api/server/register_archive.go index a1d5941bc..4aeb7462e 100644 --- a/pkg/api/server/register_archive.go +++ b/pkg/api/server/register_archive.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_auth.go b/pkg/api/server/register_auth.go index 33b707fa4..1bf23d2eb 100644 --- a/pkg/api/server/register_auth.go +++ b/pkg/api/server/register_auth.go @@ -1,7 +1,7 @@ package server import ( - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go index 0d78e4cdb..18ff2f423 100644 --- a/pkg/api/server/register_containers.go +++ b/pkg/api/server/register_containers.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_distribution.go b/pkg/api/server/register_distribution.go index 89f69ea67..73ef2e85b 100644 --- a/pkg/api/server/register_distribution.go +++ b/pkg/api/server/register_distribution.go @@ -1,7 +1,7 @@ package server import ( - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_events.go b/pkg/api/server/register_events.go index 2b85eb169..72aabe496 100644 --- a/pkg/api/server/register_events.go +++ b/pkg/api/server/register_events.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_exec.go b/pkg/api/server/register_exec.go index af9a83496..be6cbf9bc 100644 --- a/pkg/api/server/register_exec.go +++ b/pkg/api/server/register_exec.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_generate.go b/pkg/api/server/register_generate.go index 391e60111..82f1dc680 100644 --- a/pkg/api/server/register_generate.go +++ b/pkg/api/server/register_generate.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_healthcheck.go b/pkg/api/server/register_healthcheck.go index 69aa5bbfb..9059fdba7 100644 --- a/pkg/api/server/register_healthcheck.go +++ b/pkg/api/server/register_healthcheck.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 754cb1b75..3c15c82d5 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_info.go b/pkg/api/server/register_info.go index 75aaa957b..28e7e6e53 100644 --- a/pkg/api/server/register_info.go +++ b/pkg/api/server/register_info.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go index 8fd84f205..91e820dca 100644 --- a/pkg/api/server/register_manifest.go +++ b/pkg/api/server/register_manifest.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_monitor.go b/pkg/api/server/register_monitor.go index b7a7c3792..9a76ebac2 100644 --- a/pkg/api/server/register_monitor.go +++ b/pkg/api/server/register_monitor.go @@ -1,7 +1,7 @@ package server import ( - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index 3ea16f81a..3a45ee458 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_ping.go b/pkg/api/server/register_ping.go index bf7763029..70e88ee00 100644 --- a/pkg/api/server/register_ping.go +++ b/pkg/api/server/register_ping.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_play.go b/pkg/api/server/register_play.go index d04879c19..049be39de 100644 --- a/pkg/api/server/register_play.go +++ b/pkg/api/server/register_play.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_plugins.go b/pkg/api/server/register_plugins.go index 5f6473fe8..c21564b5c 100644 --- a/pkg/api/server/register_plugins.go +++ b/pkg/api/server/register_plugins.go @@ -1,7 +1,7 @@ package server import ( - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_pods.go b/pkg/api/server/register_pods.go index 4156dd86b..d5a286442 100644 --- a/pkg/api/server/register_pods.go +++ b/pkg/api/server/register_pods.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_swagger.go b/pkg/api/server/register_swagger.go index 9048c1951..bf68fda3c 100644 --- a/pkg/api/server/register_swagger.go +++ b/pkg/api/server/register_swagger.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_swarm.go b/pkg/api/server/register_swarm.go index 8a5588268..d1048bb8c 100644 --- a/pkg/api/server/register_swarm.go +++ b/pkg/api/server/register_swarm.go @@ -4,7 +4,7 @@ import ( "errors" "net/http" - "github.com/containers/libpod/pkg/api/handlers/utils" + "github.com/containers/libpod/v2/pkg/api/handlers/utils" "github.com/gorilla/mux" "github.com/sirupsen/logrus" ) diff --git a/pkg/api/server/register_system.go b/pkg/api/server/register_system.go index 118ad2d08..ef88cda09 100644 --- a/pkg/api/server/register_system.go +++ b/pkg/api/server/register_system.go @@ -3,8 +3,8 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_version.go b/pkg/api/server/register_version.go index 30289ffe3..38d27849c 100644 --- a/pkg/api/server/register_version.go +++ b/pkg/api/server/register_version.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" "github.com/gorilla/mux" ) diff --git a/pkg/api/server/register_volumes.go b/pkg/api/server/register_volumes.go index 1d5abd830..72f0f4249 100644 --- a/pkg/api/server/register_volumes.go +++ b/pkg/api/server/register_volumes.go @@ -3,12 +3,13 @@ package server import ( "net/http" - "github.com/containers/libpod/pkg/api/handlers/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers/compat" + "github.com/containers/libpod/v2/pkg/api/handlers/libpod" "github.com/gorilla/mux" ) func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { - // swagger:operation POST /libpod/volumes/create volumes createVolume + // swagger:operation POST /libpod/volumes/create volumes libpodCreateVolume // --- // summary: Create a volume // parameters: @@ -25,7 +26,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // '500': // "$ref": "#/responses/InternalError" r.Handle(VersionedPath("/libpod/volumes/create"), s.APIHandler(libpod.CreateVolume)).Methods(http.MethodPost) - // swagger:operation GET /libpod/volumes/json volumes listVolumes + // swagger:operation GET /libpod/volumes/json volumes libpodListVolumes // --- // summary: List volumes // description: Returns a list of volumes @@ -47,7 +48,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // '500': // "$ref": "#/responses/InternalError" r.Handle(VersionedPath("/libpod/volumes/json"), s.APIHandler(libpod.ListVolumes)).Methods(http.MethodGet) - // swagger:operation POST /libpod/volumes/prune volumes pruneVolumes + // swagger:operation POST /libpod/volumes/prune volumes libpodPruneVolumes // --- // summary: Prune volumes // produces: @@ -58,7 +59,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // '500': // "$ref": "#/responses/InternalError" r.Handle(VersionedPath("/libpod/volumes/prune"), s.APIHandler(libpod.PruneVolumes)).Methods(http.MethodPost) - // swagger:operation GET /libpod/volumes/{name}/json volumes inspectVolume + // swagger:operation GET /libpod/volumes/{name}/json volumes libpodInspectVolume // --- // summary: Inspect volume // parameters: @@ -77,7 +78,7 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // '500': // "$ref": "#/responses/InternalError" r.Handle(VersionedPath("/libpod/volumes/{name}/json"), s.APIHandler(libpod.InspectVolume)).Methods(http.MethodGet) - // swagger:operation DELETE /libpod/volumes/{name} volumes removeVolume + // swagger:operation DELETE /libpod/volumes/{name} volumes libpodRemoveVolume // --- // summary: Remove volume // parameters: @@ -102,5 +103,127 @@ func (s *APIServer) registerVolumeHandlers(r *mux.Router) error { // 500: // $ref: "#/responses/InternalError" r.Handle(VersionedPath("/libpod/volumes/{name}"), s.APIHandler(libpod.RemoveVolume)).Methods(http.MethodDelete) + + /* + * Docker compatibility endpoints + */ + + // swagger:operation GET /volumes compat listVolumes + // --- + // summary: List volumes + // description: Returns a list of volume + // produces: + // - application/json + // parameters: + // - in: query + // name: filters + // type: string + // description: | + // JSON encoded value of the filters (a map[string][]string) to process on the volumes list. Available filters: + // - driver=<volume-driver-name> Matches volumes based on their driver. + // - label=<key> or label=<key>:<value> Matches volumes based on the presence of a label alone or a label and a value. + // - name=<volume-name> Matches all of volume name. + // + // Note: + // The boolean `dangling` filter is not yet implemented for this endpoint. + // responses: + // '200': + // "$ref": "#/responses/DockerVolumeList" + // '500': + // "$ref": "#/responses/InternalError" + r.Handle(VersionedPath("/volumes"), s.APIHandler(compat.ListVolumes)).Methods(http.MethodGet) + r.Handle("/volumes", s.APIHandler(compat.ListVolumes)).Methods(http.MethodGet) + + // swagger:operation POST /volumes/create volumes createVolume + // --- + // summary: Create a volume + // parameters: + // - in: body + // name: create + // description: attributes for creating a container + // schema: + // $ref: "#/definitions/DockerVolumeCreate" + // produces: + // - application/json + // responses: + // '201': + // "$ref": "#/responses/DockerVolumeInfoResponse" + // '500': + // "$ref": "#/responses/InternalError" + r.Handle(VersionedPath("/volumes/create"), s.APIHandler(compat.CreateVolume)).Methods(http.MethodPost) + r.Handle("/volumes/create", s.APIHandler(compat.CreateVolume)).Methods(http.MethodPost) + + // swagger:operation GET /volumes/{name} volumes inspectVolume + // --- + // summary: Inspect volume + // parameters: + // - in: path + // name: name + // type: string + // required: true + // description: the name or ID of the volume + // produces: + // - application/json + // responses: + // '200': + // "$ref": "#/responses/DockerVolumeInfoResponse" + // '404': + // "$ref": "#/responses/NoSuchVolume" + // '500': + // "$ref": "#/responses/InternalError" + r.Handle(VersionedPath("/volumes/{name}"), s.APIHandler(compat.InspectVolume)).Methods(http.MethodGet) + r.Handle("/volumes/{name}", s.APIHandler(compat.InspectVolume)).Methods(http.MethodGet) + + // swagger:operation DELETE /volumes/{name} volumes removeVolume + // --- + // summary: Remove volume + // parameters: + // - in: path + // name: name + // type: string + // required: true + // description: the name or ID of the volume + // - in: query + // name: force + // type: boolean + // description: | + // Force removal of the volume. This actually only causes errors due + // to the names volume not being found to be suppressed, which is the + // behaviour Docker implements. + // produces: + // - application/json + // responses: + // 204: + // description: no error + // 404: + // "$ref": "#/responses/NoSuchVolume" + // 409: + // description: Volume is in use and cannot be removed + // 500: + // "$ref": "#/responses/InternalError" + r.Handle(VersionedPath("/volumes/{name}"), s.APIHandler(compat.RemoveVolume)).Methods(http.MethodDelete) + r.Handle("/volumes/{name}", s.APIHandler(compat.RemoveVolume)).Methods(http.MethodDelete) + + // swagger:operation POST /volumes/prune volumes pruneVolumes + // --- + // summary: Prune volumes + // produces: + // - application/json + // parameters: + // - in: query + // name: filters + // type: string + // description: | + // JSON encoded value of filters (a map[string][]string) to match volumes against before pruning. + // + // Note: No filters are currently supported and any filters specified will cause an error response. + // responses: + // '200': + // "$ref": "#/responses/DockerVolumePruneResponse" + // '500': + // "$ref": "#/responses/InternalError" + r.Handle(VersionedPath("/volumes/prune"), s.APIHandler(compat.PruneVolumes)).Methods(http.MethodPost) + r.Handle("/volumes/prune", s.APIHandler(compat.PruneVolumes)).Methods(http.MethodPost) + return nil } diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index 5b2f8bea2..8af6d3186 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -14,8 +14,8 @@ import ( "syscall" "time" - "github.com/containers/libpod/libpod" - "github.com/containers/libpod/pkg/api/handlers" + "github.com/containers/libpod/v2/libpod" + "github.com/containers/libpod/v2/pkg/api/handlers" "github.com/coreos/go-systemd/v22/activation" "github.com/gorilla/mux" "github.com/gorilla/schema" diff --git a/pkg/api/server/swagger.go b/pkg/api/server/swagger.go index c463f809e..26e8b22c2 100644 --- a/pkg/api/server/swagger.go +++ b/pkg/api/server/swagger.go @@ -1,9 +1,9 @@ package server import ( - "github.com/containers/libpod/libpod" - "github.com/containers/libpod/libpod/define" - "github.com/containers/libpod/pkg/domain/entities" + "github.com/containers/libpod/v2/libpod" + "github.com/containers/libpod/v2/libpod/define" + "github.com/containers/libpod/v2/pkg/domain/entities" ) // No such image |
