fix(swagger): swagger docs for http status code 409 [EE-5767] (#11535)

pull/11527/head^2
Prabhat Khera 2024-04-19 15:19:13 +12:00 committed by GitHub
parent 0fb3555a70
commit 7e9dd01265
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 18 additions and 9 deletions

View File

@ -19,8 +19,9 @@ import (
// @security jwt // @security jwt
// @param id path int true "EdgeGroup Id" // @param id path int true "EdgeGroup Id"
// @success 204 // @success 204
// @failure 409 "Edge group is in use by an Edge stack or Edge job"
// @failure 503 "Edge compute features are disabled" // @failure 503 "Edge compute features are disabled"
// @failure 500 // @failure 500 "Server error"
// @router /edge_groups/{id} [delete] // @router /edge_groups/{id} [delete]
func (handler *Handler) edgeGroupDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) edgeGroupDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
edgeGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id") edgeGroupID, err := request.RetrieveNumericRouteVariableValue(r, "id")

View File

@ -201,6 +201,7 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error {
// @param Gpus formData string false "List of GPUs - json stringified array of {name, value} structs" // @param Gpus formData string false "List of GPUs - json stringified array of {name, value} structs"
// @success 200 {object} portainer.Endpoint "Success" // @success 200 {object} portainer.Endpoint "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Name is not unique"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /endpoints [post] // @router /endpoints [post]
func (handler *Handler) endpointCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -69,6 +69,7 @@ func (payload *endpointUpdatePayload) Validate(r *http.Request) error {
// @success 200 {object} portainer.Endpoint "Success" // @success 200 {object} portainer.Endpoint "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 404 "Environment(Endpoint) not found" // @failure 404 "Environment(Endpoint) not found"
// @failure 409 "Name is not unique"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /endpoints/{id} [put] // @router /endpoints/{id} [put]
func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -89,6 +89,7 @@ func (payload *registryCreatePayload) Validate(_ *http.Request) error {
// @param body body registryCreatePayload true "Registry details" // @param body body registryCreatePayload true "Registry details"
// @success 200 {object} portainer.Registry "Success" // @success 200 {object} portainer.Registry "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Another registry with the same name or same URL & credentials already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /registries [post] // @router /registries [post]
func (handler *Handler) registryCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) registryCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -52,7 +52,7 @@ func (payload *registryUpdatePayload) Validate(r *http.Request) error {
// @success 200 {object} portainer.Registry "Success" // @success 200 {object} portainer.Registry "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 404 "Registry not found" // @failure 404 "Registry not found"
// @failure 409 "Another registry with the same URL already exists" // @failure 409 "Another registry with the same name or same URL & credentials already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /registries/{id} [put] // @router /registries/{id} [put]
func (handler *Handler) registryUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) registryUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -63,7 +63,7 @@ func (payload *resourceControlCreatePayload) Validate(r *http.Request) error {
// @param body body resourceControlCreatePayload true "Resource control details" // @param body body resourceControlCreatePayload true "Resource control details"
// @success 200 {object} portainer.ResourceControl "Success" // @success 200 {object} portainer.ResourceControl "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Resource control already exists" // @failure 409 "A resource control is already associated to this resource"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /resource_controls [post] // @router /resource_controls [post]
func (handler *Handler) resourceControlCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) resourceControlCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -229,6 +229,7 @@ func (payload *composeStackFromGitRepositoryPayload) Validate(r *http.Request) e
// @param body body composeStackFromGitRepositoryPayload true "stack config" // @param body body composeStackFromGitRepositoryPayload true "stack config"
// @success 200 {object} portainer.Stack // @success 200 {object} portainer.Stack
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Stack name or webhook ID already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/create/standalone/repository [post] // @router /stacks/create/standalone/repository [post]
func (handler *Handler) createComposeStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError { func (handler *Handler) createComposeStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError {

View File

@ -195,6 +195,7 @@ func (handler *Handler) createKubernetesStackFromFileContent(w http.ResponseWrit
// @param endpointId query int true "Identifier of the environment that will be used to deploy the stack" // @param endpointId query int true "Identifier of the environment that will be used to deploy the stack"
// @success 200 {object} portainer.Stack // @success 200 {object} portainer.Stack
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Stack name or webhook ID already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/create/kubernetes/repository [post] // @router /stacks/create/kubernetes/repository [post]
func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError { func (handler *Handler) createKubernetesStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError {

View File

@ -188,6 +188,7 @@ func createStackPayloadFromSwarmGitPayload(name, swarmID, repoUrl, repoReference
// @param body body swarmStackFromGitRepositoryPayload true "stack config" // @param body body swarmStackFromGitRepositoryPayload true "stack config"
// @success 200 {object} portainer.Stack // @success 200 {object} portainer.Stack
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Stack name or webhook ID already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/create/swarm/repository [post] // @router /stacks/create/swarm/repository [post]
func (handler *Handler) createSwarmStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError { func (handler *Handler) createSwarmStackFromGitRepository(w http.ResponseWriter, r *http.Request, endpoint *portainer.Endpoint, userID portainer.UserID) *httperror.HandlerError {

View File

@ -46,6 +46,7 @@ func (payload *stackMigratePayload) Validate(r *http.Request) error {
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 403 "Permission denied" // @failure 403 "Permission denied"
// @failure 404 "Stack not found" // @failure 404 "Stack not found"
// @failure 409 "A stack with the same name is already running on the target environment(endpoint)"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/{id}/migrate [post] // @router /stacks/{id}/migrate [post]
func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -29,6 +29,7 @@ import (
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 403 "Permission denied" // @failure 403 "Permission denied"
// @failure 404 "Not found" // @failure 404 "Not found"
// @failure 409 "Stack name is not unique"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/{id}/start [post] // @router /stacks/{id}/start [post]
func (handler *Handler) stackStart(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) stackStart(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -19,7 +19,7 @@ import (
// @param webhookID path string true "Stack identifier" // @param webhookID path string true "Stack identifier"
// @success 200 "Success" // @success 200 "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Conflict" // @failure 409 "Autoupdate for the stack isn't available"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /stacks/webhooks/{webhookID} [post] // @router /stacks/webhooks/{webhookID} [post]
func (handler *Handler) webhookInvoke(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) webhookInvoke(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -35,7 +35,7 @@ func (payload *tagCreatePayload) Validate(r *http.Request) error {
// @produce json // @produce json
// @param body body tagCreatePayload true "Tag details" // @param body body tagCreatePayload true "Tag details"
// @success 200 {object} portainer.Tag "Success" // @success 200 {object} portainer.Tag "Success"
// @failure 409 "Tag name exists" // @failure 409 "This name is already associated to a tag"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /tags [post] // @router /tags [post]
func (handler *Handler) tagCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) tagCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -38,7 +38,7 @@ func (payload *teamCreatePayload) Validate(r *http.Request) error {
// @param body body teamCreatePayload true "details" // @param body body teamCreatePayload true "details"
// @success 200 {object} portainer.Team "Success" // @success 200 {object} portainer.Team "Success"
// @failure 400 "Invalid request" // @failure 400 "Invalid request"
// @failure 409 "Team already exists" // @failure 409 "A team with the same name already exists"
// @failure 500 "Server error" // @failure 500 "Server error"
// @router /teams [post] // @router /teams [post]
func (handler *Handler) teamCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) teamCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {

View File

@ -45,9 +45,9 @@ func (payload *webhookCreatePayload) Validate(r *http.Request) error {
// @produce json // @produce json
// @param body body webhookCreatePayload true "Webhook data" // @param body body webhookCreatePayload true "Webhook data"
// @success 200 {object} portainer.Webhook // @success 200 {object} portainer.Webhook
// @failure 400 // @failure 400 "Invalid request"
// @failure 409 // @failure 409 "A webhook for this resource already exists"
// @failure 500 // @failure 500 "Server error"
// @router /webhooks [post] // @router /webhooks [post]
func (handler *Handler) webhookCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { func (handler *Handler) webhookCreate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError {
var payload webhookCreatePayload var payload webhookCreatePayload