chore: add ansible deploy simple logic, upgrade admin auth logic and docs
ci-agent / build (push) Failing after 1m55s
ci-agent / build (push) Failing after 1m55s
This commit is contained in:
+547
-73
@@ -1,5 +1,155 @@
|
||||
definitions:
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginRequest:
|
||||
handlers.AgentInfo:
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
services:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
token:
|
||||
type: string
|
||||
type: object
|
||||
handlers.InsertLogRequest:
|
||||
properties:
|
||||
agent:
|
||||
type: string
|
||||
level:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
service:
|
||||
type: string
|
||||
timestamp:
|
||||
type: string
|
||||
required:
|
||||
- agent
|
||||
- level
|
||||
- message
|
||||
- service
|
||||
type: object
|
||||
handlers.InsertLogsRequest:
|
||||
properties:
|
||||
logs:
|
||||
items:
|
||||
$ref: '#/definitions/handlers.InsertLogRequest'
|
||||
type: array
|
||||
required:
|
||||
- logs
|
||||
type: object
|
||||
handlers.RegisterRequest:
|
||||
properties:
|
||||
csr:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
required:
|
||||
- csr
|
||||
- token
|
||||
type: object
|
||||
handlers.RegisterResponse:
|
||||
properties:
|
||||
ca_cert:
|
||||
type: string
|
||||
client_cert:
|
||||
type: string
|
||||
type: object
|
||||
repository.AgentDeployConfig:
|
||||
description: Configuration for deploying HellreigN agent to a single server
|
||||
properties:
|
||||
agentLabel:
|
||||
example: production-server-1
|
||||
type: string
|
||||
authMethod:
|
||||
allOf:
|
||||
- $ref: '#/definitions/repository.AuthMethod'
|
||||
example: key
|
||||
deployType:
|
||||
allOf:
|
||||
- $ref: '#/definitions/repository.DeployType'
|
||||
example: docker
|
||||
ip:
|
||||
example: 192.168.1.100
|
||||
type: string
|
||||
password:
|
||||
example: secret
|
||||
type: string
|
||||
port:
|
||||
example: 22
|
||||
type: integer
|
||||
sshKey:
|
||||
example: '-----BEGIN OPENSSH PRIVATE KEY-----'
|
||||
type: string
|
||||
user:
|
||||
example: admin
|
||||
type: string
|
||||
required:
|
||||
- agentLabel
|
||||
- authMethod
|
||||
- deployType
|
||||
- ip
|
||||
- user
|
||||
type: object
|
||||
repository.AuthMethod:
|
||||
description: 'SSH authentication method: key or password'
|
||||
enum:
|
||||
- key
|
||||
- password
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- AuthMethodKey
|
||||
- AuthMethodPassword
|
||||
repository.DeployAgentsRequest:
|
||||
description: Request to deploy HellreigN agents to multiple servers
|
||||
properties:
|
||||
servers:
|
||||
items:
|
||||
$ref: '#/definitions/repository.AgentDeployConfig'
|
||||
minItems: 1
|
||||
type: array
|
||||
required:
|
||||
- servers
|
||||
type: object
|
||||
repository.DeployResponse:
|
||||
description: Response containing deployment results and registration tokens
|
||||
properties:
|
||||
message:
|
||||
example: Deployment completed
|
||||
type: string
|
||||
results:
|
||||
items:
|
||||
$ref: '#/definitions/repository.DeployResult'
|
||||
type: array
|
||||
type: object
|
||||
repository.DeployResult:
|
||||
description: Result of deploying to a single server
|
||||
properties:
|
||||
agent_label:
|
||||
example: production-server-1
|
||||
type: string
|
||||
error:
|
||||
example: ""
|
||||
type: string
|
||||
ip:
|
||||
example: 192.168.1.100
|
||||
type: string
|
||||
success:
|
||||
example: true
|
||||
type: boolean
|
||||
token:
|
||||
example: abc123...
|
||||
type: string
|
||||
type: object
|
||||
repository.DeployType:
|
||||
description: 'Type of deployment: docker or binary'
|
||||
enum:
|
||||
- docker
|
||||
- binary
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DeployTypeDocker
|
||||
- DeployTypeBinary
|
||||
repository.LoginRequest:
|
||||
properties:
|
||||
login:
|
||||
type: string
|
||||
@@ -9,8 +159,10 @@ definitions:
|
||||
- login
|
||||
- password
|
||||
type: object
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginResponse:
|
||||
repository.LoginResponse:
|
||||
properties:
|
||||
is_active:
|
||||
type: boolean
|
||||
last_name:
|
||||
type: string
|
||||
login:
|
||||
@@ -26,15 +178,17 @@ definitions:
|
||||
token:
|
||||
type: string
|
||||
type: object
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.RegistrationRequest:
|
||||
repository.RegistrationRequest:
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
required:
|
||||
- label
|
||||
type: object
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.TokenCreate:
|
||||
repository.TokenCreate:
|
||||
properties:
|
||||
is_active:
|
||||
type: boolean
|
||||
last_name:
|
||||
type: string
|
||||
login:
|
||||
@@ -55,10 +209,37 @@ definitions:
|
||||
- name
|
||||
- password
|
||||
type: object
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens:
|
||||
repository.TokenPasswordReset:
|
||||
properties:
|
||||
new_password:
|
||||
type: string
|
||||
required:
|
||||
- new_password
|
||||
type: object
|
||||
repository.TokenUpdate:
|
||||
properties:
|
||||
last_name:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
repository.TokenUpdatePermissions:
|
||||
properties:
|
||||
is_active:
|
||||
type: boolean
|
||||
permission_admin:
|
||||
type: boolean
|
||||
permission_manage_agent:
|
||||
type: boolean
|
||||
permission_view:
|
||||
type: boolean
|
||||
type: object
|
||||
repository.Tokens:
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
is_active:
|
||||
type: boolean
|
||||
last_name:
|
||||
type: string
|
||||
login:
|
||||
@@ -74,7 +255,7 @@ definitions:
|
||||
token:
|
||||
type: string
|
||||
type: object
|
||||
gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_storage.LogEntry:
|
||||
storage.LogEntry:
|
||||
properties:
|
||||
agent:
|
||||
type: string
|
||||
@@ -87,61 +268,6 @@ definitions:
|
||||
timestamp:
|
||||
type: string
|
||||
type: object
|
||||
internal_handlers.AgentInfo:
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
services:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
token:
|
||||
type: string
|
||||
type: object
|
||||
internal_handlers.InsertLogRequest:
|
||||
properties:
|
||||
agent:
|
||||
type: string
|
||||
level:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
service:
|
||||
type: string
|
||||
timestamp:
|
||||
type: string
|
||||
required:
|
||||
- agent
|
||||
- level
|
||||
- message
|
||||
- service
|
||||
type: object
|
||||
internal_handlers.InsertLogsRequest:
|
||||
properties:
|
||||
logs:
|
||||
items:
|
||||
$ref: '#/definitions/internal_handlers.InsertLogRequest'
|
||||
type: array
|
||||
required:
|
||||
- logs
|
||||
type: object
|
||||
internal_handlers.RegisterRequest:
|
||||
properties:
|
||||
csr:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
required:
|
||||
- csr
|
||||
- token
|
||||
type: object
|
||||
internal_handlers.RegisterResponse:
|
||||
properties:
|
||||
ca_cert:
|
||||
type: string
|
||||
client_cert:
|
||||
type: string
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
@@ -155,11 +281,48 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/internal_handlers.AgentInfo'
|
||||
$ref: '#/definitions/handlers.AgentInfo'
|
||||
type: array
|
||||
summary: Get connected agents
|
||||
tags:
|
||||
- agents
|
||||
/agents/deploy:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Deploy HellreigN agents to multiple servers using Ansible playbooks.
|
||||
Supports Docker and Binary deployment types.
|
||||
parameters:
|
||||
- description: Deployment configuration for servers
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/repository.DeployAgentsRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Deployment results with tokens for each server
|
||||
schema:
|
||||
$ref: '#/definitions/repository.DeployResponse'
|
||||
"400":
|
||||
description: Invalid request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Deploy agents to multiple servers via Ansible
|
||||
tags:
|
||||
- agents
|
||||
/agents/register:
|
||||
post:
|
||||
consumes:
|
||||
@@ -170,14 +333,14 @@ paths:
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.RegisterRequest'
|
||||
$ref: '#/definitions/handlers.RegisterRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.RegisterResponse'
|
||||
$ref: '#/definitions/handlers.RegisterResponse'
|
||||
summary: Register agent
|
||||
tags:
|
||||
- agents
|
||||
@@ -191,7 +354,7 @@ paths:
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.RegistrationRequest'
|
||||
$ref: '#/definitions/repository.RegistrationRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -217,12 +380,12 @@ paths:
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginRequest'
|
||||
$ref: '#/definitions/repository.LoginRequest'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.LoginResponse'
|
||||
$ref: '#/definitions/repository.LoginResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
@@ -235,6 +398,12 @@ paths:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"403":
|
||||
description: Forbidden
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Login
|
||||
tags:
|
||||
- auth
|
||||
@@ -273,7 +442,7 @@ paths:
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.TokenCreate'
|
||||
$ref: '#/definitions/repository.TokenCreate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -312,7 +481,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens'
|
||||
$ref: '#/definitions/repository.Tokens'
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
@@ -354,6 +523,272 @@ paths:
|
||||
summary: Delete user
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/:login:
|
||||
get:
|
||||
description: Returns a user by their login (admin only)
|
||||
parameters:
|
||||
- description: Login of the user
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/repository.Tokens'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Get user by login
|
||||
tags:
|
||||
- auth
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates a user's name and last name (admin only)
|
||||
parameters:
|
||||
- description: Login of the user
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
- description: User data to update
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/repository.TokenUpdate'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Update user
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/:login/activate:
|
||||
post:
|
||||
description: Activates a user account by login (admin only)
|
||||
parameters:
|
||||
- description: Login of the user to activate
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Activate user
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/:login/deactivate:
|
||||
post:
|
||||
description: Deactivates a user account by login (admin only)
|
||||
parameters:
|
||||
- description: Login of the user to deactivate
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Deactivate user
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/:login/password:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Resets a user's password to a new value (admin only)
|
||||
parameters:
|
||||
- description: Login of the user
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
- description: New password
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/repository.TokenPasswordReset'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Reset user password
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/:login/permissions:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates a user's permissions and activation status (admin only)
|
||||
parameters:
|
||||
- description: Login of the user
|
||||
in: path
|
||||
name: login
|
||||
required: true
|
||||
type: string
|
||||
- description: Permissions to update
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/repository.TokenUpdatePermissions'
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Update user permissions
|
||||
tags:
|
||||
- auth
|
||||
/auth/users/inactive:
|
||||
get:
|
||||
description: Returns list of all users waiting for activation
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/repository.Tokens'
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: List inactive users
|
||||
tags:
|
||||
- auth
|
||||
/auth/validate:
|
||||
get:
|
||||
description: Check if the provided Bearer token is valid and return its permissions
|
||||
@@ -363,7 +798,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_repository.Tokens'
|
||||
$ref: '#/definitions/repository.Tokens'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
@@ -414,7 +849,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/gitea_d3m0k1d_ru_d3m0k1d_HellreigN_backend_internal_storage.LogEntry'
|
||||
$ref: '#/definitions/storage.LogEntry'
|
||||
type: array
|
||||
summary: Search logs
|
||||
tags:
|
||||
@@ -429,7 +864,7 @@ paths:
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.InsertLogRequest'
|
||||
$ref: '#/definitions/handlers.InsertLogRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -468,7 +903,7 @@ paths:
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handlers.InsertLogsRequest'
|
||||
$ref: '#/definitions/handlers.InsertLogsRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -496,6 +931,45 @@ paths:
|
||||
summary: Get distinct log levels
|
||||
tags:
|
||||
- logs
|
||||
/logs/mock:
|
||||
get:
|
||||
description: Returns 100 mock log entries for frontend development (no ClickHouse
|
||||
required)
|
||||
parameters:
|
||||
- description: Filter by level
|
||||
in: query
|
||||
name: level
|
||||
type: string
|
||||
- description: Filter by service
|
||||
in: query
|
||||
name: service
|
||||
type: string
|
||||
- description: Filter by agent
|
||||
in: query
|
||||
name: agent
|
||||
type: string
|
||||
- default: 100
|
||||
description: Limit results
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
- default: 0
|
||||
description: Offset results
|
||||
in: query
|
||||
name: offset
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/storage.LogEntry'
|
||||
type: array
|
||||
summary: Get mock logs
|
||||
tags:
|
||||
- logs
|
||||
/logs/services:
|
||||
get:
|
||||
description: Returns list of all unique service names in logs
|
||||
|
||||
Reference in New Issue
Block a user