summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/compat/networks.go31
-rw-r--r--pkg/api/handlers/libpod/swagger.go3
-rw-r--r--pkg/api/server/register_networks.go14
3 files changed, 33 insertions, 15 deletions
diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go
index 04f8570ff..4e1f31404 100644
--- a/pkg/api/handlers/compat/networks.go
+++ b/pkg/api/handlers/compat/networks.go
@@ -28,19 +28,24 @@ import (
func InspectNetwork(w http.ResponseWriter, r *http.Request) {
runtime := r.Context().Value("runtime").(*libpod.Runtime)
- // FYI scope and version are currently unused but are described by the API
- // Leaving this for if/when we have to enable these
- // query := struct {
- // scope string
- // verbose bool
- // }{
- // // override any golang type defaults
- // }
- // decoder := r.Context().Value("decoder").(*schema.Decoder)
- // 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
- // }
+ // scope is only used to see if the user passes any illegal value, verbose is not used but implemented
+ // for compatibility purposes only.
+ query := struct {
+ scope string `schema:"scope"`
+ verbose bool `schema:"verbose"`
+ }{
+ scope: "local",
+ }
+ decoder := r.Context().Value("decoder").(*schema.Decoder)
+ 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
+ }
+
+ if query.scope != "local" {
+ utils.Error(w, "Invalid scope value. Can only be local.", http.StatusBadRequest, define.ErrInvalidArg)
+ return
+ }
config, err := runtime.GetConfig()
if err != nil {
utils.InternalServerError(w, err)
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index 2ac5009fc..6116a7274 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -4,6 +4,7 @@ import (
"net/http"
"os"
+ "github.com/containernetworking/cni/libcni"
"github.com/containers/image/v5/manifest"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/api/handlers/utils"
@@ -102,7 +103,7 @@ type swagNetworkRmReport struct {
// swagger:response NetworkInspectReport
type swagNetworkInspectReport struct {
// in:body
- Body entities.NetworkInspectReport
+ Body libcni.NetworkConfigList
}
// Network list
diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go
index d122c6a36..cacf83a7f 100644
--- a/pkg/api/server/register_networks.go
+++ b/pkg/api/server/register_networks.go
@@ -44,6 +44,16 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// type: string
// required: true
// description: the name of the network
+ // - in: query
+ // name: verbose
+ // type: boolean
+ // required: false
+ // description: Detailed inspect output for troubleshooting
+ // - in: query
+ // name: scope
+ // type: string
+ // required: false
+ // description: Filter the network by scope (swarm, global, or local)
// produces:
// - application/json
// responses:
@@ -271,7 +281,9 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error {
// tags:
// - networks
// summary: Inspect a network
- // description: Display low level configuration for a CNI network
+ // description: |
+ // Display low level configuration for a CNI network.
+ // - In a 200 response, all of the fields named Bytes are returned as a Base64 encoded string.
// parameters:
// - in: path
// name: name