714 lines
23 KiB
Go
714 lines
23 KiB
Go
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
|
package docs
|
|
|
|
import "github.com/swaggo/swag"
|
|
|
|
const docTemplate = `{
|
|
"schemes": {{ marshal .Schemes }},
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "{{escape .Description}}",
|
|
"title": "{{.Title}}",
|
|
"contact": {},
|
|
"version": "{{.Version}}"
|
|
},
|
|
"host": "{{.Host}}",
|
|
"basePath": "{{.BasePath}}",
|
|
"paths": {
|
|
"/agents": {
|
|
"get": {
|
|
"description": "Returns a list of all agents currently connected via gRPC streaming",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"agents"
|
|
],
|
|
"summary": "Get connected agents",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/internal_handlers.AgentInfo"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/login": {
|
|
"post": {
|
|
"description": "Authenticate with login and password, returns a token and permissions",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Login",
|
|
"parameters": [
|
|
{
|
|
"description": "Login credentials",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginResponse"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/token": {
|
|
"post": {
|
|
"description": "Creates a new user with permissions",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Create user",
|
|
"parameters": [
|
|
{
|
|
"description": "User data",
|
|
"name": "request",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.TokenCreate"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"delete": {
|
|
"description": "Deletes the current authenticated user",
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Delete my account",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/tokens": {
|
|
"get": {
|
|
"description": "Returns list of all users with their permissions",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "List users",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/tokens/:login": {
|
|
"delete": {
|
|
"description": "Deletes a user by their login",
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Delete user",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Login of the user to delete",
|
|
"name": "login",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "Internal Server Error",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/auth/validate": {
|
|
"get": {
|
|
"description": "Check if the provided Bearer token is valid and return its permissions",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"auth"
|
|
],
|
|
"summary": "Validate token",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens"
|
|
}
|
|
},
|
|
"401": {
|
|
"description": "Unauthorized",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logs": {
|
|
"get": {
|
|
"description": "Searches logs with various filters",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Search logs",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Log level (INFO, WARNING, ERROR, FATAL)",
|
|
"name": "level",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Service name",
|
|
"name": "service",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Agent name",
|
|
"name": "agent",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date from (RFC3339)",
|
|
"name": "date_from",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Date to (RFC3339)",
|
|
"name": "date_to",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 100,
|
|
"description": "Limit results",
|
|
"name": "limit",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"default": 0,
|
|
"description": "Offset results",
|
|
"name": "offset",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_storage.LogEntry"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"description": "Inserts a single log entry into ClickHouse",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Insert log entry",
|
|
"parameters": [
|
|
{
|
|
"description": "Log entry",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/internal_handlers.InsertLogRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logs/agents": {
|
|
"get": {
|
|
"description": "Returns list of all unique agent names in logs",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Get distinct agents",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logs/batch": {
|
|
"post": {
|
|
"description": "Inserts multiple log entries into ClickHouse",
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Insert log entries (batch)",
|
|
"parameters": [
|
|
{
|
|
"description": "Log entries",
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/internal_handlers.InsertLogsRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "Created",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logs/levels": {
|
|
"get": {
|
|
"description": "Returns list of all unique log levels in logs",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Get distinct log levels",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/logs/services": {
|
|
"get": {
|
|
"description": "Returns list of all unique service names in logs",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"logs"
|
|
],
|
|
"summary": "Get distinct services",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"login",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"login": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"login": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"permission_admin": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_manage_agent": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_view": {
|
|
"type": "boolean"
|
|
},
|
|
"token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.TokenCreate": {
|
|
"type": "object",
|
|
"required": [
|
|
"last_name",
|
|
"login",
|
|
"name",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"login": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"permission_admin": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_manage_agent": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_view": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer"
|
|
},
|
|
"last_name": {
|
|
"type": "string"
|
|
},
|
|
"login": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"permission_admin": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_manage_agent": {
|
|
"type": "boolean"
|
|
},
|
|
"permission_view": {
|
|
"type": "boolean"
|
|
},
|
|
"token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_storage.LogEntry": {
|
|
"type": "object",
|
|
"properties": {
|
|
"agent": {
|
|
"type": "string"
|
|
},
|
|
"level": {
|
|
"type": "string"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"service": {
|
|
"type": "string"
|
|
},
|
|
"timestamp": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"internal_handlers.AgentInfo": {
|
|
"type": "object",
|
|
"properties": {
|
|
"label": {
|
|
"type": "string"
|
|
},
|
|
"services": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"token": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"internal_handlers.InsertLogRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"agent",
|
|
"level",
|
|
"message",
|
|
"service"
|
|
],
|
|
"properties": {
|
|
"agent": {
|
|
"type": "string"
|
|
},
|
|
"level": {
|
|
"type": "string"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"service": {
|
|
"type": "string"
|
|
},
|
|
"timestamp": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"internal_handlers.InsertLogsRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"logs"
|
|
],
|
|
"properties": {
|
|
"logs": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/internal_handlers.InsertLogRequest"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securityDefinitions": {
|
|
"Bearer": {
|
|
"description": "Type \"Bearer\" followed by a space and the JWT token.",
|
|
"type": "apiKey",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
}`
|
|
|
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
var SwaggerInfo = &swag.Spec{
|
|
Version: "",
|
|
Host: "",
|
|
BasePath: "",
|
|
Schemes: []string{},
|
|
Title: "",
|
|
Description: "",
|
|
InfoInstanceName: "swagger",
|
|
SwaggerTemplate: docTemplate,
|
|
LeftDelim: "{{",
|
|
RightDelim: "}}",
|
|
}
|
|
|
|
func init() {
|
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
}
|