Add '401 unauthorized' to api docs

This commit is contained in:
Christoph Kluge 2022-09-21 17:13:55 +02:00
parent 872bc77708
commit 93713edcac
4 changed files with 86 additions and 1 deletions

View File

@ -95,6 +95,12 @@
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
@ -143,6 +149,12 @@
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -200,6 +212,12 @@
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -273,6 +291,12 @@
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -349,6 +373,12 @@
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": { "404": {
"description": "Job or tag does not exist", "description": "Job or tag does not exist",
"schema": { "schema": {

View File

@ -408,6 +408,10 @@ paths:
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/api.ErrorResponse' $ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
@ -440,6 +444,10 @@ paths:
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/api.ErrorResponse' $ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403": "403":
description: Forbidden description: Forbidden
schema: schema:
@ -479,6 +487,10 @@ paths:
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/api.ErrorResponse' $ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403": "403":
description: Forbidden description: Forbidden
schema: schema:
@ -529,6 +541,10 @@ paths:
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/api.ErrorResponse' $ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"403": "403":
description: Forbidden description: Forbidden
schema: schema:
@ -581,6 +597,10 @@ paths:
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/api.ErrorResponse' $ref: '#/definitions/api.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorResponse'
"404": "404":
description: Job or tag does not exist description: Job or tag does not exist
schema: schema:

View File

@ -1,6 +1,6 @@
// Package api GENERATED BY SWAG; DO NOT EDIT // Package api GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2022-09-21 16:59:20.417950914 +0200 CEST m=+0.112710428 // 2022-09-21 17:13:02.799543712 +0200 CEST m=+0.123569150
package api package api
import "github.com/swaggo/swag" import "github.com/swaggo/swag"
@ -103,6 +103,12 @@ const docTemplate = `{
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
@ -151,6 +157,12 @@ const docTemplate = `{
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -208,6 +220,12 @@ const docTemplate = `{
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -281,6 +299,12 @@ const docTemplate = `{
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": { "403": {
"description": "Forbidden", "description": "Forbidden",
"schema": { "schema": {
@ -357,6 +381,12 @@ const docTemplate = `{
"$ref": "#/definitions/api.ErrorResponse" "$ref": "#/definitions/api.ErrorResponse"
} }
}, },
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": { "404": {
"description": "Job or tag does not exist", "description": "Job or tag does not exist",
"schema": { "schema": {

View File

@ -154,6 +154,7 @@ func decode(r io.Reader, val interface{}) error {
// @Param with-metadata query bool false "Include metadata in response" // @Param with-metadata query bool false "Include metadata in response"
// @Success 200 {array} schema.Job "Array of jobs" // @Success 200 {array} schema.Job "Array of jobs"
// @Failure 400 {object} api.ErrorResponse "Bad Request" // @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 500 {object} api.ErrorResponse "Internal Server Error" // @Failure 500 {object} api.ErrorResponse "Internal Server Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /jobs/ [get] // @Router /jobs/ [get]
@ -276,6 +277,7 @@ func (api *RestApi) getJobs(rw http.ResponseWriter, r *http.Request) {
// @Param request body api.TagJobApiRequest true "Array of tag-objects to add" // @Param request body api.TagJobApiRequest true "Array of tag-objects to add"
// @Success 200 {object} schema.Job "Job resource" // @Success 200 {object} schema.Job "Job resource"
// @Failure 400 {object} api.ErrorResponse "Bad Request" // @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 404 {object} api.ErrorResponse "Job or tag does not exist" // @Failure 404 {object} api.ErrorResponse "Job or tag does not exist"
// @Failure 500 {object} api.ErrorResponse "Internal Server Error" // @Failure 500 {object} api.ErrorResponse "Internal Server Error"
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -333,6 +335,7 @@ func (api *RestApi) tagJob(rw http.ResponseWriter, r *http.Request) {
// @Param request body schema.JobMeta true "Job to add" // @Param request body schema.JobMeta true "Job to add"
// @Success 201 {object} api.StartJobApiResponse "Job added successfully" // @Success 201 {object} api.StartJobApiResponse "Job added successfully"
// @Failure 400 {object} api.ErrorResponse "Bad Request" // @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 403 {object} api.ErrorResponse "Forbidden" // @Failure 403 {object} api.ErrorResponse "Forbidden"
// @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: The combination of jobId, clusterId and startTime does already exist" // @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: The combination of jobId, clusterId and startTime does already exist"
// @Failure 500 {object} api.ErrorResponse "Internal Server Error" // @Failure 500 {object} api.ErrorResponse "Internal Server Error"
@ -402,6 +405,7 @@ func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
// @Param request body api.StopJobApiRequest true "stopTime and final state in request body" // @Param request body api.StopJobApiRequest true "stopTime and final state in request body"
// @Success 200 {object} schema.JobMeta "Job resource" // @Success 200 {object} schema.JobMeta "Job resource"
// @Failure 400 {object} api.ErrorResponse "Bad Request" // @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 403 {object} api.ErrorResponse "Forbidden" // @Failure 403 {object} api.ErrorResponse "Forbidden"
// @Failure 404 {object} api.ErrorResponse "Resource not found" // @Failure 404 {object} api.ErrorResponse "Resource not found"
// @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: finding job failed: sql: no rows in result set" // @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: finding job failed: sql: no rows in result set"
@ -514,6 +518,7 @@ func (api *RestApi) stopJobById(rw http.ResponseWriter, r *http.Request) {
// @Param request body api.StopJobApiRequest true "All fields required" // @Param request body api.StopJobApiRequest true "All fields required"
// @Success 200 {object} schema.JobMeta "Job resource" // @Success 200 {object} schema.JobMeta "Job resource"
// @Failure 400 {object} api.ErrorResponse "Bad Request" // @Failure 400 {object} api.ErrorResponse "Bad Request"
// @Failure 401 {object} api.ErrorResponse "Unauthorized"
// @Failure 403 {object} api.ErrorResponse "Forbidden" // @Failure 403 {object} api.ErrorResponse "Forbidden"
// @Failure 404 {object} api.ErrorResponse "Resource not found" // @Failure 404 {object} api.ErrorResponse "Resource not found"
// @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: finding job failed: sql: no rows in result set" // @Failure 422 {object} api.ErrorResponse "Unprocessable Entity: finding job failed: sql: no rows in result set"