lobby2/docs/swagger.json

185 lines
5.8 KiB
JSON
Raw Normal View History

2024-12-08 01:30:07 +00:00
{
"swagger": "2.0",
"info": {
"description": "API of Lobby 2 project that helps to discover and connect to other nodes and their services.",
"title": "Lobby2 API",
"contact": {},
"version": "2.0"
},
"basePath": "/",
"paths": {
"/nodes": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "List of all discovered nodes and their labels.",
"produces": [
"application/json"
],
"summary": "List of nodes",
"responses": {
"200": {
"description": "List of nodes",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/nodes.Node"
}
}
},
"401": {
"description": "Forbidden access",
"schema": {
"$ref": "#/definitions/api.Message"
}
}
}
}
},
"/nodes/{hostname}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "Return one nodes based on given hostname",
"produces": [
"application/json"
],
"summary": "Get node",
"parameters": [
{
"type": "string",
"description": "Node hostname",
"name": "hostname",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Node details",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/nodes.Node"
}
}
},
"401": {
"description": "Forbidden access",
"schema": {
"$ref": "#/definitions/api.Message"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"description": "Send new data or update existing data about a node",
"produces": [
"application/json"
],
"summary": "Refresh node",
"parameters": [
{
"type": "string",
"description": "Node hostname",
"name": "hostname",
"in": "path",
"required": true
},
{
"description": "Node labels",
"name": "labels",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"description": "Key-value",
"name": "kv",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/nodes.KV"
}
}
],
"responses": {
"200": {
"description": "Node details",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/nodes.Node"
}
}
},
"401": {
"description": "Forbidden access",
"schema": {
"$ref": "#/definitions/api.Message"
}
}
}
}
}
},
"definitions": {
"api.Message": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"nodes.KV": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"nodes.Node": {
"type": "object",
"properties": {
"hostname": {
"type": "string"
},
"kv": {
"$ref": "#/definitions/nodes.KV"
},
"labels": {
"type": "array",
"items": {
"type": "string"
}
},
"last_update": {
"type": "integer"
}
}
}
},
"securityDefinitions": {
"Bearer": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}