Repository navigation
Core ‐ Agent create new core
Bohdan Karpenko edited this page Apr 2, 2026
·
2 revisions
This handler is responsible for creating new cores in the system. It validates input, hashes the client certificate, and inserts a record into the database.
This request allows adding a new core with a unique IP and client identifier.
{
"type": "request",
"action": "new-core",
"id": 1,
"data": {
"ip": "IP_ADDRESS",
"name": "CORE_NAME",
"client_cn": "CLIENT_COMMON_NAME"
}
}-
type: must be"request" -
action: must be"new-core" -
id: request identifier -
data:-
ip: string, required — IP address of the core -
name: string, required — human-readable core name -
client_cn: string, required — client certificate common name (used to generateclient_hash)
-
-
Validates that
dataexists and is correctly formatted -
Converts
client_cnto a hash usingget_hash() -
Inserts a new record into the
corestable with:ipnameclient_hash
-
Returns success or error depending on insertion result
{
"type": "response",
"id": 1,
"status": "ok",
"code": 200,
"message": "Created successfully!"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Missing data"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 400,
"message": "Invalid new-core request"
}{
"type": "response",
"id": 1,
"status": "error",
"code": 409,
"message": "Core with this IP and port already exists."
}{
"type": "response",
"id": 1,
"status": "error",
"code": 500,
"message": "Failed to create new core."
}Possible values for status:
-
"ok"— core successfully created -
"error"— creation failed
- IP addresses must be unique in the system (constraint
unique_ip_port) -
client_cnis hashed before storage for security - The
idfield in the response matches the requestid