otto/apispec/orchestrator.yml

118 lines
3.0 KiB
YAML

---
swagger: '2.0'
info:
description: 'This specification describes the Otto orchestrator'
version: '1.0.0'
title: Otto Orchestrator
contact:
email: 'rtyler@brokenco.de'
license:
name: 'GNU AGPL 3.0'
url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
host: 'localhost:3030'
externalDocs:
description: 'Find out more about Otto'
url: 'https://github.com/rtyler/otto'
basePath: '/v1'
schemes:
- 'http'
paths:
/manifest/{agentId}:
get:
summary: 'Fetch manifest for execution by the given agent'
description: |
Return the full execution manifest for the given agent to execute.
operationId: 'fetchManifest'
produces:
- 'application/json'
parameters:
- name: agentId
in: path
required: true
type: string
x-example: otto-agent-1
responses:
200:
description: 'Agent ID found and manifest generated'
# https://github.com/apiaryio/dredd/issues/553#issuecomment-412265413
headers:
Content-Type:
type: string
default: application/json; charset=utf-8
schema:
$ref: '#/definitions/Manifest'
400:
description: 'Invalid request'
definitions:
Manifest:
type: object
description: 'Agent execution manifest'
xml:
name: 'Manifest'
properties:
self:
type: string
description: 'The identifier of the agent'
services:
type: object
$ref: '#/definitions/Service'
ops:
type: array
items:
$ref: '#/definitions/Operation'
x-example:
self: 'otto-agent-1'
services:
$ref: '#/definitions/Service'
ops:
$ref: '#/definitions/Operation'
Service:
type: object
description: 'A service ID to URl mapping'
xml:
name: 'Service'
properties:
identifier:
type: string
description: 'Key to identify the different services'
url:
type: string
description: 'Resolvable URL to access APIs for the given service'
example:
datastore: 'http://localhost:3031/'
Operation:
type: object
description: 'A discrete idempotent operation'
properties:
id:
type: string
description: 'Globally unique ID to identify this specific operation in data stores, etc'
context:
type: string
description: 'Generally unique context ID to group different operations in the same context'
type:
type: string
description: 'Type of operation'
$ref: '#/definitions/OperationType'
data:
type: object
description: 'Operation type-specific data for the agent to use'
example:
id: '0xdeadbeef'
context: '0x1'
type: 'RUNPROC'
data:
script: 'echo "Hello World"'
env:
timeout_s: 600
OperationType:
type: string
description: 'Specific type of the given operation, implies different `data` fields'
enum:
- 'BEGINCTX'
- 'ENDCTX'
- 'RUNPROC'