Fix docs
Some checks are pending
Tests / test (push) Waiting to run

This commit is contained in:
Adam Štrauch 2025-01-14 09:17:03 +01:00
parent 48a7c17448
commit 3922222a12
Signed by: cx
GPG key ID: 7262DAFE292BCE20
4 changed files with 160 additions and 1 deletions

View file

@ -116,7 +116,8 @@ func (a *API) refreshHandler(c echo.Context) error {
// @Summary Prometheus service discovery
// @Description Return one nodes based on given hostname
// @Produce application/json
// @Success 200 {array} []prometheusDiscovery "Node details"
// @Param service path string true "Name of the service like: systemd, pgsql, .."
// @Success 200 {array} []nodes.prometheusDiscovery "Node details"
// @Failure 401 {object} Message "Forbidden access"
// @Security Bearer
// @Router /prometheus/{service} [get]

View file

@ -145,6 +145,49 @@ const docTemplate = `{
}
}
}
},
"/prometheus/{service}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "Return one nodes based on given hostname",
"produces": [
"application/json"
],
"summary": "Prometheus service discovery",
"parameters": [
{
"type": "string",
"description": "Name of the service like: systemd, pgsql, ..",
"name": "service",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Node details",
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/nodes.prometheusDiscovery"
}
}
}
},
"401": {
"description": "Forbidden access",
"schema": {
"$ref": "#/definitions/api.Message"
}
}
}
}
}
},
"definitions": {
@ -181,6 +224,23 @@ const docTemplate = `{
"type": "integer"
}
}
},
"nodes.prometheusDiscovery": {
"type": "object",
"properties": {
"Labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"Targets": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"securityDefinitions": {

View file

@ -137,6 +137,49 @@
}
}
}
},
"/prometheus/{service}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "Return one nodes based on given hostname",
"produces": [
"application/json"
],
"summary": "Prometheus service discovery",
"parameters": [
{
"type": "string",
"description": "Name of the service like: systemd, pgsql, ..",
"name": "service",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Node details",
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/nodes.prometheusDiscovery"
}
}
}
},
"401": {
"description": "Forbidden access",
"schema": {
"$ref": "#/definitions/api.Message"
}
}
}
}
}
},
"definitions": {
@ -173,6 +216,23 @@
"type": "integer"
}
}
},
"nodes.prometheusDiscovery": {
"type": "object",
"properties": {
"Labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"Targets": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"securityDefinitions": {

View file

@ -22,6 +22,17 @@ definitions:
last_update:
type: integer
type: object
nodes.prometheusDiscovery:
properties:
Labels:
additionalProperties:
type: string
type: object
Targets:
items:
type: string
type: array
type: object
info:
contact: {}
description: API of Lobby 2 project that helps to discover and connect to other
@ -111,6 +122,33 @@ paths:
security:
- Bearer: []
summary: Refresh node
/prometheus/{service}:
get:
description: Return one nodes based on given hostname
parameters:
- description: 'Name of the service like: systemd, pgsql, ..'
in: path
name: service
required: true
type: string
produces:
- application/json
responses:
"200":
description: Node details
schema:
items:
items:
$ref: '#/definitions/nodes.prometheusDiscovery'
type: array
type: array
"401":
description: Forbidden access
schema:
$ref: '#/definitions/api.Message'
security:
- Bearer: []
summary: Prometheus service discovery
securityDefinitions:
Bearer:
in: header