mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
Fix API data types, use unsecured router for /docs
- Note: Use /docs swagger playground without login - Otherwise: Session User will be used which leads to role mismatch
This commit is contained in:
parent
8e90c954ff
commit
922e94e835
@ -264,7 +264,7 @@ func main() {
|
||||
|
||||
if flagDev {
|
||||
r.Handle("/playground", playground.Handler("GraphQL playground", "/query"))
|
||||
secured.PathPrefix("/docs").Handler(httpSwagger.WrapHandler)
|
||||
r.PathPrefix("/docs").Handler(httpSwagger.WrapHandler)
|
||||
}
|
||||
secured.Handle("/query", graphQLEndpoint)
|
||||
|
||||
|
110
docs/docs.go
110
docs/docs.go
@ -1,6 +1,6 @@
|
||||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag at
|
||||
// 2022-09-15 11:56:55.737680755 +0200 CEST m=+0.135609460
|
||||
// 2022-09-15 17:26:29.784430553 +0200 CEST m=+0.128352955
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
@ -134,7 +134,7 @@ const docTemplate = `{
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/schema.Job"
|
||||
"$ref": "#/definitions/schema.JobMeta"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -405,11 +405,6 @@ const docTemplate = `{
|
||||
},
|
||||
"status": {
|
||||
"description": "Statustext of Errorcode",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Job": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -487,6 +482,107 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobMeta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arrayJobId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"cluster": {
|
||||
"type": "string"
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
},
|
||||
"exclusive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "never used in the job-archive, only available via REST-API",
|
||||
"type": "integer"
|
||||
},
|
||||
"jobId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"jobState": {
|
||||
"type": "string"
|
||||
},
|
||||
"metaData": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"monitoringStatus": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numAcc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numHwthreads": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numNodes": {
|
||||
"type": "integer"
|
||||
},
|
||||
"partition": {
|
||||
"type": "string"
|
||||
},
|
||||
"project": {
|
||||
"type": "string"
|
||||
},
|
||||
"resources": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Resource"
|
||||
}
|
||||
},
|
||||
"smt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"startTime": {
|
||||
"type": "integer"
|
||||
},
|
||||
"statistics": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/schema.JobStatistics"
|
||||
}
|
||||
},
|
||||
"subCluster": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Tag"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
},
|
||||
"walltime": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobStatistics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avg": {
|
||||
"type": "number"
|
||||
},
|
||||
"max": {
|
||||
"type": "number"
|
||||
},
|
||||
"min": {
|
||||
"type": "number"
|
||||
},
|
||||
"unit": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Resource": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -126,7 +126,7 @@
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/schema.Job"
|
||||
"$ref": "#/definitions/schema.JobMeta"
|
||||
}
|
||||
}
|
||||
],
|
||||
@ -397,11 +397,6 @@
|
||||
},
|
||||
"status": {
|
||||
"description": "Statustext of Errorcode",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Job": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -479,6 +474,107 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobMeta": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arrayJobId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"cluster": {
|
||||
"type": "string"
|
||||
},
|
||||
"duration": {
|
||||
"type": "integer"
|
||||
},
|
||||
"exclusive": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "never used in the job-archive, only available via REST-API",
|
||||
"type": "integer"
|
||||
},
|
||||
"jobId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"jobState": {
|
||||
"type": "string"
|
||||
},
|
||||
"metaData": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"monitoringStatus": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numAcc": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numHwthreads": {
|
||||
"type": "integer"
|
||||
},
|
||||
"numNodes": {
|
||||
"type": "integer"
|
||||
},
|
||||
"partition": {
|
||||
"type": "string"
|
||||
},
|
||||
"project": {
|
||||
"type": "string"
|
||||
},
|
||||
"resources": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Resource"
|
||||
}
|
||||
},
|
||||
"smt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"startTime": {
|
||||
"type": "integer"
|
||||
},
|
||||
"statistics": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/schema.JobStatistics"
|
||||
}
|
||||
},
|
||||
"subCluster": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/schema.Tag"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"type": "string"
|
||||
},
|
||||
"walltime": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.JobStatistics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"avg": {
|
||||
"type": "number"
|
||||
},
|
||||
"max": {
|
||||
"type": "number"
|
||||
},
|
||||
"min": {
|
||||
"type": "number"
|
||||
},
|
||||
"unit": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"schema.Resource": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -525,4 +621,4 @@
|
||||
"in": "header"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -101,6 +101,73 @@ definitions:
|
||||
walltime:
|
||||
type: integer
|
||||
type: object
|
||||
schema.JobMeta:
|
||||
properties:
|
||||
arrayJobId:
|
||||
type: integer
|
||||
cluster:
|
||||
type: string
|
||||
duration:
|
||||
type: integer
|
||||
exclusive:
|
||||
type: integer
|
||||
id:
|
||||
description: never used in the job-archive, only available via REST-API
|
||||
type: integer
|
||||
jobId:
|
||||
type: integer
|
||||
jobState:
|
||||
type: string
|
||||
metaData:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
monitoringStatus:
|
||||
type: integer
|
||||
numAcc:
|
||||
type: integer
|
||||
numHwthreads:
|
||||
type: integer
|
||||
numNodes:
|
||||
type: integer
|
||||
partition:
|
||||
type: string
|
||||
project:
|
||||
type: string
|
||||
resources:
|
||||
items:
|
||||
$ref: '#/definitions/schema.Resource'
|
||||
type: array
|
||||
smt:
|
||||
type: integer
|
||||
startTime:
|
||||
type: integer
|
||||
statistics:
|
||||
additionalProperties:
|
||||
$ref: '#/definitions/schema.JobStatistics'
|
||||
type: object
|
||||
subCluster:
|
||||
type: string
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/definitions/schema.Tag'
|
||||
type: array
|
||||
user:
|
||||
type: string
|
||||
walltime:
|
||||
type: integer
|
||||
type: object
|
||||
schema.JobStatistics:
|
||||
properties:
|
||||
avg:
|
||||
type: number
|
||||
max:
|
||||
type: number
|
||||
min:
|
||||
type: number
|
||||
unit:
|
||||
type: string
|
||||
type: object
|
||||
schema.Resource:
|
||||
properties:
|
||||
accelerators:
|
||||
@ -208,7 +275,7 @@ paths:
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/schema.Job'
|
||||
$ref: '#/definitions/schema.JobMeta'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -327,7 +327,7 @@ func (api *RestApi) tagJob(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Tags jobs
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body schema.Job true "Job to add"
|
||||
// @Param request body schema.JobMeta true "Job to add"
|
||||
// @Success 201 {object} api.StartJobApiResponse "Job added successfully"
|
||||
// @Failure 400 {object} api.ErrorResponse "Bad Request"
|
||||
// @Failure 422 {object} api.ErrorResponse "The combination of jobId, clusterId and startTime does already exist"
|
||||
@ -507,7 +507,7 @@ func (api *RestApi) stopJobById(rw http.ResponseWriter, r *http.Request) {
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body api.StopJobApiRequest true "All fields required"
|
||||
// @Success 201 {object} schema.Job "Job resource"
|
||||
// @Success 201 {object} schema.JobMeta "Job resource"
|
||||
// @Failure 400 {object} api.ErrorResponse "Bad Request"
|
||||
// @Failure 404 {object} api.ErrorResponse "Resource not found"
|
||||
// @Security ApiKeyAuth
|
||||
|
Loading…
Reference in New Issue
Block a user