Review Sagger config. Delete Job endpoints

This commit is contained in:
Jan Eitzinger
2022-11-11 15:26:27 +01:00
parent c4072ff4c7
commit 948da8f10b
6 changed files with 1096 additions and 221 deletions

View File

@@ -1,6 +1,5 @@
// Package api GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2022-09-22 13:31:53.353204065 +0200 CEST m=+0.139444562
// This file was generated by swaggo/swag
package api
import "github.com/swaggo/swag"
@@ -11,7 +10,6 @@ const docTemplate = `{
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "https://monitoring.nhr.fau.de/imprint",
"contact": {
"name": "ClusterCockpit Project",
"url": "https://github.com/ClusterCockpit",
@@ -34,12 +32,12 @@ const docTemplate = `{
}
],
"description": "Get a list of all jobs. Filters can be applied using query parameters.\nNumber of results can be limited by page. Results are sorted by descending startTime.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"query"
],
"summary": "Lists all jobs",
"parameters": [
{
@@ -70,13 +68,13 @@ const docTemplate = `{
},
{
"type": "integer",
"description": "Items per page (If empty: No Limit)",
"description": "Items per page (Default: 25)",
"name": "items-per-page",
"in": "query"
},
{
"type": "integer",
"description": "Page Number (If empty: No Paging)",
"description": "Page Number (Default: 1)",
"name": "page",
"in": "query"
},
@@ -118,6 +116,221 @@ const docTemplate = `{
}
}
},
"/jobs/delete_job/": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Job to delete is specified by request body. All fields are required in this case.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"description": "All fields required",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.DeleteJobApiRequest"
}
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/delete_job/{id}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Job to remove is specified by database ID. This will not remove the job from the job archive.",
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"type": "integer",
"description": "Database ID of Job",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/delete_job_before/{ts}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Job to stop is specified by database ID. This will not remove the job from the job archive.",
"produces": [
"application/json"
],
"tags": [
"remove"
],
"summary": "Remove a job from the sql database",
"parameters": [
{
"type": "integer",
"description": "Unix epoch timestamp",
"name": "ts",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Success message",
"schema": {
"$ref": "#/definitions/api.DeleteJobApiResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"404": {
"description": "Resource not found",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"422": {
"description": "Unprocessable Entity: finding job failed: sql: no rows in result set",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.ErrorResponse"
}
}
}
}
},
"/jobs/start_job/": {
"post": {
"security": [
@@ -132,6 +345,9 @@ const docTemplate = `{
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Adds a new job as \"running\"",
"parameters": [
{
@@ -195,6 +411,9 @@ const docTemplate = `{
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Marks job as completed and triggers archiving",
"parameters": [
{
@@ -209,7 +428,7 @@ const docTemplate = `{
],
"responses": {
"200": {
"description": "Job resource",
"description": "Success message",
"schema": {
"$ref": "#/definitions/schema.JobMeta"
}
@@ -267,6 +486,9 @@ const docTemplate = `{
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Marks job as completed and triggers archiving",
"parameters": [
{
@@ -346,6 +568,9 @@ const docTemplate = `{
"produces": [
"application/json"
],
"tags": [
"add and modify"
],
"summary": "Adds one or more tags to a job",
"parameters": [
{
@@ -363,7 +588,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Tag"
"$ref": "#/definitions/api.ApiTag"
}
}
}
@@ -404,8 +629,53 @@ const docTemplate = `{
}
},
"definitions": {
"api.ApiTag": {
"type": "object",
"properties": {
"name": {
"description": "Tag Name",
"type": "string",
"example": "Testjob"
},
"type": {
"description": "Tag Type",
"type": "string",
"example": "Debug"
}
}
},
"api.DeleteJobApiRequest": {
"type": "object",
"required": [
"jobId"
],
"properties": {
"cluster": {
"description": "Cluster of job",
"type": "string",
"example": "fritz"
},
"jobId": {
"description": "Cluster Job ID of job",
"type": "integer",
"example": 123000
},
"startTime": {
"description": "Start Time of job as epoch",
"type": "integer",
"example": 1649723812
}
}
},
"api.DeleteJobApiResponse": {
"type": "object",
"properties": {
"msg": {
"type": "string"
}
}
},
"api.ErrorResponse": {
"description": "Error message as returned from backend.",
"type": "object",
"properties": {
"error": {
@@ -419,7 +689,6 @@ const docTemplate = `{
}
},
"api.StartJobApiResponse": {
"description": "Successful job start response with database id of new job.",
"type": "object",
"properties": {
"id": {
@@ -429,7 +698,6 @@ const docTemplate = `{
}
},
"api.StopJobApiRequest": {
"description": "Request to stop running job using stoptime and final state. They are only required if no database id was provided with endpoint.",
"type": "object",
"required": [
"jobState",
@@ -470,22 +738,6 @@ const docTemplate = `{
}
}
},
"api.Tag": {
"description": "Defines a tag using name and type.",
"type": "object",
"properties": {
"name": {
"description": "Tag Name",
"type": "string",
"example": "Testjob"
},
"type": {
"description": "Tag Type",
"type": "string",
"example": "Debug"
}
}
},
"schema.Job": {
"description": "Information of a HPC job.",
"type": "object",
@@ -817,7 +1069,7 @@ const docTemplate = `{
}
},
"schema.Tag": {
"description": "Defines a tag using name and type.",
"description": "Defines B tag using name and type.",
"type": "object",
"properties": {
"id": {
@@ -839,22 +1091,26 @@ const docTemplate = `{
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "JWT based authentification for general API endpoint use.",
"type": "apiKey",
"name": "X-Auth-Token",
"in": "header"
}
}
},
"tags": [
{
"name": "Job API"
}
]
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "0.1.0",
Host: "clustercockpit.localhost:8082",
Version: "0.2.0",
Host: "localhost:8080",
BasePath: "/api",
Schemes: []string{},
Title: "ClusterCockpit REST API",
Description: "Defines a tag using name and type.",
Description: "API for batch job control.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}