summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/compat/changes.go4
-rw-r--r--pkg/api/handlers/compat/containers.go39
-rw-r--r--pkg/api/handlers/compat/containers_archive.go2
-rw-r--r--pkg/api/handlers/compat/containers_attach.go6
-rw-r--r--pkg/api/handlers/compat/containers_create.go14
-rw-r--r--pkg/api/handlers/compat/containers_export.go4
-rw-r--r--pkg/api/handlers/compat/containers_logs.go8
-rw-r--r--pkg/api/handlers/compat/containers_pause.go4
-rw-r--r--pkg/api/handlers/compat/containers_prune.go8
-rw-r--r--pkg/api/handlers/compat/containers_restart.go4
-rw-r--r--pkg/api/handlers/compat/containers_start.go6
-rw-r--r--pkg/api/handlers/compat/containers_stats.go8
-rw-r--r--pkg/api/handlers/compat/containers_stop.go6
-rw-r--r--pkg/api/handlers/compat/containers_top.go6
-rw-r--r--pkg/api/handlers/compat/containers_unpause.go4
-rw-r--r--pkg/api/handlers/compat/events.go14
-rw-r--r--pkg/api/handlers/compat/exec.go10
-rw-r--r--pkg/api/handlers/compat/images.go14
-rw-r--r--pkg/api/handlers/compat/images_build.go6
-rw-r--r--pkg/api/handlers/compat/images_history.go6
-rw-r--r--pkg/api/handlers/compat/images_push.go8
-rw-r--r--pkg/api/handlers/compat/images_remove.go4
-rw-r--r--pkg/api/handlers/compat/images_search.go4
-rw-r--r--pkg/api/handlers/compat/images_tag.go4
-rw-r--r--pkg/api/handlers/compat/info.go10
-rw-r--r--pkg/api/handlers/compat/networks.go10
-rw-r--r--pkg/api/handlers/compat/ping.go2
-rw-r--r--pkg/api/handlers/compat/resize.go6
-rw-r--r--pkg/api/handlers/compat/swagger.go2
-rw-r--r--pkg/api/handlers/compat/system.go4
-rw-r--r--pkg/api/handlers/compat/unsupported.go4
-rw-r--r--pkg/api/handlers/compat/version.go8
-rw-r--r--pkg/api/handlers/compat/volumes.go259
-rw-r--r--pkg/api/handlers/decoder.go2
-rw-r--r--pkg/api/handlers/libpod/containers.go12
-rw-r--r--pkg/api/handlers/libpod/containers_create.go10
-rw-r--r--pkg/api/handlers/libpod/copy.go2
-rw-r--r--pkg/api/handlers/libpod/generate.go8
-rw-r--r--pkg/api/handlers/libpod/healthcheck.go6
-rw-r--r--pkg/api/handlers/libpod/images.go24
-rw-r--r--pkg/api/handlers/libpod/info.go4
-rw-r--r--pkg/api/handlers/libpod/manifests.go8
-rw-r--r--pkg/api/handlers/libpod/networks.go10
-rw-r--r--pkg/api/handlers/libpod/play.go10
-rw-r--r--pkg/api/handlers/libpod/pods.go18
-rw-r--r--pkg/api/handlers/libpod/swagger.go6
-rw-r--r--pkg/api/handlers/libpod/system.go10
-rw-r--r--pkg/api/handlers/libpod/volumes.go12
-rw-r--r--pkg/api/handlers/swagger/swagger.go12
-rw-r--r--pkg/api/handlers/types.go4
-rw-r--r--pkg/api/handlers/utils/containers.go8
-rw-r--r--pkg/api/handlers/utils/errors.go4
-rw-r--r--pkg/api/handlers/utils/images.go4
-rw-r--r--pkg/api/handlers/utils/pods.go6
-rw-r--r--pkg/api/server/handler_api.go2
-rw-r--r--pkg/api/server/register_archive.go4
-rw-r--r--pkg/api/server/register_auth.go2
-rw-r--r--pkg/api/server/register_containers.go4
-rw-r--r--pkg/api/server/register_distribution.go2
-rw-r--r--pkg/api/server/register_events.go2
-rw-r--r--pkg/api/server/register_exec.go2
-rw-r--r--pkg/api/server/register_generate.go2
-rw-r--r--pkg/api/server/register_healthcheck.go2
-rw-r--r--pkg/api/server/register_images.go4
-rw-r--r--pkg/api/server/register_info.go4
-rw-r--r--pkg/api/server/register_manifest.go2
-rw-r--r--pkg/api/server/register_monitor.go2
-rw-r--r--pkg/api/server/register_networks.go4
-rw-r--r--pkg/api/server/register_ping.go2
-rw-r--r--pkg/api/server/register_play.go2
-rw-r--r--pkg/api/server/register_plugins.go2
-rw-r--r--pkg/api/server/register_pods.go2
-rw-r--r--pkg/api/server/register_swagger.go2
-rw-r--r--pkg/api/server/register_swarm.go2
-rw-r--r--pkg/api/server/register_system.go4
-rw-r--r--pkg/api/server/register_version.go2
-rw-r--r--pkg/api/server/register_volumes.go135
-rw-r--r--pkg/api/server/server.go4
-rw-r--r--pkg/api/server/swagger.go6
79 files changed, 639 insertions, 240 deletions
diff --git a/pkg/api/handlers/compat/changes.go b/pkg/api/handlers/compat/changes.go
index 6907c487e..44faf8e84 100644
--- a/pkg/api/handlers/compat/changes.go
+++ b/pkg/api/handlers/compat/changes.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
func Changes(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index b103e399d..52b925d3c 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -6,11 +6,11 @@ import (
"net/http"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/signal"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/signal"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/go-connections/nat"
@@ -321,17 +321,17 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
stopTimeout := int(l.StopTimeout())
- ports := make(nat.PortSet)
- for p := range inspect.HostConfig.PortBindings {
- splitp := strings.SplitN(p, "/", 2)
+ exposedPorts := make(nat.PortSet)
+ for ep := range inspect.HostConfig.PortBindings {
+ splitp := strings.SplitN(ep, "/", 2)
if len(splitp) != 2 {
- return nil, errors.Errorf("PORT/PROTOCOL Format required for %q", p)
+ return nil, errors.Errorf("PORT/PROTOCOL Format required for %q", ep)
}
- port, err := nat.NewPort(splitp[1], splitp[0])
+ exposedPort, err := nat.NewPort(splitp[1], splitp[0])
if err != nil {
return nil, err
}
- ports[port] = struct{}{}
+ exposedPorts[exposedPort] = struct{}{}
}
config := container.Config{
@@ -341,7 +341,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
AttachStdin: inspect.Config.AttachStdin,
AttachStdout: inspect.Config.AttachStdout,
AttachStderr: inspect.Config.AttachStderr,
- ExposedPorts: ports,
+ ExposedPorts: exposedPorts,
Tty: inspect.Config.Tty,
OpenStdin: inspect.Config.OpenStdin,
StdinOnce: inspect.Config.StdinOnce,
@@ -371,6 +371,15 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
return nil, err
}
+ p, err := json.Marshal(inspect.NetworkSettings.Ports)
+ if err != nil {
+ return nil, err
+ }
+ ports := nat.PortMap{}
+ if err := json.Unmarshal(p, &ports); err != nil {
+ return nil, err
+ }
+
networkSettingsDefault := types.DefaultNetworkSettings{
EndpointID: "",
Gateway: "",
@@ -382,8 +391,12 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
MacAddress: l.Config().StaticMAC.String(),
}
+ networkSettingsBase := types.NetworkSettingsBase{
+ Ports: ports,
+ }
+
networkSettings := types.NetworkSettings{
- NetworkSettingsBase: types.NetworkSettingsBase{},
+ NetworkSettingsBase: networkSettingsBase,
DefaultNetworkSettings: networkSettingsDefault,
Networks: nil,
}
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go
index c3a26873e..1225b541e 100644
--- a/pkg/api/handlers/compat/containers_archive.go
+++ b/pkg/api/handlers/compat/containers_archive.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"
)
func Archive(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/compat/containers_attach.go b/pkg/api/handlers/compat/containers_attach.go
index aad6e2294..325f96b40 100644
--- a/pkg/api/handlers/compat/containers_attach.go
+++ b/pkg/api/handlers/compat/containers_attach.go
@@ -4,9 +4,9 @@ import (
"fmt"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index 3ae9d9ab3..8034a529c 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -7,13 +7,13 @@ import (
"strings"
"github.com/containers/common/pkg/config"
- "github.com/containers/libpod/libpod"
- image2 "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/namespaces"
- "github.com/containers/libpod/pkg/signal"
- createconfig "github.com/containers/libpod/pkg/spec"
+ "github.com/containers/libpod/v2/libpod"
+ image2 "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/namespaces"
+ "github.com/containers/libpod/v2/pkg/signal"
+ createconfig "github.com/containers/libpod/v2/pkg/spec"
"github.com/containers/storage"
"github.com/gorilla/schema"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/compat/containers_export.go b/pkg/api/handlers/compat/containers_export.go
index 37b9fbf2b..35ef797c0 100644
--- a/pkg/api/handlers/compat/containers_export.go
+++ b/pkg/api/handlers/compat/containers_export.go
@@ -5,8 +5,8 @@ import (
"net/http"
"os"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/containers_logs.go b/pkg/api/handlers/compat/containers_logs.go
index 3b25a3ecc..8147f4d38 100644
--- a/pkg/api/handlers/compat/containers_logs.go
+++ b/pkg/api/handlers/compat/containers_logs.go
@@ -10,10 +10,10 @@ import (
"sync"
"time"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/logs"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/util"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/logs"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/util"
"github.com/gorilla/schema"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/compat/containers_pause.go b/pkg/api/handlers/compat/containers_pause.go
index 060bdbaeb..5e7d78607 100644
--- a/pkg/api/handlers/compat/containers_pause.go
+++ b/pkg/api/handlers/compat/containers_pause.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
func PauseContainer(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go
index 9d77f612b..63ffed0f1 100644
--- a/pkg/api/handlers/compat/containers_prune.go
+++ b/pkg/api/handlers/compat/containers_prune.go
@@ -3,10 +3,10 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- lpfilters "github.com/containers/libpod/libpod/filters"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/libpod"
+ lpfilters "github.com/containers/libpod/v2/libpod/filters"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/docker/docker/api/types"
"github.com/gorilla/schema"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/compat/containers_restart.go b/pkg/api/handlers/compat/containers_restart.go
index 343bf96d2..97f453baa 100644
--- a/pkg/api/handlers/compat/containers_restart.go
+++ b/pkg/api/handlers/compat/containers_restart.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/containers_start.go b/pkg/api/handlers/compat/containers_start.go
index cdbc8ff76..111c572aa 100644
--- a/pkg/api/handlers/compat/containers_start.go
+++ b/pkg/api/handlers/compat/containers_start.go
@@ -5,9 +5,9 @@ import (
"github.com/sirupsen/logrus"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
)
diff --git a/pkg/api/handlers/compat/containers_stats.go b/pkg/api/handlers/compat/containers_stats.go
index 048321add..2cfe140c8 100644
--- a/pkg/api/handlers/compat/containers_stats.go
+++ b/pkg/api/handlers/compat/containers_stats.go
@@ -5,10 +5,10 @@ import (
"net/http"
"time"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/cgroups"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/cgroups"
docker "github.com/docker/docker/api/types"
"github.com/gorilla/schema"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/compat/containers_stop.go b/pkg/api/handlers/compat/containers_stop.go
index d26ef2c82..bbfa248a1 100644
--- a/pkg/api/handlers/compat/containers_stop.go
+++ b/pkg/api/handlers/compat/containers_stop.go
@@ -3,9 +3,9 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/containers_top.go b/pkg/api/handlers/compat/containers_top.go
index 202be55d1..9b45fbcf5 100644
--- a/pkg/api/handlers/compat/containers_top.go
+++ b/pkg/api/handlers/compat/containers_top.go
@@ -4,9 +4,9 @@ import (
"net/http"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/containers_unpause.go b/pkg/api/handlers/compat/containers_unpause.go
index adabdeaea..67b4f219a 100644
--- a/pkg/api/handlers/compat/containers_unpause.go
+++ b/pkg/api/handlers/compat/containers_unpause.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
func UnpauseContainer(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go
index 577ddd0a1..5acc94153 100644
--- a/pkg/api/handlers/compat/events.go
+++ b/pkg/api/handlers/compat/events.go
@@ -1,13 +1,14 @@
package compat
import (
+ "context"
"fmt"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/events"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/events"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/gorilla/schema"
jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
@@ -45,13 +46,15 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
fromStart = true
}
+ eventCtx, eventCancel := context.WithCancel(r.Context())
eventChannel := make(chan *events.Event)
go func() {
readOpts := events.ReadOptions{FromStart: fromStart, Stream: query.Stream, Filters: libpodFilters, EventChannel: eventChannel, Since: query.Since, Until: query.Until}
- eventsError = runtime.Events(readOpts)
+ eventsError = runtime.Events(eventCtx, readOpts)
}()
if eventsError != nil {
utils.InternalServerError(w, eventsError)
+ eventCancel()
close(eventChannel)
return
}
@@ -59,6 +62,7 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
// If client disappears we need to stop listening for events
go func(done <-chan struct{}) {
<-done
+ eventCancel()
if _, ok := <-eventChannel; ok {
close(eventChannel)
}
diff --git a/pkg/api/handlers/compat/exec.go b/pkg/api/handlers/compat/exec.go
index dae76c061..aee4196dd 100644
--- a/pkg/api/handlers/compat/exec.go
+++ b/pkg/api/handlers/compat/exec.go
@@ -6,11 +6,11 @@ import (
"net/http"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/specgen/generate"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/specgen/generate"
"github.com/gorilla/mux"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go
index ce9ff1b19..94feb5920 100644
--- a/pkg/api/handlers/compat/images.go
+++ b/pkg/api/handlers/compat/images.go
@@ -11,13 +11,13 @@ import (
"github.com/containers/buildah"
"github.com/containers/image/v5/manifest"
- "github.com/containers/libpod/libpod"
- image2 "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/auth"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/util"
+ "github.com/containers/libpod/v2/libpod"
+ image2 "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/auth"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/util"
"github.com/docker/docker/api/types"
"github.com/gorilla/schema"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index f967acf32..8ac5b80c1 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -15,9 +15,9 @@ import (
"github.com/containers/buildah"
"github.com/containers/buildah/imagebuildah"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/containers/storage/pkg/archive"
"github.com/gorilla/schema"
)
diff --git a/pkg/api/handlers/compat/images_history.go b/pkg/api/handlers/compat/images_history.go
index 7c0bbf828..33902362f 100644
--- a/pkg/api/handlers/compat/images_history.go
+++ b/pkg/api/handlers/compat/images_history.go
@@ -3,9 +3,9 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index 47976b7c9..c73bbb8d6 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -6,10 +6,10 @@ import (
"os"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/auth"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/auth"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/images_remove.go b/pkg/api/handlers/compat/images_remove.go
index ed0153529..367cab9e1 100644
--- a/pkg/api/handlers/compat/images_remove.go
+++ b/pkg/api/handlers/compat/images_remove.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/images_search.go b/pkg/api/handlers/compat/images_search.go
index 8da685527..c8e37b214 100644
--- a/pkg/api/handlers/compat/images_search.go
+++ b/pkg/api/handlers/compat/images_search.go
@@ -5,8 +5,8 @@ import (
"strconv"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/images_tag.go b/pkg/api/handlers/compat/images_tag.go
index 722be5653..0ac11c7f5 100644
--- a/pkg/api/handlers/compat/images_tag.go
+++ b/pkg/api/handlers/compat/images_tag.go
@@ -4,8 +4,8 @@ import (
"fmt"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/info.go b/pkg/api/handlers/compat/info.go
index 5c3f610a4..6c44393cc 100644
--- a/pkg/api/handlers/compat/info.go
+++ b/pkg/api/handlers/compat/info.go
@@ -11,11 +11,11 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/common/pkg/sysinfo"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/rootless"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/rootless"
docker "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/google/uuid"
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index 7209255d7..2e11c0edb 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -9,11 +9,11 @@ import (
"time"
"github.com/containernetworking/cni/libcni"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
- "github.com/containers/libpod/pkg/network"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/pkg/network"
"github.com/docker/docker/api/types"
dockerNetwork "github.com/docker/docker/api/types/network"
"github.com/gorilla/schema"
diff --git a/pkg/api/handlers/compat/ping.go b/pkg/api/handlers/compat/ping.go
index d275c4a02..b7cc0246e 100644
--- a/pkg/api/handlers/compat/ping.go
+++ b/pkg/api/handlers/compat/ping.go
@@ -5,7 +5,7 @@ import (
"net/http"
"github.com/containers/buildah"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
// Ping returns headers to client about the service
diff --git a/pkg/api/handlers/compat/resize.go b/pkg/api/handlers/compat/resize.go
index 478a8fab4..7caff3d40 100644
--- a/pkg/api/handlers/compat/resize.go
+++ b/pkg/api/handlers/compat/resize.go
@@ -5,9 +5,9 @@ import (
"net/http"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/mux"
"github.com/gorilla/schema"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/compat/swagger.go b/pkg/api/handlers/compat/swagger.go
index dc94a7ebd..c59d25c5a 100644
--- a/pkg/api/handlers/compat/swagger.go
+++ b/pkg/api/handlers/compat/swagger.go
@@ -1,7 +1,7 @@
package compat
import (
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/containers/storage/pkg/archive"
"github.com/docker/docker/api/types"
)
diff --git a/pkg/api/handlers/compat/system.go b/pkg/api/handlers/compat/system.go
index 47e187ba1..4f2692e2a 100644
--- a/pkg/api/handlers/compat/system.go
+++ b/pkg/api/handlers/compat/system.go
@@ -3,8 +3,8 @@ package compat
import (
"net/http"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
docker "github.com/docker/docker/api/types"
)
diff --git a/pkg/api/handlers/compat/unsupported.go b/pkg/api/handlers/compat/unsupported.go
index 55660882f..9db0c3feb 100644
--- a/pkg/api/handlers/compat/unsupported.go
+++ b/pkg/api/handlers/compat/unsupported.go
@@ -4,9 +4,9 @@ import (
"fmt"
"net/http"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
- "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/handlers/compat/version.go b/pkg/api/handlers/compat/version.go
index 3164b16b9..6dd0cec2c 100644
--- a/pkg/api/handlers/compat/version.go
+++ b/pkg/api/handlers/compat/version.go
@@ -6,10 +6,10 @@ import (
goRuntime "runtime"
"time"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "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/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
docker "github.com/docker/docker/api/types"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go
new file mode 100644
index 000000000..4b5d94730
--- /dev/null
+++ b/pkg/api/handlers/compat/volumes.go
@@ -0,0 +1,259 @@
+package compat
+
+import (
+ "encoding/json"
+ "net/http"
+ "time"
+
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/filters"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi/parse"
+ docker_api_types "github.com/docker/docker/api/types"
+ docker_api_types_volume "github.com/docker/docker/api/types/volume"
+ "github.com/gorilla/schema"
+ "github.com/pkg/errors"
+)
+
+func ListVolumes(w http.ResponseWriter, r *http.Request) {
+ var (
+ decoder = r.Context().Value("decoder").(*schema.Decoder)
+ runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ )
+ query := struct {
+ Filters map[string][]string `schema:"filters"`
+ }{
+ // 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
+ }
+
+ // Reject any libpod specific filters since `GenerateVolumeFilters()` will
+ // happily parse them for us.
+ for filter := range query.Filters {
+ if filter == "opts" {
+ utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
+ errors.Errorf("unsupported libpod filters passed to docker endpoint"))
+ return
+ }
+ }
+ volumeFilters, err := filters.GenerateVolumeFilters(query.Filters)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+
+ vols, err := runtime.Volumes(volumeFilters...)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ volumeConfigs := make([]*docker_api_types.Volume, 0, len(vols))
+ for _, v := range vols {
+ config := docker_api_types.Volume{
+ Name: v.Name(),
+ Driver: v.Driver(),
+ Mountpoint: v.MountPoint(),
+ CreatedAt: v.CreatedTime().Format(time.RFC3339),
+ Labels: v.Labels(),
+ Scope: v.Scope(),
+ Options: v.Options(),
+ }
+ volumeConfigs = append(volumeConfigs, &config)
+ }
+ response := docker_api_types_volume.VolumeListOKBody{
+ Volumes: volumeConfigs,
+ Warnings: []string{},
+ }
+ utils.WriteResponse(w, http.StatusOK, response)
+}
+
+func CreateVolume(w http.ResponseWriter, r *http.Request) {
+ var (
+ volumeOptions []libpod.VolumeCreateOption
+ runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ decoder = r.Context().Value("decoder").(*schema.Decoder)
+ )
+ /* No query string data*/
+ query := struct{}{}
+ 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
+ }
+ // decode params from body
+ input := docker_api_types_volume.VolumeCreateBody{}
+ if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()"))
+ return
+ }
+
+ if len(input.Name) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeName(input.Name))
+ }
+ if len(input.Driver) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeDriver(input.Driver))
+ }
+ if len(input.Labels) > 0 {
+ volumeOptions = append(volumeOptions, libpod.WithVolumeLabels(input.Labels))
+ }
+ if len(input.DriverOpts) > 0 {
+ parsedOptions, err := parse.VolumeOptions(input.DriverOpts)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ volumeOptions = append(volumeOptions, parsedOptions...)
+ }
+ vol, err := runtime.NewVolume(r.Context(), volumeOptions...)
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ config, err := vol.Config()
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ volResponse := docker_api_types.Volume{
+ Name: config.Name,
+ Driver: config.Driver,
+ Mountpoint: config.MountPoint,
+ CreatedAt: config.CreatedTime.Format(time.RFC3339),
+ Labels: config.Labels,
+ Options: config.Options,
+ Scope: "local",
+ // ^^ We don't have volume scoping so we'll just claim it's "local"
+ // like we do in the `libpod.Volume.Scope()` method
+ //
+ // TODO: We don't include the volume `Status` or `UsageData`, but both
+ // are nullable in the Docker engine API spec so that's fine for now
+ }
+ utils.WriteResponse(w, http.StatusCreated, volResponse)
+}
+
+func InspectVolume(w http.ResponseWriter, r *http.Request) {
+ var (
+ runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ )
+ name := utils.GetName(r)
+ vol, err := runtime.GetVolume(name)
+ if err != nil {
+ utils.VolumeNotFound(w, name, err)
+ return
+ }
+ volResponse := docker_api_types.Volume{
+ Name: vol.Name(),
+ Driver: vol.Driver(),
+ Mountpoint: vol.MountPoint(),
+ CreatedAt: vol.CreatedTime().Format(time.RFC3339),
+ Labels: vol.Labels(),
+ Options: vol.Options(),
+ Scope: vol.Scope(),
+ // TODO: As above, we don't return `Status` or `UsageData` yet
+ }
+ utils.WriteResponse(w, http.StatusOK, volResponse)
+}
+
+func RemoveVolume(w http.ResponseWriter, r *http.Request) {
+ var (
+ runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ decoder = r.Context().Value("decoder").(*schema.Decoder)
+ )
+ query := struct {
+ Force bool `schema:"force"`
+ }{
+ // 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
+ }
+
+ /* The implications for `force` differ between Docker and us, so we can't
+ * simply pass the `force` parameter to `runeimt.RemoveVolume()`.
+ * Specifically, Docker's behavior seems to be that `force` means "do not
+ * error on missing volume"; ours means "remove any not-running containers
+ * using the volume at the same time".
+ *
+ * With this in mind, we only consider the `force` query parameter when we
+ * hunt for specified volume by name, using it to seletively return a 204
+ * or blow up depending on `force` being truthy or falsey/unset
+ * respectively.
+ */
+ name := utils.GetName(r)
+ vol, err := runtime.LookupVolume(name)
+ if err == nil {
+ // As above, we do not pass `force` from the query parameters here
+ if err := runtime.RemoveVolume(r.Context(), vol, false); err != nil {
+ if errors.Cause(err) == define.ErrVolumeBeingUsed {
+ utils.Error(w, "volumes being used", http.StatusConflict, err)
+ } else {
+ utils.InternalServerError(w, err)
+ }
+ } else {
+ // Success
+ utils.WriteResponse(w, http.StatusNoContent, "")
+ }
+ } else {
+ if !query.Force {
+ utils.VolumeNotFound(w, name, err)
+ } else {
+ // Volume does not exist and `force` is truthy - this emulates what
+ // Docker would do when told to `force` removal of a nonextant
+ // volume
+ utils.WriteResponse(w, http.StatusNoContent, "")
+ }
+ }
+}
+
+func PruneVolumes(w http.ResponseWriter, r *http.Request) {
+ var (
+ runtime = r.Context().Value("runtime").(*libpod.Runtime)
+ decoder = r.Context().Value("decoder").(*schema.Decoder)
+ )
+ // For some reason the prune filters are query parameters even though this
+ // is a POST endpoint
+ query := struct {
+ Filters map[string][]string `schema:"filters"`
+ }{
+ // override any golang type defaults
+ }
+
+ if err := decoder.Decode(&query, r.URL.Query()); err != nil {
+ utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
+ return
+ }
+ // TODO: We have no ability to pass pruning filters to `PruneVolumes()` so
+ // we'll explicitly reject the request if we see any
+ if len(query.Filters) > 0 {
+ utils.InternalServerError(w, errors.New("filters for pruning volumes is not implemented"))
+ return
+ }
+
+ pruned, err := runtime.PruneVolumes(r.Context())
+ if err != nil {
+ utils.InternalServerError(w, err)
+ return
+ }
+ prunedIds := make([]string, 0, len(pruned))
+ for k := range pruned {
+ // XXX: This drops any pruning per-volume error messages on the floor
+ prunedIds = append(prunedIds, k)
+ }
+ pruneResponse := docker_api_types.VolumesPruneReport{
+ VolumesDeleted: prunedIds,
+ // TODO: We don't have any insight into how much space was reclaimed
+ // from `PruneVolumes()` but it's not nullable
+ SpaceReclaimed: 0,
+ }
+
+ utils.WriteResponse(w, http.StatusOK, pruneResponse)
+}
diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go
index e46cd8837..8fcb794f2 100644
--- a/pkg/api/handlers/decoder.go
+++ b/pkg/api/handlers/decoder.go
@@ -6,7 +6,7 @@ import (
"syscall"
"time"
- "github.com/containers/libpod/pkg/util"
+ "github.com/containers/libpod/v2/pkg/util"
"github.com/gorilla/schema"
"github.com/sirupsen/logrus"
)
diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go
index 506286736..008bff8c5 100644
--- a/pkg/api/handlers/libpod/containers.go
+++ b/pkg/api/handlers/libpod/containers.go
@@ -6,12 +6,12 @@ import (
"os"
"strconv"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/compat"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/ps"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/compat"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/ps"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/libpod/containers_create.go b/pkg/api/handlers/libpod/containers_create.go
index 8fbff9be7..2d9ffecce 100644
--- a/pkg/api/handlers/libpod/containers_create.go
+++ b/pkg/api/handlers/libpod/containers_create.go
@@ -5,11 +5,11 @@ import (
"encoding/json"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/specgen"
- "github.com/containers/libpod/pkg/specgen/generate"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/specgen"
+ "github.com/containers/libpod/v2/pkg/specgen/generate"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/copy.go b/pkg/api/handlers/libpod/copy.go
index a3b404bce..045d87576 100644
--- a/pkg/api/handlers/libpod/copy.go
+++ b/pkg/api/handlers/libpod/copy.go
@@ -3,7 +3,7 @@ package libpod
import (
"net/http"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/generate.go b/pkg/api/handlers/libpod/generate.go
index 23320d346..63dfcbf90 100644
--- a/pkg/api/handlers/libpod/generate.go
+++ b/pkg/api/handlers/libpod/generate.go
@@ -3,10 +3,10 @@ package libpod
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/healthcheck.go b/pkg/api/handlers/libpod/healthcheck.go
index 0ca3574b7..93fd68403 100644
--- a/pkg/api/handlers/libpod/healthcheck.go
+++ b/pkg/api/handlers/libpod/healthcheck.go
@@ -3,9 +3,9 @@ package libpod
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
func RunHealthCheck(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go
index ebcb1f460..b21c3b8f7 100644
--- a/pkg/api/handlers/libpod/images.go
+++ b/pkg/api/handlers/libpod/images.go
@@ -15,18 +15,18 @@ import (
"github.com/containers/image/v5/docker/reference"
"github.com/containers/image/v5/manifest"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/libpod/image"
- image2 "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/auth"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
- "github.com/containers/libpod/pkg/errorhandling"
- "github.com/containers/libpod/pkg/util"
- utils2 "github.com/containers/libpod/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/libpod/image"
+ image2 "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/auth"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/pkg/errorhandling"
+ "github.com/containers/libpod/v2/pkg/util"
+ utils2 "github.com/containers/libpod/v2/utils"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/libpod/info.go b/pkg/api/handlers/libpod/info.go
index cbf03aa17..9cdc08597 100644
--- a/pkg/api/handlers/libpod/info.go
+++ b/pkg/api/handlers/libpod/info.go
@@ -3,8 +3,8 @@ package libpod
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
)
func GetInfo(w http.ResponseWriter, r *http.Request) {
diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go
index aef92368b..24769b316 100644
--- a/pkg/api/handlers/libpod/manifests.go
+++ b/pkg/api/handlers/libpod/manifests.go
@@ -7,10 +7,10 @@ import (
"github.com/containers/buildah/manifests"
copy2 "github.com/containers/image/v5/copy"
"github.com/containers/image/v5/transports/alltransports"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/gorilla/schema"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index 7de285e5e..12409bf50 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -4,11 +4,11 @@ import (
"encoding/json"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
- "github.com/containers/libpod/pkg/network"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/pkg/network"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/play.go b/pkg/api/handlers/libpod/play.go
index 1cb5cdb6c..fcb56b130 100644
--- a/pkg/api/handlers/libpod/play.go
+++ b/pkg/api/handlers/libpod/play.go
@@ -7,11 +7,11 @@ import (
"os"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/auth"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/auth"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go
index 4b57ef26a..dee5a7d33 100644
--- a/pkg/api/handlers/libpod/pods.go
+++ b/pkg/api/handlers/libpod/pods.go
@@ -6,15 +6,15 @@ import (
"net/http"
"strings"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
- "github.com/containers/libpod/pkg/specgen"
- "github.com/containers/libpod/pkg/specgen/generate"
- "github.com/containers/libpod/pkg/util"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/pkg/specgen"
+ "github.com/containers/libpod/v2/pkg/specgen/generate"
+ "github.com/containers/libpod/v2/pkg/util"
"github.com/gorilla/schema"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index 057fbfb41..21f5c1e59 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -5,9 +5,9 @@ import (
"os"
"github.com/containers/image/v5/manifest"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/system.go b/pkg/api/handlers/libpod/system.go
index 52d3b91ab..c09480bd1 100644
--- a/pkg/api/handlers/libpod/system.go
+++ b/pkg/api/handlers/libpod/system.go
@@ -3,11 +3,11 @@ package libpod
import (
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/pkg/api/handlers/compat"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/infra/abi"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/pkg/api/handlers/compat"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/libpod/volumes.go b/pkg/api/handlers/libpod/volumes.go
index 6523244f3..0d83218e3 100644
--- a/pkg/api/handlers/libpod/volumes.go
+++ b/pkg/api/handlers/libpod/volumes.go
@@ -4,12 +4,12 @@ import (
"encoding/json"
"net/http"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/api/handlers/utils"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/domain/filters"
- "github.com/containers/libpod/pkg/domain/infra/abi/parse"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/api/handlers/utils"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/domain/filters"
+ "github.com/containers/libpod/v2/pkg/domain/infra/abi/parse"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/swagger/swagger.go b/pkg/api/handlers/swagger/swagger.go
index 5d125417b..e35c4e9e3 100644
--- a/pkg/api/handlers/swagger/swagger.go
+++ b/pkg/api/handlers/swagger/swagger.go
@@ -1,12 +1,12 @@
package swagger
import (
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/api/handlers"
- "github.com/containers/libpod/pkg/domain/entities"
- "github.com/containers/libpod/pkg/inspect"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/api/handlers"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ "github.com/containers/libpod/v2/pkg/inspect"
"github.com/docker/docker/api/types"
)
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index 72e1a756e..9c3c35c5f 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -7,8 +7,8 @@ import (
"time"
"github.com/containers/image/v5/manifest"
- libpodImage "github.com/containers/libpod/libpod/image"
- "github.com/containers/libpod/pkg/domain/entities"
+ libpodImage "github.com/containers/libpod/v2/libpod/image"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
docker "github.com/docker/docker/api/types"
dockerContainer "github.com/docker/docker/api/types/container"
dockerNetwork "github.com/docker/docker/api/types/network"
diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go
index 4bcac6e72..2c040526b 100644
--- a/pkg/api/handlers/utils/containers.go
+++ b/pkg/api/handlers/utils/containers.go
@@ -5,10 +5,10 @@ import (
"net/http"
"time"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/domain/entities"
- createconfig "github.com/containers/libpod/pkg/spec"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
+ createconfig "github.com/containers/libpod/v2/pkg/spec"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go
index c17720694..00d09ac11 100644
--- a/pkg/api/handlers/utils/errors.go
+++ b/pkg/api/handlers/utils/errors.go
@@ -4,8 +4,8 @@ import (
"fmt"
"net/http"
- "github.com/containers/libpod/libpod/define"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/libpod/define"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go
index 521f727be..195e71b75 100644
--- a/pkg/api/handlers/utils/images.go
+++ b/pkg/api/handlers/utils/images.go
@@ -9,8 +9,8 @@ import (
"github.com/containers/image/v5/storage"
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/image/v5/types"
- "github.com/containers/libpod/libpod"
- "github.com/containers/libpod/libpod/image"
+ "github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/image"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
diff --git a/pkg/api/handlers/utils/pods.go b/pkg/api/handlers/utils/pods.go
index 0bb818c1c..efad02dd9 100644
--- a/pkg/api/handlers/utils/pods.go
+++ b/pkg/api/handlers/utils/pods.go
@@ -3,9 +3,9 @@ package utils
import (
"net/http"
- "github.com/containers/libpod/libpod"
- lpfilters "github.com/containers/libpod/libpod/filters"
- "github.com/containers/libpod/pkg/domain/entities"
+ "github.com/containers/libpod/v2/libpod"
+ lpfilters "github.com/containers/libpod/v2/libpod/filters"
+ "github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/gorilla/schema"
)
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