summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-api/static/schema.yml
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-05 12:08:25 +0200
committerGitHub <noreply@github.com>2021-07-05 12:08:25 +0200
commit49fc69c9cf154f9ad727e58f451e4be24dbaaff0 (patch)
tree953ed9998107f46d5892addc7266e39b3484fdfa /opendc-web/opendc-web-api/static/schema.yml
parent07958ab26e94d5ab7e0873cc00d7beb9c417975e (diff)
parent6752b6d50faab447b3edc13bddf14f53401392f1 (diff)
web: Migrate web runner to REST API
This pull request updates the web runner to remove its hard dependency on a direct database connection. Instead, it now communicates via the REST API. * Add endpoint for scheduling simulation jobs * Create simple API client for web runner * Remove direct database connection from web runner * Improve validation of API input/output data Implements #144
Diffstat (limited to 'opendc-web/opendc-web-api/static/schema.yml')
-rw-r--r--opendc-web/opendc-web-api/static/schema.yml184
1 files changed, 171 insertions, 13 deletions
diff --git a/opendc-web/opendc-web-api/static/schema.yml b/opendc-web/opendc-web-api/static/schema.yml
index 99e88095..6a07ae52 100644
--- a/opendc-web/opendc-web-api/static/schema.yml
+++ b/opendc-web/opendc-web-api/static/schema.yml
@@ -965,7 +965,7 @@ paths:
application/json:
schema:
properties:
- project:
+ prefab:
$ref: "#/components/schemas/Prefab"
description: Prefab's new properties.
required: true
@@ -1040,6 +1040,135 @@ paths:
"application/json":
schema:
$ref: "#/components/schemas/NotFound"
+ /jobs:
+ get:
+ tags:
+ - jobs
+ description: Get all available jobs to run.
+ responses:
+ "200":
+ description: Successfully retrieved available jobs.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ type: array
+ items:
+ $ref: "#/components/schemas/Job"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "/jobs/{jobId}":
+ get:
+ tags:
+ - jobs
+ description: Get this Job.
+ parameters:
+ - name: jobId
+ in: path
+ description: Job's ID.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: Successfully retrieved Job.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ $ref: "#/components/schemas/Job"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "403":
+ description: Forbidden from retrieving Job.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Forbidden"
+ "404":
+ description: Job not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
+ post:
+ tags:
+ - jobs
+ description: Update this Job.
+ parameters:
+ - name: jobId
+ in: path
+ description: Job's ID.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ job:
+ $ref: "#/components/schemas/Job"
+ description: Job's new properties.
+ required: true
+ responses:
+ "200":
+ description: Successfully updated Job.
+ content:
+ "application/json":
+ schema:
+ type: object
+ required:
+ - data
+ properties:
+ data:
+ $ref: "#/components/schemas/Job"
+ "400":
+ description: Missing or incorrectly typed parameter.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Invalid"
+ "401":
+ description: Unauthorized.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Unauthorized"
+ "403":
+ description: Forbidden from retrieving Job.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Forbidden"
+ "404":
+ description: Job not found.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/NotFound"
+ "409":
+ description: State conflict.
+ content:
+ "application/json":
+ schema:
+ $ref: "#/components/schemas/Invalid"
components:
securitySchemes:
auth0:
@@ -1051,6 +1180,7 @@ components:
tokenUrl: https://opendc.eu.auth0.com/oauth/token
scopes:
openid: Grants access to user_id
+ runner: Grants access to runner jobs
schemas:
Unauthorized:
type: object
@@ -1153,6 +1283,10 @@ components:
object:
type: object
properties:
+ _id:
+ type: string
+ name:
+ type: string
capacity:
type: integer
powerCapacityW:
@@ -1162,52 +1296,70 @@ components:
items:
type: object
properties:
+ _id:
+ type: string
position:
type: integer
- cpuItems:
+ cpus:
type: array
items:
type: object
properties:
+ _id:
+ type: string
name:
type: string
clockRateMhz:
type: integer
numberOfCores:
type: integer
- gpuItems:
+ energyConsumptionW:
+ type: integer
+ gpus:
type: array
items:
type: object
properties:
+ _id:
+ type: string
name:
type: string
clockRateMhz:
type: integer
numberOfCores:
type: integer
- memoryItems:
+ energyConsumptionW:
+ type: integer
+ memories:
type: array
items:
type: object
properties:
+ _id:
+ type: string
name:
type: string
speedMbPerS:
type: integer
sizeMb:
type: integer
- storageItems:
+ energyConsumptionW:
+ type: integer
+ storages:
type: array
items:
- type: integer
+ type: object
properties:
+ _id:
+ type: string
name:
type: string
speedMbPerS:
type: integer
sizeMb:
type: integer
+ energyConsumptionW:
+ type: integer
Portfolio:
type: object
properties:
@@ -1239,13 +1391,6 @@ components:
type: string
name:
type: string
- simulation:
- type: object
- properties:
- state:
- type: string
- results:
- type: object
trace:
type: object
properties:
@@ -1267,6 +1412,19 @@ components:
type: boolean
schedulerName:
type: string
+ Job:
+ type: object
+ properties:
+ _id:
+ type: string
+ scenarioId:
+ type: string
+ state:
+ type: string
+ heartbeat:
+ type: string
+ results:
+ type: object
Trace:
type: object
properties: