298 lines
6.2 KiB
YAML
298 lines
6.2 KiB
YAML
openapi: 3.0.3
|
|
|
|
info:
|
|
title: OgAgent API
|
|
description: OgAgent API
|
|
version: 0.0.1
|
|
|
|
paths:
|
|
/opengnsys/status:
|
|
post:
|
|
summary: Get status of the agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/StatusReq'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/StatusRes'
|
|
|
|
/opengnsys/poweroff:
|
|
post:
|
|
summary: Power agent off
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LaunchedRes'
|
|
|
|
/opengnsys/reboot:
|
|
post:
|
|
summary: Reboot agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LaunchedRes'
|
|
|
|
/opengnsys/script:
|
|
post:
|
|
summary: Run script on agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ScriptReq'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ScriptRes'
|
|
|
|
/opengnsys/terminatescript:
|
|
post:
|
|
summary: Terminate running script on agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/TerminateScriptReq'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
|
|
/opengnsys/preparescripts:
|
|
post:
|
|
summary: Prepare list of scripts running on agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
|
|
/opengnsys/getscripts:
|
|
post:
|
|
summary: Get the list of scripts running on agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/GetScriptsRes'
|
|
|
|
/opengnsys/logoff:
|
|
post:
|
|
summary: Log remote user off
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmptyObj'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LogoffRes'
|
|
|
|
/opengnsys/popup:
|
|
post:
|
|
summary: Show message on agent
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/Popup'
|
|
required: true
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/LaunchedRes'
|
|
|
|
components:
|
|
schemas:
|
|
EmptyObj:
|
|
type: object
|
|
additionalProperties: false
|
|
|
|
Jobid:
|
|
type: string
|
|
example:
|
|
- "deadbeef"
|
|
|
|
StatusReq:
|
|
type: object
|
|
properties:
|
|
detail:
|
|
type: boolean
|
|
|
|
StatusRes:
|
|
type: object
|
|
required:
|
|
- status
|
|
properties:
|
|
status:
|
|
type: string
|
|
enum:
|
|
- "LNX"
|
|
- "OSX"
|
|
- "WIN"
|
|
loggedin:
|
|
type: boolean
|
|
session:
|
|
type: string
|
|
example:
|
|
- "x11"
|
|
agent_version:
|
|
type: string
|
|
os_version:
|
|
type: string
|
|
sys_load:
|
|
type: number
|
|
|
|
LaunchedRes:
|
|
type: object
|
|
required:
|
|
- op
|
|
properties:
|
|
op:
|
|
type: string
|
|
enum:
|
|
- "launched"
|
|
|
|
ScriptReq:
|
|
type: object
|
|
required:
|
|
- script
|
|
properties:
|
|
script:
|
|
type: string
|
|
example:
|
|
- "uptime\nwho"
|
|
- "Start-Process notepad.exe"
|
|
client:
|
|
type: boolean
|
|
default: false
|
|
|
|
ScriptRes:
|
|
type: object
|
|
required:
|
|
- op
|
|
properties:
|
|
op:
|
|
type: string
|
|
enum:
|
|
- "launched"
|
|
jobid:
|
|
$ref: '#/components/schemas/Jobid'
|
|
|
|
TerminateScriptReq:
|
|
type: object
|
|
required:
|
|
- jobid
|
|
properties:
|
|
jobid:
|
|
$ref: '#/components/schemas/Jobid'
|
|
|
|
|
|
RunningScript:
|
|
type: object
|
|
required:
|
|
- jobid
|
|
- pid
|
|
- starttime
|
|
- script
|
|
- client
|
|
- status
|
|
- stdout
|
|
- stderr
|
|
properties:
|
|
jobid:
|
|
$ref: '#/components/schemas/Jobid'
|
|
pid:
|
|
type: integer
|
|
starttime:
|
|
type: string
|
|
example: "2024-12-31 23:59:59.123456+0000"
|
|
script:
|
|
type: string
|
|
client:
|
|
type: boolean
|
|
status:
|
|
type: string
|
|
enum:
|
|
- "running"
|
|
- "finished"
|
|
stdout:
|
|
type: string
|
|
stderr:
|
|
type: string
|
|
rc:
|
|
type: integer
|
|
|
|
GetScriptsRes:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/RunningScript'
|
|
|
|
LogoffRes:
|
|
type: object
|
|
required:
|
|
- op
|
|
properties:
|
|
op:
|
|
type: string
|
|
enum:
|
|
- "sent to client"
|
|
|
|
Popup:
|
|
type: object
|
|
properties:
|
|
title:
|
|
type: string
|
|
message:
|
|
type: string
|