diff --git a/api/git/types/types.go b/api/git/types/types.go index 2a91f61b6..055222700 100644 --- a/api/git/types/types.go +++ b/api/git/types/types.go @@ -1,7 +1,10 @@ package gittypes type RepoConfig struct { - URL string - ReferenceName string - ConfigFilePath string + // The repo url + URL string `example:"https://github.com/portainer/portainer-ee.git"` + // The reference name + ReferenceName string `example:"refs/heads/branch_name"` + // Path to where the config file is in this url/refName + ConfigFilePath string `example:"docker-compose.yml"` } diff --git a/api/http/handler/stacks/stack_delete.go b/api/http/handler/stacks/stack_delete.go index 52f003cea..11d2c31b5 100644 --- a/api/http/handler/stacks/stack_delete.go +++ b/api/http/handler/stacks/stack_delete.go @@ -27,7 +27,7 @@ import ( // @success 204 "Success" // @failure 400 "Invalid request" // @failure 403 "Permission denied" -// @failure 404 " not found" +// @failure 404 "Not found" // @failure 500 "Server error" // @router /stacks/{id} [delete] func (handler *Handler) stackDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/stacks/stack_start.go b/api/http/handler/stacks/stack_start.go index 0a915600b..dc4163e92 100644 --- a/api/http/handler/stacks/stack_start.go +++ b/api/http/handler/stacks/stack_start.go @@ -26,7 +26,7 @@ import ( // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" // @failure 403 "Permission denied" -// @failure 404 " not found" +// @failure 404 "Not found" // @failure 500 "Server error" // @router /stacks/{id}/start [post] func (handler *Handler) stackStart(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/stacks/stack_stop.go b/api/http/handler/stacks/stack_stop.go index 7dabfb265..700cec976 100644 --- a/api/http/handler/stacks/stack_stop.go +++ b/api/http/handler/stacks/stack_stop.go @@ -24,7 +24,7 @@ import ( // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" // @failure 403 "Permission denied" -// @failure 404 " not found" +// @failure 404 "Not found" // @failure 500 "Server error" // @router /stacks/{id}/stop [post] func (handler *Handler) stackStop(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/stacks/stack_update.go b/api/http/handler/stacks/stack_update.go index 2d5876ff9..ee02fb2b5 100644 --- a/api/http/handler/stacks/stack_update.go +++ b/api/http/handler/stacks/stack_update.go @@ -61,7 +61,7 @@ func (payload *updateSwarmStackPayload) Validate(r *http.Request) error { // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" // @failure 403 "Permission denied" -// @failure 404 " not found" +// @failure 404 "Not found" // @failure 500 "Server error" // @router /stacks/{id} [put] func (handler *Handler) stackUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/stacks/stack_update_git.go b/api/http/handler/stacks/stack_update_git.go index 9d266cd89..dd46e409e 100644 --- a/api/http/handler/stacks/stack_update_git.go +++ b/api/http/handler/stacks/stack_update_git.go @@ -33,7 +33,23 @@ func (payload *updateStackGitPayload) Validate(r *http.Request) error { return nil } -// PUT request on /api/stacks/:id/git?endpointId= +// @id StackUpdateGit +// @summary Redeploy a stack +// @description Pull and redeploy a stack via Git +// @description **Access policy**: restricted +// @tags stacks +// @security jwt +// @accept json +// @produce json +// @param id path int true "Stack identifier" +// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack." +// @param body body updateStackGitPayload true "Git configs for pull and redeploy a stack" +// @success 200 {object} portainer.Stack "Success" +// @failure 400 "Invalid request" +// @failure 403 "Permission denied" +// @failure 404 "Not found" +// @failure 500 "Server error" +// @router /stacks/{id}/git [put] func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { stackID, err := request.RetrieveNumericRouteVariableValue(r, "id") if err != nil {