Add an API that gets an ad-hoc action DSL and validates it. This is done in the same way workflows are validated today. Change-Id: Ibbb949ef38befae1ef83a2a56cda4c817ceb41d4 Implements: blueprint validate-ad-hoc-action-api
6.5 KiB
V2 API
This API describes the ways of interacting with Mistral service via HTTP protocol using Representational State Transfer concept (ReST).
Basics
Media Types
Currently this API relies on JSON to represent states of REST resources.
Error States
The common HTTP Response Status Codes (https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used.
Application Root [/]
Application Root provides links to all possible API methods for Mistral. URLs for other resources described below are relative to Application Root.
API v2 Root [/v2/]
All API v2 urls are relative to API v2 root.
Workbooks
mistral.api.controllers.v2.workbook.Workbook
name is immutable. tags is a list of values associated with a workbook that a user can use to group workbooks by some criteria (deployment workbooks, Big Data processing workbooks etc.). Note that name and tags get inferred from workbook definition when Mistral service receives a POST request. So they can't be changed in another way.
mistral.api.controllers.v2.workbook.Workbooks
mistral.api.controllers.v2.workbook:WorkbooksController
Workflows
mistral.api.controllers.v2.workflow.Workflow
name is immutable. tags is a list of values associated with a workflow that a user can use to group workflows by some criteria. Note that name and tags get inferred from workflow definition when Mistral service receives a POST request. So they can't be changed in another way.
mistral.api.controllers.v2.workflow.Workflows
mistral.api.controllers.v2.workflow:WorkflowsController
Actions
mistral.api.controllers.v2.action.Action
mistral.api.controllers.v2.action.Actions
mistral.api.controllers.v2.action:ActionsController
Executions
mistral.api.controllers.v2.execution.Execution
mistral.api.controllers.v2.execution.Executions
mistral.api.controllers.v2.execution:ExecutionsController
Tasks
When a workflow starts Mistral creates an execution. It in turn consists of a set of tasks. So Task is an instance of a task described in a Workflow that belongs to a particular execution.
mistral.api.controllers.v2.task.Task
mistral.api.controllers.v2.task.Tasks
mistral.api.controllers.v2.task:TasksController
mistral.api.controllers.v2.task:ExecutionTasksController
Action Executions
When a Task starts Mistral creates a set of Action Executions. So Action Execution is an instance of an action call described in a Workflow Task that belongs to a particular execution.
mistral.api.controllers.v2.action_execution.ActionExecution
mistral.api.controllers.v2.action_execution.ActionExecutions
mistral.api.controllers.v2.action_execution:ActionExecutionsController
mistral.api.controllers.v2.action_execution:TasksActionExecutionController
Cron Triggers
Cron trigger is an object that allows to run Mistral workflows according to a time pattern (Unix crontab patterns format). Once a trigger is created it will run a specified workflow according to its properties: pattern, first_execution_time and remaining_executions.
mistral.api.controllers.v2.cron_trigger.CronTrigger
mistral.api.controllers.v2.cron_trigger.CronTriggers
mistral.api.controllers.v2.cron_trigger:CronTriggersController
Environments
Environment contains a set of variables which can be used in specific workflow. Using Environment possible to create and map action default values - just provide '__actions' key in 'variables'. All these variables can be accessed in workflow DSL by <% $.__env %> expression.
Example of using in DSL:
workflow:
tasks:
task1:
action: std.echo output=<% $.__env.my_echo_output %>
Example of creating action defaults:
...ENV...
"variables": {
"__actions": {
"std.echo": {
"output": "my_output"
}
}
},
...ENV...
Note: using CLI, Environment can be created via JSON or YAML file.
mistral.api.controllers.v2.environment.Environment
mistral.api.controllers.v2.environment.Environments
mistral.api.controllers.v2.environment:EnvironmentController
Services
Through service management API, system administrator or operator can retrieve Mistral services information of the system, including service group and service identifier. The internal implementation of this feature make use of tooz library, which needs coordinator backend(the most commonly used at present is Zookeeper) installed, please refer to tooz official documentation for more detailed instruction.
There are three service groups according to Mistral architecture currently, namely api_group, engine_group and executor_group. The service identifier contains name of the host the service is running on and the process identifier of the service on that host.
mistral.api.controllers.v2.service.Service
mistral.api.controllers.v2.service.Services
mistral.api.controllers.v2.service:ServicesController
Validation
Validation endpoints allow to check correctness of workbook, workflow and ad-hoc action DSL without having to upload them into Mistral.
- POST /v2/workbooks/validation
-
Validate workbook content (DSL grammar and semantics).
- POST /v2/workflows/validation
-
Validate workflow content (DSL grammar and semantics).
- POST /v2/actions/validation
-
Validate ad-hoc action content (DSL grammar and semantics).
These endpoints expect workbook, workflow or ad-hoc action text (DSL) correspondingly in a request body.