Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit 2435660

Browse files
committed
updated openrpc spec + added rpc methods to create/get/delete service yaml files
1 parent 620d8e6 commit 2435660

File tree

3 files changed

+405
-57
lines changed

3 files changed

+405
-57
lines changed

openrpc.json

Lines changed: 167 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,34 @@
1515
}
1616
],
1717
"methods": [
18+
{
19+
"name": "rpc.discover",
20+
"description": "Returns the OpenRPC specification for the API",
21+
"params": [],
22+
"result": {
23+
"name": "OpenRPCSpec",
24+
"description": "The OpenRPC specification",
25+
"schema": {
26+
"type": "object"
27+
}
28+
},
29+
"examples": [
30+
{
31+
"name": "Get API specification",
32+
"params": [],
33+
"result": {
34+
"name": "OpenRPCSpecResult",
35+
"value": {
36+
"openrpc": "1.2.6",
37+
"info": {
38+
"version": "1.0.0",
39+
"title": "Zinit JSON-RPC API"
40+
}
41+
}
42+
}
43+
}
44+
]
45+
},
1846
{
1947
"name": "service.list",
2048
"description": "Lists all services managed by Zinit",
@@ -432,67 +460,150 @@
432460
"data": "system is already shutting down"
433461
}
434462
]
435-
}
436-
],
437-
"components": {
438-
"contentDescriptors": {},
439-
"schemas": {}
440-
},
441-
"errors": [
442-
{
443-
"code": -32600,
444-
"message": "Invalid Request",
445-
"description": "The JSON sent is not a valid Request object"
446-
},
447-
{
448-
"code": -32601,
449-
"message": "Method not found",
450-
"description": "The method does not exist / is not available"
451463
},
452464
{
453-
"code": -32602,
454-
"message": "Invalid params",
455-
"description": "Invalid method parameter(s)"
456-
},
457-
{
458-
"code": -32603,
459-
"message": "Internal error",
460-
"description": "Internal JSON-RPC error"
461-
},
462-
{
463-
"code": -32000,
464-
"message": "Service not found",
465-
"description": "The requested service does not exist"
466-
},
467-
{
468-
"code": -32001,
469-
"message": "Service already monitored",
470-
"description": "The service is already being monitored"
471-
},
472-
{
473-
"code": -32002,
474-
"message": "Service is up",
475-
"description": "The service is currently running"
476-
},
477-
{
478-
"code": -32003,
479-
"message": "Service is down",
480-
"description": "The service is currently not running"
481-
},
482-
{
483-
"code": -32004,
484-
"message": "Invalid signal",
485-
"description": "The provided signal is invalid"
465+
"name": "service.create",
466+
"description": "Creates a new service configuration file",
467+
"params": [
468+
{
469+
"name": "name",
470+
"description": "The name of the service to create",
471+
"required": true,
472+
"schema": {
473+
"type": "string"
474+
}
475+
},
476+
{
477+
"name": "content",
478+
"description": "The service configuration content",
479+
"required": true,
480+
"schema": {
481+
"type": "object",
482+
"properties": {
483+
"exec": {
484+
"type": "string",
485+
"description": "Command to run"
486+
},
487+
"oneshot": {
488+
"type": "boolean",
489+
"description": "Whether the service should be restarted"
490+
},
491+
"after": {
492+
"type": "array",
493+
"items": {
494+
"type": "string"
495+
},
496+
"description": "Services that must be running before this one starts"
497+
},
498+
"log": {
499+
"type": "string",
500+
"enum": ["null", "ring", "stdout"],
501+
"description": "How to handle service output"
502+
},
503+
"env": {
504+
"type": "object",
505+
"additionalProperties": {
506+
"type": "string"
507+
},
508+
"description": "Environment variables for the service"
509+
},
510+
"shutdown_timeout": {
511+
"type": "integer",
512+
"description": "Maximum time to wait for service to stop during shutdown"
513+
}
514+
}
515+
}
516+
}
517+
],
518+
"result": {
519+
"name": "CreateServiceResult",
520+
"description": "Result of the create operation",
521+
"schema": {
522+
"type": "string"
523+
}
524+
},
525+
"errors": [
526+
{
527+
"code": -32007,
528+
"message": "Service already exists",
529+
"data": "Service 'name' already exists"
530+
},
531+
{
532+
"code": -32008,
533+
"message": "Service file error",
534+
"data": "Failed to create service file"
535+
}
536+
]
486537
},
487538
{
488-
"code": -32005,
489-
"message": "Config error",
490-
"description": "Error in service configuration"
539+
"name": "service.delete",
540+
"description": "Deletes a service configuration file",
541+
"params": [
542+
{
543+
"name": "name",
544+
"description": "The name of the service to delete",
545+
"required": true,
546+
"schema": {
547+
"type": "string"
548+
}
549+
}
550+
],
551+
"result": {
552+
"name": "DeleteServiceResult",
553+
"description": "Result of the delete operation",
554+
"schema": {
555+
"type": "string"
556+
}
557+
},
558+
"errors": [
559+
{
560+
"code": -32000,
561+
"message": "Service not found",
562+
"data": "Service 'name' not found"
563+
},
564+
{
565+
"code": -32008,
566+
"message": "Service file error",
567+
"data": "Failed to delete service file"
568+
}
569+
]
491570
},
492571
{
493-
"code": -32006,
494-
"message": "Shutting down",
495-
"description": "The system is shutting down"
572+
"name": "service.get",
573+
"description": "Gets a service configuration file",
574+
"params": [
575+
{
576+
"name": "name",
577+
"description": "The name of the service to get",
578+
"required": true,
579+
"schema": {
580+
"type": "string"
581+
}
582+
}
583+
],
584+
"result": {
585+
"name": "GetServiceResult",
586+
"description": "The service configuration",
587+
"schema": {
588+
"type": "object"
589+
}
590+
},
591+
"errors": [
592+
{
593+
"code": -32000,
594+
"message": "Service not found",
595+
"data": "Service 'name' not found"
596+
},
597+
{
598+
"code": -32008,
599+
"message": "Service file error",
600+
"data": "Failed to read service file"
601+
}
602+
]
496603
}
497-
]
604+
],
605+
"components": {
606+
"contentDescriptors": {},
607+
"schemas": {}
608+
}
498609
}

0 commit comments

Comments
 (0)