From dad762de9fc0c9535c17ed7d74d6cdc9d16af292 Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Thu, 7 Oct 2021 15:32:07 +1300 Subject: [PATCH] added swagger docs to websocketShellPodExec (#5840) --- api/http/handler/websocket/shell_pod.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/api/http/handler/websocket/shell_pod.go b/api/http/handler/websocket/shell_pod.go index 3aa5c2463..4249a350d 100644 --- a/api/http/handler/websocket/shell_pod.go +++ b/api/http/handler/websocket/shell_pod.go @@ -10,13 +10,21 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// websocketShellPodExec handles GET requests on /websocket/pod?token=&endpointId= -// The request will be upgraded to the websocket protocol. -// Authentication and access is controlled via the mandatory token query parameter. -// The request will proxy input from the client to the pod via long-lived websocket connection. -// The following query parameters are mandatory: -// * token: JWT token used for authentication against this environment(endpoint) -// * endpointId: environment(endpoint) ID of the environment(endpoint) where the resource is located +// @summary Execute a websocket on kubectl shell pod +// @description The request will be upgraded to the websocket protocol. The request will proxy input from the client to the pod via long-lived websocket connection. +// @description **Access policy**: authenticated +// @security jwt +// @tags websocket +// @accept json +// @produce json +// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located" +// @param token query string true "JWT token used for authentication against this environment(endpoint)" +// @success 200 +// @failure 400 +// @failure 403 +// @failure 404 +// @failure 500 +// @router /websocket/kubernetes-shell [get] func (handler *Handler) websocketShellPodExec(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", false) if err != nil {