From 0a2aae119edc9f5dc66482c6bd01a51e4a76358e Mon Sep 17 00:00:00 2001 From: Philipp Fruck Date: Tue, 24 Oct 2023 17:16:41 +0200 Subject: [PATCH] docs(API): Fix compat network (dis-)connect The endpoints to (dis-)connect networks from/to a container are no longer no-ops. Furthermore, the 403 error handled since #20365 has been documented Signed-off-by: Philipp Fruck --- pkg/api/handlers/swagger/errors.go | 7 +++++++ pkg/api/server/register_networks.go | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/api/handlers/swagger/errors.go b/pkg/api/handlers/swagger/errors.go index 18308d1b7b..1317cf783f 100644 --- a/pkg/api/handlers/swagger/errors.go +++ b/pkg/api/handlers/swagger/errors.go @@ -28,6 +28,13 @@ type networkNotFound struct { Body errorhandling.ErrorModel } +// Network is already connected and container is running or transitioning to the running state ('initialized') +// swagger:response +type networkConnectedError struct { + // in:body + Body errorhandling.ErrorModel +} + // No such exec instance // swagger:response type execSessionNotFound struct { diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index eb95e0d8cc..50f1ffb9b9 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -125,7 +125,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Connect container to network - // description: Connect a container to a network. This endpoint is current a no-op + // description: Connect a container to a network // produces: // - application/json // parameters: @@ -144,6 +144,8 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // description: OK // 400: // $ref: "#/responses/badParamError" + // 403: + // $ref: "#/responses/networkConnectedError" // 500: // $ref: "#/responses/internalError" r.HandleFunc(VersionedPath("/networks/{name}/connect"), s.APIHandler(compat.Connect)).Methods(http.MethodPost) @@ -153,7 +155,7 @@ func (s *APIServer) registerNetworkHandlers(r *mux.Router) error { // tags: // - networks (compat) // summary: Disconnect container from network - // description: Disconnect a container from a network. This endpoint is current a no-op + // description: Disconnect a container from a network // produces: // - application/json // parameters: