mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 04:51:39 +02:00
Extend parsed swagger documentation by adding comments
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Package api GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
// This file was generated by swaggo/swag at
|
||||
// 2022-09-21 11:45:40.164979895 +0200 CEST m=+0.117799537
|
||||
package api
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
@@ -10,10 +11,10 @@ const docTemplate = `{
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"termsOfService": "TODO",
|
||||
"termsOfService": "https://monitoring.nhr.fau.de/imprint",
|
||||
"contact": {
|
||||
"name": "ClusterCockpit project",
|
||||
"url": "TODO",
|
||||
"name": "ClusterCockpit Project",
|
||||
"url": "https://github.com/ClusterCockpit",
|
||||
"email": "support@clustercockpit.org"
|
||||
},
|
||||
"license": {
|
||||
@@ -39,17 +40,14 @@ const docTemplate = `{
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "List all jobs",
|
||||
"summary": "Lists all jobs",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
"running",
|
||||
"completed",
|
||||
"failed",
|
||||
"canceled",
|
||||
"cancelled",
|
||||
"stopped",
|
||||
"timeout"
|
||||
],
|
||||
@@ -66,7 +64,7 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Syntax: \u003cfrom\u003e-\u003cto\u003e, where \u003cfrom\u003e and \u003cto\u003e are unix timestamps in seconds",
|
||||
"description": "Syntax: '$from-$to', as unix epoch timestamps in seconds",
|
||||
"name": "start-time",
|
||||
"in": "query"
|
||||
},
|
||||
@@ -115,17 +113,14 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "A new job started. The body should be in the ` + "`" + `meta.json` + "`" + ` format\nbut some fields required there are optional here (e.g. ` + "`" + `jobState` + "`" + ` defaults to \"running\").",
|
||||
"description": "Job specified in request body will be saved to database as \"running\" with new DB ID.\nJob specifications follow the 'JobMeta' scheme, API will fail to execute if requirements are not met.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Add a newly started job",
|
||||
"summary": "Adds a new job as \"running\"",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Job to add",
|
||||
@@ -166,17 +161,11 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Job to stop is specified by request body.\nAll fields are required in request body.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"description": "Job to stop is specified by request body. All fields are required in this case.\nReturns full job resource information according to 'JobMeta' scheme.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Mark job as stopped and trigger archiving",
|
||||
"summary": "Marks job as completed and triggers archiving",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "All fields required",
|
||||
@@ -217,17 +206,14 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Job to stop is specified by database ID.\nOnly stopTime and final state are required in request body.",
|
||||
"description": "Job to stop is specified by database ID. Only stopTime and final state are required in request body.\nReturns full job resource information according to 'JobMeta' scheme.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Mark job as stopped and trigger archiving",
|
||||
"summary": "Marks job as completed and triggers archiving",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
@@ -237,7 +223,7 @@ const docTemplate = `{
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Required fields: [stopTime, state]",
|
||||
"description": "stopTime and final state in request body",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
@@ -250,7 +236,7 @@ const docTemplate = `{
|
||||
"201": {
|
||||
"description": "Job resource",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/schema.Job"
|
||||
"$ref": "#/definitions/schema.JobMeta"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
@@ -275,17 +261,14 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Add one or more tags as array in request body to job specified by DB ID.",
|
||||
"description": "Adds tag(s) to a job specified by DB ID. Name and Type of Tag(s) can be chosen freely.\nIf tagged job is already finished: Tag will be written directly to respective archive files.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"jobs"
|
||||
],
|
||||
"summary": "Add one or more tags to a job",
|
||||
"summary": "Adds one or more tags to a job",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
@@ -300,7 +283,6 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"description": "Array of tag-objects for request payload",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/api.Tag"
|
||||
@@ -333,7 +315,7 @@ const docTemplate = `{
|
||||
},
|
||||
"definitions": {
|
||||
"api.ErrorResponse": {
|
||||
"description": "Error Response when using API.",
|
||||
"description": "Error message as returned from backend.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
@@ -357,236 +339,380 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"api.StopJobApiRequest": {
|
||||
"description": "Request to stop running job using stop time and state. Optional fields: JobId, ClusterId and StartTime. They are only used if no database id was provided.",
|
||||
"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",
|
||||
"stopTime"
|
||||
],
|
||||
"properties": {
|
||||
"cluster": {
|
||||
"description": "Cluster of job (Optional)",
|
||||
"type": "string"
|
||||
"description": "Cluster of job",
|
||||
"type": "string",
|
||||
"example": "fritz"
|
||||
},
|
||||
"jobId": {
|
||||
"description": "Job ID of job (Optional)",
|
||||
"type": "integer"
|
||||
"description": "Cluster Job ID of job",
|
||||
"type": "integer",
|
||||
"example": 123000
|
||||
},
|
||||
"jobState": {
|
||||
"description": "Final job state",
|
||||
"type": "string"
|
||||
"description": "Final state of job",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"completed",
|
||||
"failed",
|
||||
"cancelled",
|
||||
"stopped",
|
||||
"timeout"
|
||||
],
|
||||
"example": "completed"
|
||||
},
|
||||
"startTime": {
|
||||
"description": "Start Time of job (Optional)",
|
||||
"type": "integer"
|
||||
"description": "Start Time of job as epoch",
|
||||
"type": "integer",
|
||||
"example": 1649723812
|
||||
},
|
||||
"stopTime": {
|
||||
"description": "Stop Time as Epoch",
|
||||
"type": "integer"
|
||||
"description": "Stop Time of job as epoch",
|
||||
"type": "integer",
|
||||
"example": 1649763839
|
||||
}
|
||||
}
|
||||
},
|
||||
"api.Tag": {
|
||||
"description": "Defines a tag using name and type.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
"description": "Tag Name",
|
||||
"type": "string",
|
||||
"example": "Testjob"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"description": "Tag Type",
|
||||
"type": "string",
|
||||
"example": "Debug"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Job": {
|
||||
"description": "Meta data information of a HPC job.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arrayJobId": {
|
||||
"type": "integer"
|
||||
"description": "The unique identifier of an array job",
|
||||
"type": "integer",
|
||||
"example": 123000
|
||||
},
|
||||
"cluster": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a cluster",
|
||||
"type": "string",
|
||||
"example": "fritz"
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
"description": "Duration of job in seconds",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 43200
|
||||
},
|
||||
"exclusive": {
|
||||
"type": "integer"
|
||||
"description": "Specifies how nodes are shared. 0 - Shared among multiple jobs of multiple users, 1 - Job exclusive, 2 - Shared among multiple jobs of same user",
|
||||
"type": "integer",
|
||||
"maximum": 2,
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"id": {
|
||||
"description": "The unique identifier of a job in the database",
|
||||
"type": "integer"
|
||||
},
|
||||
"jobId": {
|
||||
"type": "integer"
|
||||
"description": "The unique identifier of a job",
|
||||
"type": "integer",
|
||||
"example": 123000
|
||||
},
|
||||
"jobState": {
|
||||
"type": "string"
|
||||
"description": "Final state of job",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"completed",
|
||||
"failed",
|
||||
"cancelled",
|
||||
"stopped",
|
||||
"timeout",
|
||||
"out_of_memory"
|
||||
],
|
||||
"example": "completed"
|
||||
},
|
||||
"metaData": {
|
||||
"description": "Additional information about the job",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"monitoringStatus": {
|
||||
"type": "integer"
|
||||
"description": "State of monitoring system during job run",
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"numAcc": {
|
||||
"type": "integer"
|
||||
"description": "Number of accelerators used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"numHwthreads": {
|
||||
"type": "integer"
|
||||
"description": "Number of HWThreads used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 20
|
||||
},
|
||||
"numNodes": {
|
||||
"type": "integer"
|
||||
"description": "Number of nodes used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"partition": {
|
||||
"type": "string"
|
||||
"description": "The Slurm partition to which the job was submitted",
|
||||
"type": "string",
|
||||
"example": "main"
|
||||
},
|
||||
"project": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a project",
|
||||
"type": "string",
|
||||
"example": "abcd200"
|
||||
},
|
||||
"resources": {
|
||||
"description": "Resources used by job",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Resource"
|
||||
}
|
||||
},
|
||||
"smt": {
|
||||
"type": "integer"
|
||||
"description": "SMT threads used by job",
|
||||
"type": "integer",
|
||||
"example": 4
|
||||
},
|
||||
"startTime": {
|
||||
"description": "Start time as 'time.Time' data type",
|
||||
"type": "string"
|
||||
},
|
||||
"subCluster": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a sub cluster",
|
||||
"type": "string",
|
||||
"example": "main"
|
||||
},
|
||||
"tags": {
|
||||
"description": "List of tags",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Tag"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a user",
|
||||
"type": "string",
|
||||
"example": "abcd100h"
|
||||
},
|
||||
"walltime": {
|
||||
"type": "integer"
|
||||
"description": "Requested walltime of job in seconds",
|
||||
"type": "integer",
|
||||
"example": 86400
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobMeta": {
|
||||
"description": "Meta data information of a HPC job.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arrayJobId": {
|
||||
"type": "integer"
|
||||
"description": "The unique identifier of an array job",
|
||||
"type": "integer",
|
||||
"example": 123000
|
||||
},
|
||||
"cluster": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a cluster",
|
||||
"type": "string",
|
||||
"example": "fritz"
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
"description": "Duration of job in seconds",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 43200
|
||||
},
|
||||
"exclusive": {
|
||||
"type": "integer"
|
||||
"description": "Specifies how nodes are shared. 0 - Shared among multiple jobs of multiple users, 1 - Job exclusive, 2 - Shared among multiple jobs of same user",
|
||||
"type": "integer",
|
||||
"maximum": 2,
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"id": {
|
||||
"description": "never used in the job-archive, only available via REST-API",
|
||||
"description": "The unique identifier of a job in the database",
|
||||
"type": "integer"
|
||||
},
|
||||
"jobId": {
|
||||
"type": "integer"
|
||||
"description": "The unique identifier of a job",
|
||||
"type": "integer",
|
||||
"example": 123000
|
||||
},
|
||||
"jobState": {
|
||||
"type": "string"
|
||||
"description": "Final state of job",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"completed",
|
||||
"failed",
|
||||
"cancelled",
|
||||
"stopped",
|
||||
"timeout",
|
||||
"out_of_memory"
|
||||
],
|
||||
"example": "completed"
|
||||
},
|
||||
"metaData": {
|
||||
"description": "Additional information about the job",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"monitoringStatus": {
|
||||
"type": "integer"
|
||||
"description": "State of monitoring system during job run",
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"numAcc": {
|
||||
"type": "integer"
|
||||
"description": "Number of accelerators used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"numHwthreads": {
|
||||
"type": "integer"
|
||||
"description": "Number of HWThreads used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 20
|
||||
},
|
||||
"numNodes": {
|
||||
"type": "integer"
|
||||
"description": "Number of nodes used",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 2
|
||||
},
|
||||
"partition": {
|
||||
"type": "string"
|
||||
"description": "The Slurm partition to which the job was submitted",
|
||||
"type": "string",
|
||||
"example": "main"
|
||||
},
|
||||
"project": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a project",
|
||||
"type": "string",
|
||||
"example": "abcd200"
|
||||
},
|
||||
"resources": {
|
||||
"description": "Resources used by job",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Resource"
|
||||
}
|
||||
},
|
||||
"smt": {
|
||||
"type": "integer"
|
||||
"description": "SMT threads used by job",
|
||||
"type": "integer",
|
||||
"example": 4
|
||||
},
|
||||
"startTime": {
|
||||
"type": "integer"
|
||||
"description": "Start epoch time stamp in seconds",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"example": 1649723812
|
||||
},
|
||||
"statistics": {
|
||||
"description": "Metric statistics of job",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/schema.JobStatistics"
|
||||
}
|
||||
},
|
||||
"subCluster": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a sub cluster",
|
||||
"type": "string",
|
||||
"example": "main"
|
||||
},
|
||||
"tags": {
|
||||
"description": "List of tags",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Tag"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
"description": "The unique identifier of a user",
|
||||
"type": "string",
|
||||
"example": "abcd100h"
|
||||
},
|
||||
"walltime": {
|
||||
"type": "integer"
|
||||
"description": "Requested walltime of job in seconds",
|
||||
"type": "integer",
|
||||
"example": 86400
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobStatistics": {
|
||||
"description": "Specification for job metric statistics.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avg": {
|
||||
"type": "number"
|
||||
"description": "Job metric average",
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"example": 2500
|
||||
},
|
||||
"max": {
|
||||
"type": "number"
|
||||
"description": "Job metric maximum",
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"example": 3000
|
||||
},
|
||||
"min": {
|
||||
"type": "number"
|
||||
"description": "Job metric minimum",
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"example": 2000
|
||||
},
|
||||
"unit": {
|
||||
"type": "string"
|
||||
"description": "Metric unit (see schema/unit.schema.json)",
|
||||
"type": "string",
|
||||
"example": "GHz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Resource": {
|
||||
"description": "A resource used by a job",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accelerators": {
|
||||
"description": "List of of accelerator device ids",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"configuration": {
|
||||
"description": "The configuration options of the node",
|
||||
"type": "string"
|
||||
},
|
||||
"hostname": {
|
||||
"description": "Name of the host (= node)",
|
||||
"type": "string"
|
||||
},
|
||||
"hwthreads": {
|
||||
"description": "List of OS processor ids",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
@@ -595,16 +721,22 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"schema.Tag": {
|
||||
"description": "Defines a tag using name and type.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "The unique DB identifier of a tag",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
"description": "Tag Name",
|
||||
"type": "string",
|
||||
"example": "Testjob"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
"description": "Tag Type",
|
||||
"type": "string",
|
||||
"example": "Debug"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -622,11 +754,11 @@ const docTemplate = `{
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "0.1.0",
|
||||
Host: "localhost:8080",
|
||||
Host: "clustercockpit.localhost:8082",
|
||||
BasePath: "/api",
|
||||
Schemes: []string{},
|
||||
Title: "ClusterCockpit REST API",
|
||||
Description: "Array of tag-objects for request payload",
|
||||
Description: "Defines a tag using name and type.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
}
|
||||
|
@@ -34,14 +34,18 @@ import (
|
||||
// @title ClusterCockpit REST API
|
||||
// @version 0.1.0
|
||||
// @description API for batch job control.
|
||||
// @termsOfService TODO
|
||||
// @contact.name ClusterCockpit project
|
||||
// @contact.url TODO
|
||||
// @termsOfService https://monitoring.nhr.fau.de/imprint
|
||||
|
||||
// @contact.name ClusterCockpit Project
|
||||
// @contact.url https://github.com/ClusterCockpit
|
||||
// @contact.email support@clustercockpit.org
|
||||
|
||||
// @license.name MIT License
|
||||
// @license.url https://opensource.org/licenses/MIT
|
||||
// @host localhost:8080
|
||||
|
||||
// @host clustercockpit.localhost:8082
|
||||
// @BasePath /api
|
||||
|
||||
// @securityDefinitions.apikey ApiKeyAuth
|
||||
// @in header
|
||||
// @name X-Auth-Token
|
||||
@@ -92,20 +96,19 @@ type StartJobApiResponse struct {
|
||||
}
|
||||
|
||||
// StopJobApiRequest model
|
||||
// @Description Request to stop running job using stop time and state.
|
||||
// @Description Optional fields: JobId, ClusterId and StartTime.
|
||||
// @Description They are only used if no database id was provided.
|
||||
// @Description Request to stop running job using stoptime and final state.
|
||||
// @Description They are only required if no database id was provided with endpoint.
|
||||
type StopJobApiRequest struct {
|
||||
// Stop Time as Epoch
|
||||
StopTime int64 `json:"stopTime"`
|
||||
State schema.JobState `json:"jobState"` // Final job state
|
||||
JobId *int64 `json:"jobId"` // Job ID of job (Optional)
|
||||
Cluster *string `json:"cluster"` // Cluster of job (Optional)
|
||||
StartTime *int64 `json:"startTime"` // Start Time of job (Optional)
|
||||
// Stop Time of job as epoch
|
||||
StopTime int64 `json:"stopTime" validate:"required" example:"1649763839"`
|
||||
State schema.JobState `json:"jobState" validate:"required" example:"completed" enums:"completed,failed,cancelled,stopped,timeout"` // Final job state
|
||||
JobId *int64 `json:"jobId" example:"123000"` // Cluster Job ID of job
|
||||
Cluster *string `json:"cluster" example:"fritz"` // Cluster of job
|
||||
StartTime *int64 `json:"startTime" example:"1649723812"` // Start Time of job as epoch
|
||||
}
|
||||
|
||||
// ErrorResponse model
|
||||
// @Description Error Response when using API.
|
||||
// @Description Error message as returned from backend.
|
||||
type ErrorResponse struct {
|
||||
// Statustext of Errorcode
|
||||
Status string `json:"status"`
|
||||
@@ -116,8 +119,8 @@ type ErrorResponse struct {
|
||||
// @Description Defines a tag using name and type.
|
||||
type Tag struct {
|
||||
// Tag Type
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"` // Tag Name
|
||||
Type string `json:"type" example:"Debug"`
|
||||
Name string `json:"name" example:"Testjob"` // Tag Name
|
||||
}
|
||||
|
||||
type TagJobApiRequest []*Tag
|
||||
@@ -139,14 +142,13 @@ func decode(r io.Reader, val interface{}) error {
|
||||
}
|
||||
|
||||
// getJobs godoc
|
||||
// @Summary List all jobs
|
||||
// @Summary Lists all jobs
|
||||
// @Description Get a list of all jobs. Filters can be applied using query parameters.
|
||||
// @Tags jobs
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param state query string false "Job State" Enums(running, completed, failed, canceled, stopped, timeout)
|
||||
// @Param state query string false "Job State" Enums(running, completed, failed, cancelled, stopped, timeout)
|
||||
// @Param cluster query string false "Job Cluster"
|
||||
// @Param start-time query string false "Syntax: <from>-<to>, where <from> and <to> are unix timestamps in seconds"
|
||||
// @Param start-time query string false "Syntax: '$from-$to', as unix epoch timestamps in seconds"
|
||||
// @Param page query int false "Page Number"
|
||||
// @Param items-per-page query int false "Items per page"
|
||||
// @Param with-metadata query bool false "Include metadata in response"
|
||||
@@ -264,9 +266,9 @@ func (api *RestApi) getJobs(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// tagJob godoc
|
||||
// @Summary Add one or more tags to a job
|
||||
// @Description Add one or more tags as array in request body to job specified by DB ID.
|
||||
// @Tags jobs
|
||||
// @Summary Adds one or more tags to a job
|
||||
// @Description Adds tag(s) to a job specified by DB ID. Name and Type of Tag(s) can be chosen freely.
|
||||
// @Description If tagged job is already finished: Tag will be written directly to respective archive files.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "Job Database ID"
|
||||
@@ -321,10 +323,9 @@ func (api *RestApi) tagJob(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// startJob godoc
|
||||
// @Summary Add a newly started job
|
||||
// @Description A new job started. The body should be in the `meta.json` format
|
||||
// @Description but some fields required there are optional here (e.g. `jobState` defaults to "running").
|
||||
// @Tags jobs
|
||||
// @Summary Adds a new job as "running"
|
||||
// @Description Job specified in request body will be saved to database as "running" with new DB ID.
|
||||
// @Description Job specifications follow the 'JobMeta' scheme, API will fail to execute if requirements are not met.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body schema.JobMeta true "Job to add"
|
||||
@@ -388,15 +389,14 @@ func (api *RestApi) startJob(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// stopJobById godoc
|
||||
// @Summary Mark job as stopped and trigger archiving
|
||||
// @Description Job to stop is specified by database ID.
|
||||
// @Description Only stopTime and final state are required in request body.
|
||||
// @Tags jobs
|
||||
// @Summary Marks job as completed and triggers archiving
|
||||
// @Description Job to stop is specified by database ID. Only stopTime and final state are required in request body.
|
||||
// @Description Returns full job resource information according to 'JobMeta' scheme.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int true "Database ID of Job"
|
||||
// @Param request body api.StopJobApiRequest true "Required fields: [stopTime, state]"
|
||||
// @Success 201 {object} schema.Job "Job resource"
|
||||
// @Param request body api.StopJobApiRequest true "stopTime and final state in request body"
|
||||
// @Success 201 {object} schema.JobMeta "Job resource"
|
||||
// @Failure 400 {object} api.ErrorResponse "Bad Request"
|
||||
// @Failure 404 {object} api.ErrorResponse "Resource not found"
|
||||
// @Security ApiKeyAuth
|
||||
@@ -500,11 +500,9 @@ func (api *RestApi) stopJobById(rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// stopJobByRequest godoc
|
||||
// @Summary Mark job as stopped and trigger archiving
|
||||
// @Description Job to stop is specified by request body.
|
||||
// @Description All fields are required in request body.
|
||||
// @Tags jobs
|
||||
// @Accept json
|
||||
// @Summary Marks job as completed and triggers archiving
|
||||
// @Description Job to stop is specified by request body. All fields are required in this case.
|
||||
// @Description Returns full job resource information according to 'JobMeta' scheme.
|
||||
// @Produce json
|
||||
// @Param request body api.StopJobApiRequest true "All fields required"
|
||||
// @Success 201 {object} schema.JobMeta "Job resource"
|
||||
|
Reference in New Issue
Block a user