diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index fd5fd5d..cd952cf 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -30,7 +30,7 @@ jobs: - name: code qa run: make ci-code-qa - name: unit tests - run: make test + run: make ci-test test-minimal: runs-on: ubuntu-latest @@ -50,7 +50,7 @@ jobs: - name: install dependencies run: make ci-install-api - name: unit tests - run: make test + run: make ci-test publish-api: needs: @@ -133,5 +133,4 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - packages-dir: waylay-sdk-rules-types/dist - password: ${{ secrets.PYPI_TYPES_PKG_API_TOKEN }} + packages-dir: waylay-sdk-rules-types/dist \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bb8aed2..edd4616 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -4,6 +4,7 @@ LICENSE.txt Makefile README.md docs/ATasksBatchOperationSpecification.md +docs/AboutApi.md docs/ActuatorExecutionResult.md docs/ActuatorNode.md docs/BatchIdQuery.md @@ -61,6 +62,7 @@ docs/ReactiveTaskSettingType.md docs/RelationNode.md docs/ReplaceTemplate200Response.md docs/ResourceDataInjection.md +docs/RetryConfig.md docs/RunTemplateLogLevelParameter.md docs/ScheduledTaskSetting.md docs/ScheduledTaskSettingAllOfType.md @@ -110,13 +112,13 @@ docs/VariableDeclaration.md docs/VariableDeclarationDefaultValue.md docs/VariableFormat.md docs/VariableType.md -docs/VersionApi.md docs/VersionResponse.md docs/VersionResponseStatus.md pyproject.toml requirements.txt test/__init__.py test/api/__init__.py +test/api/about_api_test.py test/api/plugs_execution_api_test.py test/api/push_data_api_test.py test/api/task_nodes_api_test.py @@ -124,7 +126,6 @@ test/api/tasks_api_test.py test/api/tasks_batch_operations_api_test.py test/api/template_runs_api_test.py test/api/templates_api_test.py -test/api/version_api_test.py test/conftest.py test/openapi.py test/types/__init__.py @@ -183,6 +184,7 @@ test/types/reactive_task_setting_type_stub.py test/types/relation_node_stub.py test/types/replace_template200_response_stub.py test/types/resource_data_injection_stub.py +test/types/retry_config_stub.py test/types/run_template_log_level_parameter_stub.py test/types/scheduled_task_setting_all_of_type_stub.py test/types/scheduled_task_setting_stub.py @@ -229,3 +231,5 @@ test/types/variable_format_stub.py test/types/variable_type_stub.py test/types/version_response_status_stub.py test/types/version_response_stub.py +waylay-sdk-rules-types/README.md +waylay-sdk-rules/README.md diff --git a/Makefile b/Makefile index dd0e51b..3884121 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ typecheck: install ### Run type checks code-qa: install ### perform code quality checks @${VENV_TYPES_ACTIVATE} && make exec-code-qa -test: test-types test-notypes ### Run unit tests with and without types installed +test: test-notypes test-types ### Run unit tests with and without types installed test-types: install-types ### Run unit tests with types installed @${VENV_TYPES_ACTIVATE} && make exec-test @@ -134,6 +134,8 @@ ci-install-types: ci-install-api ### Install the environment including types wit ci-install-api: _install_requirements ### Install the minimal environment with frozen requirements pip install './${API_FOLDER}[dev]' +ci-test: exec-test ### perform ci unit tests + _install_requirements: pip install --upgrade pip pip install -r requirements.txt diff --git a/README.md b/README.md index f63e045..a1c8cb6 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ The REST api to manage rule tasks and rule templates in the Waylay platform. This Python package is automatically generated based on the Waylay Rules OpenAPI specification (API version: 6.5.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/rules.html). -It consists of two sub-packages that are both plugins for the waylay-sdk package. +It consists of two sub-packages that are both plugins for the waylay-sdk-core package. - The `waylay-sdk-rules` sub-package contains the Rules api methods. - The `waylay-sdk-rules-types` sub-package is an extension that contains the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-rules`. @@ -12,21 +13,20 @@ It consists of two sub-packages that are both plugins for the waylay-sdk package This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-rules is included in: -- ```pip install waylay-sdk[rules]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[rules]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-rules and waylay-sdk-rules-types are included in: -- ```pip install waylay-sdk[rules,rules-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[rules,rules-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -34,28 +34,28 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-rules-types` is installed -from waylay.services.rules.models.execute_plugs_specification import ExecutePlugsSpecification -from waylay.services.rules.models.transformer_execution_result import TransformerExecutionResult +from waylay.services.rules.models.version_response import VersionResponse try: - # Execute Specified Transformer Version - # calls `POST /rules/v1/transformers/{name}/versions/{version}` - api_response = await waylay_client.rules.plugs_execution.execute_transformer_version( - 'name_example', # name | path param "name" - 'version_example', # version | path param "version" + # Get Service Information + # calls `GET /rules/v1` + api_response = await waylay_client.rules.about.get( ) - print("The response of rules.plugs_execution.execute_transformer_version:\n") + print("The response of rules.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling rules.plugs_execution.execute_transformer_version: %s\n" % e) + print("Exception when calling rules.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). + ## Documentation for API Endpoints All URIs are relative to *https://api.waylay.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*AboutApi* | [**get**](docs/AboutApi.md#get) | **GET** /rules/v1 | Get Service Information *PlugsExecutionApi* | [**execute_actuator**](docs/PlugsExecutionApi.md#execute_actuator) | **POST** /rules/v1/actions/{name} | Execute Latest Actuator Version *PlugsExecutionApi* | [**execute_actuator_version**](docs/PlugsExecutionApi.md#execute_actuator_version) | **POST** /rules/v1/actions/{name}/versions/{version} | Execute Specified Actuator Version *PlugsExecutionApi* | [**execute_sensor**](docs/PlugsExecutionApi.md#execute_sensor) | **POST** /rules/v1/sensors/{name} | Execute Latest Sensor Version @@ -87,7 +87,6 @@ Class | Method | HTTP request | Description *TemplatesApi* | [**replace**](docs/TemplatesApi.md#replace) | **PUT** /rules/v1/templates/{name} | Update Template *TemplatesApi* | [**set**](docs/TemplatesApi.md#set) | **PUT** /rules/v1/discoveryTemplate | Set Discovery Template *TemplatesApi* | [**upgrade_plugins**](docs/TemplatesApi.md#upgrade_plugins) | **PATCH** /rules/v1/templates | Upgrade Plugins -*VersionApi* | [**get**](docs/VersionApi.md#get) | **GET** /rules/v1 | Get Version ## Documentation For Models @@ -147,6 +146,7 @@ Class | Method | HTTP request | Description - [RelationNode](docs/RelationNode.md) - [ReplaceTemplate200Response](docs/ReplaceTemplate200Response.md) - [ResourceDataInjection](docs/ResourceDataInjection.md) + - [RetryConfig](docs/RetryConfig.md) - [RunTemplateLogLevelParameter](docs/RunTemplateLogLevelParameter.md) - [ScheduledTaskSetting](docs/ScheduledTaskSetting.md) - [ScheduledTaskSettingAllOfType](docs/ScheduledTaskSettingAllOfType.md) diff --git a/docs/VersionApi.md b/docs/AboutApi.md similarity index 81% rename from docs/VersionApi.md rename to docs/AboutApi.md index 90ba1f5..e4ace85 100644 --- a/docs/VersionApi.md +++ b/docs/AboutApi.md @@ -1,26 +1,26 @@ -# waylay.services.rules.VersionApi +# waylay.services.rules.AboutApi All URIs are relative to *https://api.waylay.io* Method | HTTP request | Description ------------- | ------------- | ------------- -[**get**](VersionApi.md#get) | **GET** /rules/v1 | Get Version +[**get**](AboutApi.md#get) | **GET** /rules/v1 | Get Service Information # **get** > get( > headers > ) -> VersionResponse -Get Version +Get Service Information -Get the status and version of the service. +Get the name and version of the service. ### Example ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -30,14 +30,14 @@ waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-rules-types` is installed from waylay.services.rules.models.version_response import VersionResponse try: - # Get Version + # Get Service Information # calls `GET /rules/v1` - api_response = await waylay_client.rules.version.get( + api_response = await waylay_client.rules.about.get( ) - print("The response of rules.version.get:\n") + print("The response of rules.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling rules.version.get: %s\n" % e) + print("Exception when calling rules.about.get: %s\n" % e) ``` ### Endpoint diff --git a/docs/PeriodicTaskSetting.md b/docs/PeriodicTaskSetting.md index b7991d5..d64c391 100644 --- a/docs/PeriodicTaskSetting.md +++ b/docs/PeriodicTaskSetting.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**PeriodicTaskSettingType**](PeriodicTaskSettingType.md) | | -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | ## Example diff --git a/docs/PlugsExecutionApi.md b/docs/PlugsExecutionApi.md index 466840e..35dbfd9 100644 --- a/docs/PlugsExecutionApi.md +++ b/docs/PlugsExecutionApi.md @@ -26,7 +26,7 @@ Execute latest version of an actuator. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -98,7 +98,7 @@ Execute specified version of an actuator. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -171,7 +171,7 @@ Execute latest version of a sensor. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -243,7 +243,7 @@ Execute the specified version of a sensor. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -316,7 +316,7 @@ Execute the latest transformer version. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -388,7 +388,7 @@ Execute specified version of a transformer. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/PushDataApi.md b/docs/PushDataApi.md index 40675d2..ae41814 100644 --- a/docs/PushDataApi.md +++ b/docs/PushDataApi.md @@ -20,7 +20,7 @@ Push (real-time) streaming data. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/RetryConfig.md b/docs/RetryConfig.md new file mode 100644 index 0000000..13c64c4 --- /dev/null +++ b/docs/RetryConfig.md @@ -0,0 +1,33 @@ +# RetryConfig + +Configuration for retrying a template node. The node execution will be retried `maxRetries` times. The delay between retries will be exponentially increased starting from `minBackoff` to `maxBackoff`. If the node execution fails after `maxRetries` retries, the node state will be set to `errorState` if it that property is provided. Otherwise node execution will fail. Error state should be one of the possible states defined by the sensor node. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**max_retries** | **int** | | +**min_backoff** | **str** | | +**max_backoff** | **str** | | +**error_state** | **str** | Optional sensor state which will be used to set the state of the node when the maxRetries is reached. | [optional] + +## Example + +```python +from waylay.services.rules.models.retry_config import RetryConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of RetryConfig from a JSON string +retry_config_instance = RetryConfig.from_json(json) +# print the JSON string representation of the object +print RetryConfig.to_json() + +# convert the object into a dict +retry_config_dict = retry_config_instance.to_dict() +# create an instance of RetryConfig from a dict +retry_config_form_dict = retry_config.from_dict(retry_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SensorNode.md b/docs/SensorNode.md index 59200b4..1295f4d 100644 --- a/docs/SensorNode.md +++ b/docs/SensorNode.md @@ -21,6 +21,7 @@ Name | Type | Description | Notes **timeout** | **str** | | [optional] [default to 'PT50S'] **timeout_state** | **str** | | [optional] **loop_def** | **str** | A loop definition is a string that defines items over which node will be iterated multiple times. The string is an JSON array of JSON objects.During template execution the sensor node with such a defined loop definition will be invoked for every JSON Object in the JSON array. Parameter is optional. Node will be executed only once if loop definition is not defined. | [optional] +**retry_config** | [**RetryConfig**](RetryConfig.md) | | [optional] ## Example diff --git a/docs/TaskFromTemplate.md b/docs/TaskFromTemplate.md index 9d449e4..9668b1e 100644 --- a/docs/TaskFromTemplate.md +++ b/docs/TaskFromTemplate.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **variables** | **object** | set of variables which will be used when starting a task and will automatically be injected in the template before starting a task. | [optional] **type** | [**ReactiveTaskSettingType**](ReactiveTaskSettingType.md) | | **time_zone** | **str** | Optional identifier of the time zone in which the schedule expression is to be interpreted | [optional] -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | **start** | **bool** | | [optional] [default to True] **template** | **str** | Unique template identifier | diff --git a/docs/TaskNodesApi.md b/docs/TaskNodesApi.md index 15b57a8..caf5215 100644 --- a/docs/TaskNodesApi.md +++ b/docs/TaskNodesApi.md @@ -25,7 +25,7 @@ Get the supported states of a node. #### visibility This definition has visibil ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -95,7 +95,7 @@ Get current states (posteriors) and raw data of the node. #### visibility This ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -166,7 +166,7 @@ Set the current state and rawData for the node. This can only be done for a runn ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -242,7 +242,7 @@ Set the current state of the node. This call is deprecated. Please use `PATCH / ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/TaskSettings.md b/docs/TaskSettings.md index b577414..2d2c255 100644 --- a/docs/TaskSettings.md +++ b/docs/TaskSettings.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **variables** | **object** | set of variables which will be used when starting a task and will automatically be injected in the template before starting a task. | [optional] **type** | [**ReactiveTaskSettingType**](ReactiveTaskSettingType.md) | | **time_zone** | **str** | Optional identifier of the time zone in which the schedule expression is to be interpreted | [optional] -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | ## Example diff --git a/docs/TaskSpecification.md b/docs/TaskSpecification.md index b0eb78f..6b16f4f 100644 --- a/docs/TaskSpecification.md +++ b/docs/TaskSpecification.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **variables** | **object** | set of variables which will be used when starting a task and will automatically be injected in the template before starting a task. | [optional] **type** | [**ReactiveTaskSettingType**](ReactiveTaskSettingType.md) | | **time_zone** | **str** | Optional identifier of the time zone in which the schedule expression is to be interpreted | [optional] -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | **start** | **bool** | | [optional] [default to True] **template** | **str** | Unique template identifier | **sensors** | [**List[SensorNode]**](SensorNode.md) | List of sensors with required properties | [optional] diff --git a/docs/TaskTypeSettings.md b/docs/TaskTypeSettings.md index 78910ba..1bb652c 100644 --- a/docs/TaskTypeSettings.md +++ b/docs/TaskTypeSettings.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**ReactiveTaskSettingType**](ReactiveTaskSettingType.md) | | **time_zone** | **str** | Optional identifier of the time zone in which the schedule expression is to be interpreted | [optional] -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | ## Example diff --git a/docs/TaskWithRuleAllOfTask.md b/docs/TaskWithRuleAllOfTask.md index f278108..9fd63b5 100644 --- a/docs/TaskWithRuleAllOfTask.md +++ b/docs/TaskWithRuleAllOfTask.md @@ -14,7 +14,7 @@ Name | Type | Description | Notes **variables** | **object** | set of variables which will be used when starting a task and will automatically be injected in the template before starting a task. | [optional] **type** | [**ReactiveTaskSettingType**](ReactiveTaskSettingType.md) | | **time_zone** | **str** | Optional identifier of the time zone in which the schedule expression is to be interpreted | [optional] -**frequency** | **int** | polling frequency in milliseconds | [optional] +**frequency** | **int** | polling frequency in milliseconds | **start** | **bool** | | [optional] [default to True] ## Example diff --git a/docs/TasksApi.md b/docs/TasksApi.md index 120a112..ad55cd2 100644 --- a/docs/TasksApi.md +++ b/docs/TasksApi.md @@ -28,7 +28,7 @@ Create a new task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -104,7 +104,7 @@ Delete a task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -171,7 +171,7 @@ Getting the configuration of an existing task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -247,7 +247,7 @@ Retrieve the details of a task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -322,7 +322,7 @@ Query multiple tasks. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -421,7 +421,7 @@ Update a task. Remark that the full specification of the task must be given ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -492,7 +492,7 @@ Start a task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -562,7 +562,7 @@ Stop a task. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/TasksBatchOperationsApi.md b/docs/TasksBatchOperationsApi.md index 6def979..c147132 100644 --- a/docs/TasksBatchOperationsApi.md +++ b/docs/TasksBatchOperationsApi.md @@ -22,7 +22,7 @@ Get the results of the Tasks Batch Operation. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -90,7 +90,7 @@ Start a batch operation. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/docs/TemplateRunsApi.md b/docs/TemplateRunsApi.md index 6ecbba5..96ef2d9 100644 --- a/docs/TemplateRunsApi.md +++ b/docs/TemplateRunsApi.md @@ -11,7 +11,7 @@ Method | HTTP request | Description > run_graph( > query: RunGraphQuery, > headers -> ) -> TemplateRunInvocation +> ) -> AsyncIterator[TemplateRunInvocation] Run Graph Or Bayesian Network @@ -22,7 +22,7 @@ Run a graph or Bayesian Network. If `data` is specified, template will be run as ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -64,7 +64,7 @@ Name | Type | API binding | Description | Notes Selected path param | Raw response param | Return Type | Description | Links ------------------- | ------------------ | ------------ | ----------- | ----- -Literal[""] _(default)_ | False _(default)_ | **`TemplateRunInvocation`** | | [TemplateRunInvocation](TemplateRunInvocation.md) +Literal[""] _(default)_ | False _(default)_ | **`AsyncIterator[TemplateRunInvocation]`** | | [TemplateRunInvocation](TemplateRunInvocation.md) str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | / | True | `Response` | The raw http response object. @@ -87,7 +87,7 @@ str | False _(default)_ | **`Any`** | If any other string value for the selected > name: str, > query: RunQuery, > headers -> ) -> TemplateRunInvocation +> ) -> AsyncIterator[TemplateRunInvocation] Run Template @@ -98,7 +98,7 @@ Run a template. If `data` is specified, template will be run as reactive templat ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -142,7 +142,7 @@ Name | Type | API binding | Description | Notes Selected path param | Raw response param | Return Type | Description | Links ------------------- | ------------------ | ------------ | ----------- | ----- -Literal[""] _(default)_ | False _(default)_ | **`TemplateRunInvocation`** | | [TemplateRunInvocation](TemplateRunInvocation.md) +Literal[""] _(default)_ | False _(default)_ | **`AsyncIterator[TemplateRunInvocation]`** | | [TemplateRunInvocation](TemplateRunInvocation.md) str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | / | True | `Response` | The raw http response object. diff --git a/docs/TemplatesApi.md b/docs/TemplatesApi.md index 7ce54b9..22a8f52 100644 --- a/docs/TemplatesApi.md +++ b/docs/TemplatesApi.md @@ -27,7 +27,7 @@ Create a template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -95,7 +95,7 @@ Delete a template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -161,7 +161,7 @@ Get the discovery template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -228,7 +228,7 @@ Retrieve the details of a template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -303,7 +303,7 @@ Query templates. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -383,7 +383,7 @@ Update a template. Note that this will not update any tasks using the template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -454,7 +454,7 @@ Set the discovery template. ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -528,7 +528,7 @@ Upgrade plugins on multiple templates. The plugin upgrades specified in the bod ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError diff --git a/openapi/rules.openapi.yaml b/openapi/rules.openapi.yaml index 0482237..d03d2f6 100644 --- a/openapi/rules.openapi.yaml +++ b/openapi/rules.openapi.yaml @@ -36,7 +36,7 @@ tags: externalDocs: url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations description: Waylay Documentation -- name: Version +- name: About - name: Plugs Execution - name: Push Data description: Inject streaming data in tasks @@ -46,11 +46,11 @@ tags: paths: /rules/v1: get: - summary: Get Version - operationId: get_version + summary: Get Service Information + operationId: get_about tags: - - Version - description: Get the status and version of the service. + - About + description: Get the name and version of the service. responses: '200': $ref: '#/components/responses/VersionResponse' @@ -1442,6 +1442,44 @@ components: example: - 223 - 213 + RetryConfig: + title: Retry Configuration + description: 'Configuration for retrying a template node. + + The node execution will be retried `maxRetries` times. + + The delay between retries will be exponentially increased starting from `minBackoff` + to `maxBackoff`. + + If the node execution fails after `maxRetries` retries, the node state will + be set to `errorState` if it that property is provided. + + Otherwise node execution will fail. Error state should be one of the possible + states defined by the sensor node.' + type: object + properties: + maxRetries: + type: integer + minimum: 0 + example: 3 + minBackoff: + type: string + format: duration + example: PT1S + maxBackoff: + type: string + format: duration + example: PT10S + errorState: + type: string + description: Optional sensor state which will be used to set the state of + the node when the maxRetries is reached. + format: string + example: Error + required: + - maxRetries + - minBackoff + - maxBackoff Version: title: Semantic version of a plug type: string @@ -1648,6 +1686,8 @@ components: Parameter is optional. Node will be executed only once if loop definition is not defined.' + retryConfig: + $ref: '#/components/schemas/RetryConfig' additionalProperties: false description: Representation of a sensor in a Rule Template. example: @@ -2426,7 +2466,6 @@ components: name: myTask template: myTemplate type: reactive - frequency: 900000 SimplifiedGraph: title: Simplified Graph description: Graph in simplified format @@ -2518,6 +2557,7 @@ components: example: 900000 required: - type + - frequency TimeZoneId: title: Timezone Id type: string diff --git a/openapi/rules.transformed.openapi.yaml b/openapi/rules.transformed.openapi.yaml index 3080ac7..c2f22c3 100644 --- a/openapi/rules.transformed.openapi.yaml +++ b/openapi/rules.transformed.openapi.yaml @@ -36,7 +36,7 @@ tags: externalDocs: url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations description: Waylay Documentation - - name: Version + - name: About - name: Plugs Execution - name: Push Data description: Inject streaming data in tasks @@ -46,11 +46,11 @@ tags: paths: /rules/v1: get: - summary: Get Version - operationId: get_version + summary: Get Service Information + operationId: get_about tags: - - Version - description: Get the status and version of the service. + - About + description: Get the name and version of the service. responses: '200': $ref: '#/components/responses/VersionResponse' @@ -1020,6 +1020,7 @@ paths: application/x-ndjson: schema: $ref: '#/components/schemas/TemplateRunInvocation' + x-is-event-stream: true '400': description: Validation Failed content: @@ -1045,6 +1046,7 @@ paths: x-consumes-urlencoded: false x-consumes-json: false x-consumes-other: false + x-produces-event-stream: true /rules/v1/templates/run: post: tags: @@ -1076,6 +1078,7 @@ paths: application/x-ndjson: schema: $ref: '#/components/schemas/TemplateRunInvocation' + x-is-event-stream: true '400': description: Validation Failed content: @@ -1102,6 +1105,7 @@ paths: x-consumes-urlencoded: false x-consumes-json: false x-consumes-other: false + x-produces-event-stream: true /rules/v1/discoveryTemplate: get: tags: @@ -1724,6 +1728,45 @@ components: example: - 223 - 213 + RetryConfig: + description: >- + Configuration for retrying a template node. + + The node execution will be retried `maxRetries` times. + + The delay between retries will be exponentially increased starting from + `minBackoff` to `maxBackoff`. + + If the node execution fails after `maxRetries` retries, the node state + will be set to `errorState` if it that property is provided. + + Otherwise node execution will fail. Error state should be one of the + possible states defined by the sensor node. + type: object + properties: + maxRetries: + type: integer + minimum: 0 + example: 3 + minBackoff: + type: string + format: duration + example: PT1S + maxBackoff: + type: string + format: duration + example: PT10S + errorState: + type: string + description: >- + Optional sensor state which will be used to set the state of the + node when the maxRetries is reached. + format: string + example: Error + required: + - maxRetries + - minBackoff + - maxBackoff Version: type: string pattern: \d+\.\d+\.\d+ @@ -1924,6 +1967,8 @@ components: Parameter is optional. Node will be executed only once if loop definition is not defined. + retryConfig: + $ref: '#/components/schemas/RetryConfig' additionalProperties: false description: Representation of a sensor in a Rule Template. example: @@ -2709,7 +2754,6 @@ components: name: myTask template: myTemplate type: reactive - frequency: 900000 SimplifiedGraph: description: Graph in simplified format type: object @@ -2798,6 +2842,7 @@ components: example: 900000 required: - type + - frequency TimeZoneId: type: string description: >- diff --git a/requirements.txt b/requirements.txt index 500bd25..252e690 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pydantic ~= 2.6 typing-extensions ~= 4.9 -waylay-sdk ~= 0.0.4rc5 +waylay-sdk-core@git+https://github.com/waylayio/waylay-sdk-py@cc464ef9ee120bc54ff6381add0c92a2d06e2944 diff --git a/test/_run/openapi/rules.openapi.yaml b/test/_run/openapi/rules.openapi.yaml deleted file mode 100644 index 476f879..0000000 --- a/test/_run/openapi/rules.openapi.yaml +++ /dev/null @@ -1,3128 +0,0 @@ -openapi: 3.0.3 -info: - title: Waylay rules engine - version: 6.5.0 - description: The REST api to manage rule tasks and rule templates in the Waylay - platform. -externalDocs: - url: https://docs.waylay.io/#/api/rules/ - description: Waylay Documentation -tags: -- name: Tasks - description: Manage Waylay Tasks - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=task - description: Waylay Documentation -- name: Task Nodes - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=node-related-calls - description: Waylay Documentation -- name: Templates - description: Manage Waylay Rule Templates - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=templates - description: Waylay Documentation -- name: Template Runs - description: Running a template over a data set or once (with 1 tick) - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=bulk-data-processing - description: Waylay Documentation -- name: Tasks Batch Operations - description: "Batch operations on multiple Tasks. Batch operations are executed\ - \ asynchronously. \nCreating a batch operation will return an url which you can\ - \ use to retrieve the status and the results of the operation." - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - description: Waylay Documentation -- name: Version -- name: Plugs Execution -- name: Push Data - description: Inject streaming data in tasks - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data - description: Waylay Documentation -paths: - /rules/v1: - get: - summary: Get Version - operationId: get_version - tags: - - Version - description: Get the status and version of the service. - responses: - '200': - $ref: '#/components/responses/VersionResponse' - security: &id001 - - waylayApiKeySecret: [] - /rules/v1/tasks: - post: - tags: - - Tasks - operationId: create_task - summary: Create Task - description: Create a new task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=create-a-task - requestBody: - $ref: '#/components/requestBodies/TaskSpecification' - parameters: - - name: failOnWarning - in: query - description: If `true` and there are task warnings, the response will be a - `400 Validation failed` - schema: - type: boolean - default: false - - name: returnWarnings - in: query - description: If `true`, result body will contain a list of task warnings that - where detected - schema: - type: boolean - default: false - responses: - '201': - $ref: '#/components/responses/TaskCreatedResponse' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: 'Binding error at SensorLocation(debugDialog_1)/message/binding - ''${nodes.dice_1.rawData.status}'' : rawData has no field status' - code: VALIDATION - details: - - type: BINDING - message: rawData has no field status - severity: WARNING - details: - nodeId: debugDialog_1 - property: message - binding: ${nodes.dice_1.rawData.status} - suggestion: 'maybe you are looking for one of these: state, randomValue' - security: *id001 - get: - tags: - - Tasks - operationId: list_tasks - summary: Query Multiple Tasks - description: Query multiple tasks. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=query-multiple-tasks - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/PagingHits' - - $ref: '#/components/parameters/PagingStart' - - $ref: '#/components/parameters/Format' - - name: name - in: query - schema: - type: string - - name: resource - in: query - schema: - $ref: '#/components/schemas/ResourceId' - - name: resourceType - in: query - schema: - $ref: '#/components/schemas/ResourceTypeId' - - name: type - in: query - schema: - $ref: '#/components/schemas/TaskScenarioType' - - name: status - in: query - schema: - $ref: '#/components/schemas/TaskStatus' - - name: ids - in: query - schema: - type: array - items: - $ref: '#/components/schemas/TaskId' - explode: false - - name: id - in: query - schema: - $ref: '#/components/schemas/TaskId' - - name: plugin - in: query - schema: - type: string - - name: template - in: query - schema: - type: string - nullable: true - - name: filter - in: query - schema: - type: string - description: fuzzy search on multiple properties - - name: tags.key - in: query - style: form - explode: true - allowEmptyValue: true - schema: - oneOf: - - type: string - - type: number - - type: boolean - description: 'Parameter is `form` style serialized, with explode: true - - - See [Query multiple tasks tag examples](/#/api/rules/?id=queryTagExamples) - - - You can add the same tag query parameter multiple times with different values, - - which will be applied with a logical OR. - - - You can specify the `tags.` query parameter without a value, tasks - which have a value for tag `` will be returned' - example: 3904859080956 - - name: finishedBefore - in: query - description: Tasks stopped before provided time will be returned. - schema: - $ref: '#/components/schemas/UnixEpochMillis' - - name: createdAfter - in: query - description: Tasks created after provided time will be returned. - schema: - $ref: '#/components/schemas/UnixEpochMillis' - example: 1661990400000 - - name: createdBefore - in: query - description: Tasks created before provided time will be returned - schema: - $ref: '#/components/schemas/UnixEpochMillis' - example: 1662768000000 - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of tasks that fulfill the query. - schema: - type: integer - content: - application/json: - schema: - title: Task listing - type: array - items: - $ref: '#/components/schemas/TaskEntity' - application/vnd.waylay.paged+json: - schema: - type: object - allOf: - - properties: - values: - type: array - items: - $ref: '#/components/schemas/TaskEntity' - - $ref: '#/components/schemas/PagingResult' - security: *id001 - /rules/v1/tasks/{taskId}: - get: - tags: - - Tasks - operationId: get_task - summary: Retrieve Task Details - description: Retrieve the details of a task. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=getting-a-single-task-by-id - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/Format' - responses: - '200': - description: Task Details - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - put: - tags: - - Tasks - operationId: replace_task - summary: Update Task - description: "Update a task. \n\nRemark that the full specification of the task\ - \ must be given" - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=update-a-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - requestBody: - $ref: '#/components/requestBodies/TaskSpecification' - responses: - '200': - description: Task Updated - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - delete: - tags: - - Tasks - operationId: delete_task - summary: Delete Task - description: Delete a task. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=delete-a-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - responses: - '204': - description: Task Deleted - '400': - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Not possible to remove task in status running - security: *id001 - /rules/v1/tasks/{taskId}/conf: - get: - tags: - - Tasks - operationId: getConfiguration_task - summary: Get Task Configuration - description: Getting the configuration of an existing task. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=getting-the-configuration-of-an-existing-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/Format' - responses: - '200': - description: Task Configuration - content: - application/json: - schema: - $ref: '#/components/schemas/TaskSpecification' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - /rules/v1/tasks/{taskId}/command/start: - post: - tags: - - Tasks - operationId: start_task - summary: Start Task - description: Start a task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=start-a-task - parameters: - - $ref: '#/components/parameters/TaskId' - responses: - '200': - description: Task Started - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Task Cannot Be Started - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Not possible to apply action start, for the task in status - running - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - /rules/v1/tasks/{taskId}/command/stop: - post: - tags: - - Tasks - operationId: stop_task - summary: Stop Task - description: Stop a task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=stop-a-task - parameters: - - $ref: '#/components/parameters/TaskId' - responses: - '200': - description: Task Stopped - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Task Cannot Be Stopped - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Not possible to apply action stop, for the task in status stopped - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - /rules/v1/tasks/{taskId}/nodes/{nodeId}: - get: - tags: - - Task Nodes - operationId: get_task_node - x-visibility: deprecated - summary: Get Current States - description: 'Get current states (posteriors) and raw data of the node. - - - #### visibility - - This definition has visibility status `deprecated`. - - ' - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=node-related-calls - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/NodeId' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - patch: - tags: - - Task Nodes - operationId: patch_task_node - summary: Set Node State - description: Set the current state and rawData for the node. This can only be - done for a running task - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/NodeId' - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - state: - type: string - description: State to set. Should be one of the supported states - of the sensor - rawData: - type: object - description: rawData to set - example: - state: THREE - rawData: - randomValue: 0.3458795 - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: State FVE is invalid for node dice_1 on task 808aec38-3fb3-4163-a45e-1890e94081ea - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: *id001 - post: - tags: - - Task Nodes - operationId: update_task_node_state - x-visibility: deprecated - summary: Set Current State - description: 'Set the current state of the node. - - - This call is deprecated. Please use `PATCH /rules/v1/tasks/{taskId}/nodes/{nodeId}` - - - #### visibility - - This definition has visibility status `deprecated`. - - ' - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=set-the-state - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/NodeId' - requestBody: - $ref: '#/components/requestBodies/NodeCallsSpecification' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - security: *id001 - /rules/v1/tasks/{taskId}/nodes/{nodeId}/states: - get: - tags: - - Task Nodes - operationId: getStates_task_node - x-visibility: deprecated - summary: Get Supported States - description: 'Get the supported states of a node. - - - #### visibility - - This definition has visibility status `deprecated`. - - ' - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=get-supported-states - parameters: - - $ref: '#/components/parameters/TaskId' - - $ref: '#/components/parameters/NodeId' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - security: *id001 - /rules/v1/templates: - post: - tags: - - Templates - operationId: create_template - summary: Create Template - description: Create a template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=create-a-new-template - requestBody: - $ref: '#/components/requestBodies/TemplatesSpecification' - responses: - '201': - $ref: '#/components/responses/TemplateCreatedResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - examples: - Duplicate name: - value: - statusCode: 400 - error: A template with name 'internet.json' already exists - code: ERR_DUPLICATE_TEMPLATE_NAME - Plugin not found: - value: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - security: *id001 - get: - tags: - - Templates - operationId: list_templates - summary: List Templates - description: Query templates. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=list-all-templates - parameters: - - $ref: '#/components/parameters/PagingHits' - - $ref: '#/components/parameters/PagingStart' - - name: filter - description: fuzzy search on multiple properties - in: query - schema: - type: string - - name: ids - description: comma separated string of template names - in: query - schema: - type: array - items: - $ref: '#/components/schemas/TemplateId' - explode: false - - name: id - description: filter on template name - in: query - schema: - $ref: '#/components/schemas/TemplateId' - - name: plugin - in: query - description: either name of a plugin (e.g. `mySensor`), or full version specification - of the plug (e.g `mySensor:1.0.3`) - schema: - type: string - example: mySensor:1.0.3 - - name: tags.X - in: query - schema: - type: string - description: 'String of form "tags.: ".' - example: 'tags.myref: 3904859080956' - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of templates that fulfill the query. - schema: - type: integer - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/TemplateEntityMetadata' - security: *id001 - patch: - tags: - - Templates - operationId: upgradePlugins_templates - summary: Upgrade Plugins - description: 'Upgrade plugins on multiple templates. - - - The plugin upgrades specified in the body will be applied to all template - that fullfil the query expresses by the query parameters. - - At least one of the query parameters must be specified.' - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=modifying-existing-templates-batch - description: Waylay Documentation - parameters: - - name: ids - in: query - description: comma separated string of template names - schema: - type: array - items: - $ref: '#/components/schemas/TemplateId' - explode: false - - name: id - in: query - description: filter on template name - schema: - $ref: '#/components/schemas/TemplateId' - - name: plugin - in: query - description: either name of a plugin (e.g. `mySensor`), or full version specification - of the plug (e.g `mySensor:1.0.3`) - schema: - type: string - example: - plugin: mySensor:1.0.3 - - name: tags.X - in: query - schema: - type: string - description: 'String of form "tags.: ".' - example: null - requestBody: - required: true - description: Plugin Update Specifications - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateModification' - responses: - '200': - description: Successfully Updated - content: - application/json: - schema: - type: object - properties: - successful: - type: array - items: - $ref: '#/components/schemas/TemplateId' - '400': - description: Unsuccessful - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - examples: - Partially applied: - value: - statusCode: 400 - error: Operation only partially applied - successful: - - internet.json - failed: - - templateName: fastInternet.json - error: Node checkState_1 has timeout state ERRORED but it's - sensor mySensor:2.4.13 has states [OK, NOK] - Plugin version does not exist: - value: - statusCode: 400 - error: mySensor:2.4.13 does not exist - security: *id001 - /rules/v1/templates/{name}: - get: - tags: - - Templates - operationId: get_template - summary: Retrieve Template Details - description: Retrieve the details of a template. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=get-a-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - - $ref: '#/components/parameters/Format' - responses: - '200': - description: Template Details - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: *id001 - put: - tags: - - Templates - operationId: replace_template - summary: Update Template - description: Update a template. Note that this will not update any tasks using - the template. You will need to do a batch reload operation on the tasks to - accomplish that. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=update-a-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - requestBody: - $ref: '#/components/requestBodies/TemplatesSpecification' - responses: - '200': - description: Template Updated - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/SimplifiedGraph' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - examples: - Changed name: - value: - statusCode: 400 - error: Path name and submitted template name don't match - Plugin not found: - value: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: *id001 - delete: - tags: - - Templates - operationId: delete_template - summary: Delete Template - description: Delete a template. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=delete-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - responses: - '204': - description: Template Deleted - '400': - description: Template Still In Use - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Template with name internet.json in use by 6 task(s) - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: *id001 - /rules/v1/templates/{name}/run: - post: - tags: - - Template Runs - operationId: run_template - summary: Run Template - description: "Run a template.\nIf `data` is specified, template will be run\ - \ as reactive template. \nIf `data` is not specified, template will be run\ - \ as a one-time template (1 tick)" - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=running-a-template - parameters: - - $ref: '#/components/parameters/TemplateId' - - $ref: '#/components/parameters/LogLevel' - - $ref: '#/components/parameters/TargetNode' - requestBody: - $ref: '#/components/requestBodies/RunTemplateSpecification' - responses: - '200': - description: Stream Of Invocation Results - content: - application/x-ndjson: - schema: - $ref: '#/components/schemas/TemplateRunInvocation' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Variable 'threshold' not found - code: VALIDATION - details: - - type: VARIABLE - message: Variable 'threshold' not found - severity: ERROR - details: - variable: threshold - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: *id001 - /rules/v1/templates/run: - post: - tags: - - Template Runs - operationId: runGraph - summary: Run Graph Or Bayesian Network - description: "Run a graph or Bayesian Network.\nIf `data` is specified, template\ - \ will be run as reactive template. \nIf `data` is not specified, template\ - \ will be run as a one-time template (1 tick)" - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=running-a-batch-dataset-through-a-graphbns - parameters: - - $ref: '#/components/parameters/LogLevel' - - $ref: '#/components/parameters/TargetNode' - requestBody: - $ref: '#/components/requestBodies/RunTemplateSpecificationGraph' - responses: - '200': - description: Stream Of Invocation Results - content: - application/x-ndjson: - schema: - $ref: '#/components/schemas/TemplateRunInvocation' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - security: *id001 - /rules/v1/discoveryTemplate: - get: - tags: - - Templates - operationId: getDiscovery_template - summary: Retrieve Discovery Template - description: Get the discovery template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=discovery-template - responses: - '200': - description: Discovery Template Details - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - - type: object - properties: - discoveryTemplate: - type: boolean - example: true - '204': - description: No Discovery Template - security: *id001 - put: - tags: - - Templates - operationId: set_discovery_template - summary: Set Discovery Template - description: Set the discovery template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=set-the-discovery-template - parameters: - - name: name - in: query - schema: - $ref: '#/components/schemas/TemplateId' - example: discoverResourceType - required: false - description: The template to set as discovery template. If you do not specify - this parameter, the current discovery template will be cleared. - responses: - '200': - description: Discovery Template Set - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - - type: object - properties: - name: - type: string - example: discoverResourceType - discoveryTemplate: - type: boolean - example: true - '204': - description: Discovery Template Cleared - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: *id001 - /rules/v1/batch: - post: - tags: - - Tasks Batch Operations - operationId: start_batch_operation - summary: Start Batch Operations - description: Start a batch operation. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - requestBody: - $ref: '#/components/requestBodies/BatchTasksSpecification' - responses: - '202': - $ref: '#/components/responses/BatchStartResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: /action <- unknown action strt, we support updatePlugins, delete, - start, restart, stop, reload - security: *id001 - /rules/v1/batch/{batchId}: - get: - tags: - - Tasks Batch Operations - operationId: get_batch_operation - summary: Get Tasks Batch Operation Status - description: Get the results of the Tasks Batch Operation. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - parameters: - - $ref: '#/components/parameters/BatchId' - responses: - '200': - description: Get Batch Operation - content: - application/json: - schema: - oneOf: - - $ref: '#/components/schemas/BatchOperationResult' - - allOf: - - $ref: '#/components/schemas/BatchOperation' - - title: Result of a running Batch Operation - examples: - Batch Operation still running: - value: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: task - action: delete - description: Remove tasks filtered by type=onetime AND status=stopped - AND finishedBefore=1648738809733 - queueTime: 1663269720694 - Result of a finished Batch Operation: - value: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: task - action: delete - description: Remove tasks filtered by type=onetime AND status=stopped - AND finishedBefore=1648738809733 - queueTime: 1663269720694 - finishedTime: 1663269725784 - results: - success: - 4bbec310-4b8a-4f82-954d-f6268e7736a3: - statusCode: 200 - b637dc9c-b8fc-4d1e-8743-b1456364e559: - statusCode: 200 - failure: - 0cf62e41-be40-42bf-a88f-6fc803bcb957: - statusCode: 404 - error: No task with id 0cf62e41-be40-42bf-a88f-6fc803bcb957 - '404': - $ref: '#/components/responses/BatchNotFoundResponse' - security: *id001 - /rules/v1/sensors/{name}: - post: - tags: - - Plugs Execution - operationId: executeSensor - summary: Execute Latest Sensor Version - description: Execute latest version of a sensor. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-sensor - parameters: - - name: name - in: path - schema: - type: string - required: true - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 13 - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: false - error: 'ReferenceError: callbackUrdl is not defined' - '404': - description: Sensor Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Sensor mySensor not found - security: *id001 - /rules/v1/sensors/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeSensorVersion - summary: Execute Specified Sensor Version - description: Execute the specified version of a sensor. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-sensor - parameters: - - name: name - in: path - schema: - type: string - required: true - - $ref: '#/components/parameters/VersionId' - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 13 - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: false - error: 'ReferenceError: callbackUrdl is not defined' - '404': - description: Sensor Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Sensor mySensor:3.14.5 not found - security: *id001 - /rules/v1/actions/{name}: - post: - tags: - - Plugs Execution - operationId: executeActuator - summary: Execute Latest Actuator Version - description: Execute latest version of an actuator. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-actuator - parameters: - - name: name - in: path - schema: - type: string - required: true - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Actuator Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Actuator myActuator not found - security: *id001 - /rules/v1/actions/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeActuatorVersion - summary: Execute Specified Actuator Version - description: Execute specified version of an actuator. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-actuator - parameters: - - name: name - in: path - schema: - type: string - required: true - - $ref: '#/components/parameters/VersionId' - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Actuator Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Actuator myActuator:4.12.0 not found - security: *id001 - /rules/v1/transformers/{name}: - post: - tags: - - Plugs Execution - operationId: executeTransformer - summary: Execute Latest Transformer Version - description: Execute the latest transformer version. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-the-latest-transformer-version - parameters: - - name: name - in: path - schema: - type: string - required: true - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Transformer Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Transformer myTransformer not found - security: *id001 - /rules/v1/transformers/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeTransformerVersion - summary: Execute Specified Transformer Version - description: Execute specified version of a transformer. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-a-specific-transformer-version - parameters: - - name: name - in: path - schema: - type: string - required: true - - $ref: '#/components/parameters/VersionId' - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Transformer Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Transformer myTransformer:2.47.2 not found - security: *id001 - /rules/v1/data: - post: - tags: - - Push Data - operationId: push_data - summary: Push Streaming Data - description: Push (real-time) streaming data. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data - requestBody: - $ref: '#/components/requestBodies/StreamData' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Expecting json array or object - security: *id001 -components: - schemas: - TaskId: - title: Task identifier - description: Unique task identifier - type: string - example: 808aec38-3fb3-4163-a45e-1890e94081ea - InvocationId: - title: Invocation identifier - description: Unique invocation identifier - type: string - example: 45a85360-fe8a-4978-9636-90d741806033 - TemplateId: - title: Template identifier - description: Unique template identifier - type: string - example: internet.json - LogLevel: - title: Log Level - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - - NONE - example: INFO - ResourceId: - title: Resource identifier - description: Unique resource identifier - type: string - example: resource1 - ResourceTypeId: - title: Resource Type identifier - description: Unique resource type identifier - type: string - example: resourcetype1 - NodeId: - title: Node label - description: Unique node label - type: string - example: dice_1 - BatchId: - title: Batch Operation id - type: string - example: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - UnixEpochMillis: - type: integer - title: Unix Epoch Milliseconds - description: "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January\ - \ 1970, \nnot counting leap seconds." - example: 1663269720694 - ISO8601Timestamp: - title: ISO8601 timestamp - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - VersionResponse: - type: object - properties: - version: - type: string - example: 5.12.1 - name: - type: string - example: waylay-engine - startTime: - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - uptime: - type: integer - format: int64 - example: 12703737 - status: - type: string - enum: - - STARTING - - STARTED - - FAILED - example: STARTED - required: - - name - - version - - status - Position: - title: Position ([X, Y] coordinates) - type: array - minItems: 2 - maxItems: 2 - items: - type: integer - example: - - 223 - - 213 - Version: - title: Semantic version of a plug - type: string - pattern: \d+\.\d+\.\d+ - example: 2.4.13 - PluginUpdateSpec: - title: Plugin Update Spec - type: object - properties: - name: - type: string - description: Name of the plugin to update - example: mySensor - fromVersion: - description: plugin version selection to upgrade - oneOf: - - $ref: '#/components/schemas/Version' - - type: string - title: Any Version - enum: - - any - example: any - toVersion: - description: Plugin version to upgrade to - allOf: - - $ref: '#/components/schemas/Version' - required: - - name - - fromVersion - - toVersion - PropertyUpdatesSpec: - title: Task properties Update Spec - type: object - properties: - variables: - type: object - description: "Set of variables to update. \nWill be merged with the current\ - \ variables. \nTo delete any of the current variables (and fall back to\ - \ the default value from the template) set the value to `null`" - tags: - type: object - description: "Key-value pairs. \nWill be merged with the current tags. \n\ - To delete any of the current tags set the value to `null`" - anyOf: - - required: - - variables - - required: - - tags - TemplateModification: - title: Templates Modification Specification - type: object - properties: - operation: - type: string - enum: - - updatePlugins - updates: - type: array - items: - $ref: '#/components/schemas/PluginUpdateSpec' - reloadTasks: - type: boolean - description: Should all tasks created from the template be reloaded - default: false - example: true - required: - - operation - - updates - TemplateTags: - type: object - description: Key-value pairs on which you can filter to finding templates back - example: - useCase: UC13.5 - TemplateEntityCommonAttributes: - type: object - properties: - name: - $ref: '#/components/schemas/TemplateId' - discoveryTemplate: - type: boolean - description: flag to indicate if the template is the discovery template - example: false - tags: - $ref: '#/components/schemas/TemplateTags' - variables: - description: Variable declarations - type: array - items: - $ref: '#/components/schemas/VariableDeclaration' - taskDefaults: - $ref: '#/components/schemas/TaskDefaultsElement' - notes: - description: List of notes as explanation for users - type: array - items: - $ref: '#/components/schemas/NoteElement' - required: - - name - TemplateEntity: - title: Waylay Rule Template Specification - type: object - allOf: - - $ref: '#/components/schemas/TemplateEntityCommonAttributes' - - $ref: '#/components/schemas/SimplifiedGraph' - TemplateEntityMetadata: - title: Waylay Template - allOf: - - $ref: '#/components/schemas/TemplateEntityCommonAttributes' - - type: object - properties: - user: - $ref: '#/components/schemas/TemplateUser' - createTime: - $ref: '#/components/schemas/UnixEpochMillis' - lastUpdateTime: - $ref: '#/components/schemas/UnixEpochMillis' - required: - - name - - user - - createTime - - lastUpdateTime - - discoveryTemplate - SensorNode: - title: Sensor node - required: - - label - - name - - version - type: object - properties: - label: - $ref: '#/components/schemas/NodeId' - name: - title: Name of sensor - type: string - version: - $ref: '#/components/schemas/Version' - properties: - title: Key-value object of required properties - type: object - resource: - $ref: '#/components/schemas/ResourceId' - sequence: - title: Sequence number if omitted default is 1 - type: integer - default: 1 - position: - $ref: '#/components/schemas/Position' - dataTrigger: - title: Boolean to indicate if sensor needs to be executed if data for `resource` - is received - type: boolean - default: true - tickTrigger: - title: Boolean to indicate if sensor needs to be executed on task tick - type: boolean - default: true - evictionTime: - title: Time (in milliseconds) after which sensor goes back to default state - type: integer - minimum: 0 - pollingPeriod: - title: "Time (in milliseconds) to give sensor it\u2019s own tick" - type: integer - minimum: 1 - schedule: - title: Schedule - type: string - description: Either a valid cron or RRule expression to set the sensor's - own tick - timeout: - title: Time (in ISO 8601 duration format) before the plugin times out, defaults - to PT50S (50 seconds) - type: string - default: PT50S - timeoutState: - title: State that will be returned as result if plug execution times out - type: string - loopDef: - title: Loop definition - type: string - minimum: 0 - example: '[{"name": "alpha"}, {"name": "beta"}]' - description: "A loop definition is a string that defines items over which\ - \ node will be iterated multiple times. \nThe string is an JSON array\ - \ of JSON objects.During template execution the sensor node with such\ - \ \na defined loop definition will be invoked for every JSON Object in\ - \ the JSON array.\nParameter is optional. Node will be executed only once\ - \ if loop definition is not defined." - additionalProperties: false - description: Representation of a sensor in a Rule Template. - example: - label: dice_1 - name: dice - version: 1.0.9 - position: - - 100 - - 150 - dataTrigger: false - tickTrigger: true - timeout: PT5S - ActuatorNode: - title: Actuator node - required: - - label - - name - - version - type: object - properties: - label: - $ref: '#/components/schemas/NodeId' - name: - title: Name of actuator - type: string - version: - $ref: '#/components/schemas/Version' - properties: - title: Key-value object of required properties - type: object - sequence: - title: Sequence - type: integer - position: - $ref: '#/components/schemas/Position' - timeout: - title: Time (in ISO 8601 duration format) before the plugin times out, defaults - to PT50S (50 seconds) - type: string - default: PT50S - additionalProperties: false - description: Representation of an actuator in a Rule Template. - example: - label: debugDialog_1 - name: debugDialog - version: 1.0.0 - properties: - message: Dice 1 has value ONE - position: - - 827 - - 323 - RelationNode: - title: Gate node - required: - - label - - type - - parentLabels - - combinations - type: object - properties: - label: - allOf: - - $ref: '#/components/schemas/NodeId' - example: AND_1 - type: - $ref: '#/components/schemas/GateType' - parentLabels: - title: Labels of the sensors that are attached to this gate - type: array - items: - $ref: '#/components/schemas/NodeId' - example: - - dice_1 - - dice_2 - combinations: - title: Combinations of connected sensor's states - type: array - items: - type: array - items: - type: string - description: State of one of the connected sensors - example: - - ONE - - TWO - position: - $ref: '#/components/schemas/Position' - additionalProperties: false - description: Representation of a gate in a Rule Template. - GateType: - title: Gate Type - enum: - - AND - - OR - - GENERAL - - NAND - type: string - description: Supported gate types. - GenericTrigger: - type: object - properties: - sourceLabel: - title: Label of source sensor or gate - allOf: - - $ref: '#/components/schemas/NodeId' - destinationLabel: - title: Label of the destination sensor or actuator - allOf: - - $ref: '#/components/schemas/NodeId' - invocationPolicy: - title: Time (in seconds) that defines how long to wait before firing the - same actuator again, even if the condition is met. - type: integer - minimum: 1 - TriggerStateChange: - title: TriggerStateChange - required: - - stateFrom - - stateTo - type: object - properties: - stateFrom: - title: State from which to trigger, or '*' - type: string - stateTo: - title: State to, or '*' - type: string - description: State change specification under which to trigger the next node. - StateChangeTrigger: - title: State Change Trigger - description: A trigger that executes on state change. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - properties: - stateChangeTrigger: - $ref: '#/components/schemas/TriggerStateChange' - required: - - sourceLabel - - destinationLabel - - stateChangeTrigger - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_1 - stateChangeTrigger: - stateFrom: 'FALSE' - stateTo: '*' - StatesTrigger: - title: States trigger - description: A trigger that is conditional on the states of the source. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - properties: - statesTrigger: - type: array - description: array of states of source node under which to fire - items: - type: string - required: - - sourceLabel - - destinationLabel - - statesTrigger - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_2 - statesTrigger: - - 'TRUE' - ExecutionTrigger: - title: Execution Trigger - description: A trigger that always executes on successful execution of the source. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - type: object - required: - - sourceLabel - - destinationLabel - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_3 - NoteElement: - title: User Note - required: - - text - - position - type: object - properties: - position: - $ref: '#/components/schemas/Position' - text: - title: Text - type: string - example: Example template having some sensors and gates - additionalProperties: false - description: Representation of a note in a Rule Template. - VariableDeclaration: - title: Declaration of a variable - description: Variable declaration. - required: - - name - - type - type: object - properties: - name: - description: Variable Name - type: string - displayName: - description: Display name. Will default to the name if not specified - type: string - type: - $ref: '#/components/schemas/VariableType' - format: - $ref: '#/components/schemas/VariableFormat' - mandatory: - description: flag to indicate if value for variable is mandatory or not - type: boolean - default: false - defaultValue: - description: Default value for the variable - anyOf: - - type: string - - type: number - - type: boolean - - type: object - example: - name: city - displayName: City - type: string - mandatory: true - VariableFormat: - title: Variable format - required: - - type - type: object - properties: - type: - title: Type - type: string - example: resource - values: - title: Possible values (enum declaration) - type: array - items: - oneOf: - - type: string - - type: number - - type: object - description: Format for a variable definition. - VariableType: - title: VariableType - enum: - - string - - boolean - - integer - - double - - long - - float - - object - type: string - description: Value type for a template variable. - TaskDefaultsElement: - title: Task defaults - description: default task settings that will be applied when creating a task - from the template - type: object - properties: - tags: - $ref: '#/components/schemas/TagsTaskObject' - type: - $ref: '#/components/schemas/TaskScenarioType' - resetObservations: - type: boolean - parallel: - type: boolean - gatesNeedFullObservation: - type: boolean - cron: - $ref: '#/components/schemas/CronExpression' - rrule: - $ref: '#/components/schemas/RRuleExpression' - timeZone: - $ref: '#/components/schemas/TimeZoneId' - frequency: - description: polling frequency in milliseconds - type: integer - example: - type: periodic - frequency: 900000 - resetObservations: false - TaskScenarioType: - title: TaskScenarioType - enum: - - scheduled - - periodic - - onetime - - reactive - type: string - description: Triggering deployment scenario for a task. - TaskStatus: - title: Task status - type: string - enum: - - running - - stopped - - failed - description: Status of a task - TemplateRunWithGraphSpecification: - title: Specification to run template specifying the actual graph - allOf: - - $ref: '#/components/schemas/TemplateRunSpecification' - - type: object - properties: - graph: - $ref: '#/components/schemas/GraphDefinition' - required: - - graph - ResourceDataInjection: - title: Resource Data Injection - type: object - description: data to inject per resource - properties: - resource: - $ref: '#/components/schemas/ResourceId' - timestamp: - $ref: '#/components/schemas/UnixEpochMillis' - additionalProperties: true - required: - - resource - TemplateRunConfiguration: - title: Template Run Configuration - type: object - description: Template run configurations - properties: - executeActuators: - type: boolean - description: Flag to trigger actual execution of actuators - default: false - resource: - $ref: '#/components/schemas/ResourceId' - resetObservations: - type: boolean - description: reset observations before injecting data - default: true - gatesNeedFullObservation: - type: boolean - description: Only evaluate gates when all inputs are observed - default: false - TemplateRunSpecification: - title: Specification to run template - type: object - properties: - data: - title: Data Set - description: The full dataset to process. If specified, template will be - run as reactive template - type: array - items: - type: array - title: Dataset For One Invocation - description: dataset that will be processed by one invocation - items: - $ref: '#/components/schemas/ResourceDataInjection' - example: - - - resource: resource1 - temperature: 20 - - resource: resource2 - co2: 100 - humidity: 0.4 - - - resource: resource1 - temperature: 21 - conf: - $ref: '#/components/schemas/TemplateRunConfiguration' - variables: - title: Template variables - description: The values for the variables declared in the template - type: object - example: - threshold: 13 - resourceMetaData: - title: Resource Metadata - description: 'Metadata for any of the resources used in the template. - - - The current metadata for all resources used in the template is fetched - at the start of the template run. - - This provided metadata is used to overwrite this current metadata' - type: object - additionalProperties: - type: object - example: - resource1: - name: outside_temperature - inside_sensor: - $$ref: /resources/resource2 - SensorExecutionResult: - title: Sensor execution result - type: object - properties: - result: - type: boolean - description: flag indicating if the sensor was successfully executed - state: - type: string - description: observedState field returned by the sensor execution - error: - type: string - description: error message in case of failure - rawData: - type: object - description: the rawData returned by the sensor execution - log: - type: array - items: - type: object - TemplateRunSensorResult: - allOf: - - $ref: '#/components/schemas/SensorExecutionResult' - - type: object - properties: - executed: - type: boolean - description: flag indicating if the sensor was executed - required: - - executed - ActuatorExecutionResult: - title: Actuator execution result - type: object - properties: - result: - type: boolean - description: flag indicating if the actuator was successfully executed - error: - type: string - description: error message in case of failure - rawData: - type: object - log: - type: array - items: - type: object - TemplateRunActuatorResult: - allOf: - - $ref: '#/components/schemas/ActuatorExecutionResult' - - type: object - properties: - executed: - type: boolean - description: flag indicating if the actuator was executed - required: - - executed - TemplateRunInvocation: - type: object - properties: - taskId: - $ref: '#/components/schemas/TaskId' - invocationId: - $ref: '#/components/schemas/InvocationId' - sensors: - title: Sensors Results - description: The execution result for each of the sensors of the template - type: object - additionalProperties: - $ref: '#/components/schemas/TemplateRunSensorResult' - example: - alarm: - executed: true - result: true - state: OK - rawData: {} - log: [] - streamingDataSensor: - executed: true - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 20 - actuators: - title: Actuator Results - description: The execution result for each of the actuators of the template - type: object - additionalProperties: - $ref: '#/components/schemas/TemplateRunActuatorResult' - example: - send_sms: - executed: true - result: true - log: [] - log: - title: Logs - type: array - items: - type: object - properties: - time: - $ref: '#/components/schemas/ISO8601Timestamp' - level: - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - example: INFO - message: - type: string - example: SMS sent - additionalProperties: false - required: - - time - - level - - message - required: - - taskId - - invocationId - - sensors - - actuators - - log - TransformerExecutionResult: - title: Transformer execution result - type: object - properties: - result: - type: boolean - description: flag indicating if the actuator was Successfully Executed - error: - type: string - description: error message in case of failure - data: - type: object - log: - type: array - items: - type: object - ExecutePlugsSpecification: - title: Specification to execute a plug - type: object - properties: - properties: - title: specific input parameters - type: object - example: - threshold: 20 - resource: - $ref: '#/components/schemas/ResourceId' - streamData: - title: Stream data - type: object - example: - temperature: 21 - timestamp: 1582988389 - BatchIdQuery: - title: By Ids - type: object - properties: - ids: - type: array - items: - $ref: '#/components/schemas/TaskId' - required: - - ids - BatchQuery: - title: By Query - type: object - properties: - name: - $ref: '#/components/schemas/TaskName' - resource: - $ref: '#/components/schemas/ResourceId' - type: - $ref: '#/components/schemas/TaskScenarioType' - status: - $ref: '#/components/schemas/TaskStatus' - template: - $ref: '#/components/schemas/TemplateId' - plugin: - description: either name of a plugin (e.g. `mySensor`), or full version - specification of the plug (e.g `mySensor:1.0.3`) - type: string - example: mySensor:1.0.3 - user: - $ref: '#/components/schemas/TaskUser' - finishedBefore: - $ref: '#/components/schemas/UnixEpochMillis' - createdAfter: - $ref: '#/components/schemas/UnixEpochMillis' - createdBefore: - $ref: '#/components/schemas/UnixEpochMillis' - tags: - $ref: '#/components/schemas/TagsTaskObject' - BatchTask: - type: object - properties: - entity: - type: string - enum: - - task - action: - type: string - query: - oneOf: - - $ref: '#/components/schemas/BatchIdQuery' - - $ref: '#/components/schemas/BatchQuery' - BatchTaskCommand: - title: Execute Command - description: Execute command on multiple task - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - enum: - - delete - - start - - restart - - stop - - reload - - stopAndDelete - required: - - entity - - action - - query - BatchUpdatePlugin: - title: Update plugins - description: Upgrade plugins on multiple tasks - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - type: string - enum: - - updatePlugins - actionParameters: - $ref: '#/components/schemas/PluginUpdateSpec' - required: - - entity - - action - - query - - actionParameters - BatchUpdateProperties: - title: Update task properties - description: Update variables and/or tags of multiple tasks - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - type: string - enum: - - updateProperties - actionParameters: - $ref: '#/components/schemas/PropertyUpdatesSpec' - required: - - entity - - action - - query - - actionParameters - BatchOperation: - title: Batch Operation - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - user: - type: string - description: User id of the user who started the operation - example: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - type: object - description: Summary of the batch operation - properties: - entity: - type: string - enum: - - task - action: - type: string - enum: - - updatePlugins - - delete - - start - - restart - - stop - - reload - - updateProperties - example: delete - description: - type: string - description: description of the operations - example: Remove tasks filtered by ids=808aec38-3fb3-4163-a45e-1890e94081ea - required: - - entity - - action - - description - queueTime: - $ref: '#/components/schemas/UnixEpochMillis' - required: - - id - - user - - operation - - queueTime - SuccessOperationResult: - type: object - description: "Object containing the successful operation results. \nThe keys\ - \ will be task ids." - additionalProperties: - type: object - description: The keys will be task ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - required: - - statusCode - FailureOperationResult: - type: object - description: "Object containing the unsuccessful operation results. \nThe keys\ - \ will be tasks ids." - additionalProperties: - type: object - description: The keys will be task ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - error: - type: string - description: Error description of what went wrong. - required: - - statusCode - - error - OperationResultObject: - description: Finished Batch Operation results - type: object - properties: - finishedTime: - $ref: '#/components/schemas/UnixEpochMillis' - results: - type: object - properties: - success: - $ref: '#/components/schemas/SuccessOperationResult' - failure: - $ref: '#/components/schemas/FailureOperationResult' - required: - - success - - failure - required: - - finishedTime - - results - BatchOperationResult: - title: Result of a finished Batch Operation - allOf: - - $ref: '#/components/schemas/BatchOperation' - - $ref: '#/components/schemas/OperationResultObject' - TaskFromTemplate: - title: Task with rule defined in template - type: object - allOf: - - $ref: '#/components/schemas/TaskSettings' - - properties: - start: - title: boolean to indicate whether task must be started after creation - type: boolean - default: true - template: - $ref: '#/components/schemas/TemplateId' - required: - - template - - name - SimplifiedGraph: - title: Simplified Graph - description: Graph in simplified format - type: object - properties: - sensors: - description: List of sensors with required properties - type: array - items: - $ref: '#/components/schemas/SensorNode' - actuators: - description: List of actuators with required properties - type: array - items: - $ref: '#/components/schemas/ActuatorNode' - relations: - description: List of relations (gates) between sensors - type: array - items: - $ref: '#/components/schemas/RelationNode' - triggers: - description: List of conditions under which actuators/sensors get executed. - type: array - items: - anyOf: - - $ref: '#/components/schemas/StateChangeTrigger' - - $ref: '#/components/schemas/StatesTrigger' - - $ref: '#/components/schemas/ExecutionTrigger' - BayesianGraph: - title: Bayesian Network - description: Graph in BN format - type: object - properties: - nodes: - type: array - items: - type: object - posterior: - type: array - items: - type: object - GraphDefinition: - title: Graph - oneOf: - - $ref: '#/components/schemas/SimplifiedGraph' - - $ref: '#/components/schemas/BayesianGraph' - TaskWithRule: - title: Task with rule defined in request - type: object - allOf: - - $ref: '#/components/schemas/SimplifiedGraph' - - properties: - notes: - title: List of notes as explanation for users - type: array - items: - $ref: '#/components/schemas/NoteElement' - task: - allOf: - - $ref: '#/components/schemas/TaskSettings' - - type: object - properties: - start: - title: boolean to indicate whether task must be started after creation - type: boolean - default: true - required: - - name - required: - - task - PeriodicTaskSetting: - title: Task settings for periodic tasks - type: object - properties: - type: - type: string - enum: - - periodic - frequency: - type: integer - description: polling frequency in milliseconds - example: 900000 - required: - - type - - frequency - TimeZoneId: - title: Timezone Id - type: string - description: Optional identifier of the time zone in which the schedule expression - is to be interpreted - example: Europe/Brussels - RRuleExpression: - type: string - title: RRule based - description: RRule expression as defined in [RFC5545 3.8.5.3](https://www.rfc-editor.org/rfc/rfc5545#section-3.8.5.3) - example: FREQ=MINUTELY;INTERVAL=15 - CronExpression: - type: string - title: cron based - description: cron expression as defined in [Cron format](https://www.quartz-scheduler.org/documentation/quartz-1.8.6/tutorials/TutorialLesson06) - example: 15 * * * * ? - ScheduledTaskSetting: - title: Task settings for scheduled tasks - type: object - allOf: - - properties: - type: - type: string - enum: - - scheduled - timeZone: - $ref: '#/components/schemas/TimeZoneId' - required: - - type - - oneOf: - - properties: - rrule: - $ref: '#/components/schemas/RRuleExpression' - required: - - rrule - - properties: - cron: - $ref: '#/components/schemas/CronExpression' - required: - - cron - OneTimeTaskSetting: - title: Task settings for onetime tasks - type: object - properties: - type: - type: string - enum: - - onetime - required: - - type - ReactiveTaskSetting: - title: Task settings for reactive tasks - type: object - properties: - type: - type: string - enum: - - reactive - required: - - type - TaskTypeSettings: - title: Task type related settings - type: object - oneOf: - - $ref: '#/components/schemas/ScheduledTaskSetting' - - $ref: '#/components/schemas/PeriodicTaskSetting' - - $ref: '#/components/schemas/OneTimeTaskSetting' - - $ref: '#/components/schemas/ReactiveTaskSetting' - VariablesTaskObject: - type: object - description: set of variables which will be used when starting a task and will - automatically be injected in the template before starting a task. - example: - email: foo@gmail.com - TagsTaskObject: - type: object - description: Key-value pairs on which you can set at task creation and later - filter tasks - example: - myRef: d8933cd4-7c70-11e9-8f9e-2a86e4085a59 - TaskName: - title: Task Name - type: string - example: Example task 1 - GenericTaskSettings: - title: Task related settings - type: object - properties: - name: - $ref: '#/components/schemas/TaskName' - resource: - $ref: '#/components/schemas/ResourceId' - resetObservations: - title: whether to clear observations before next invocation - type: boolean - default: true - parallel: - title: whether to run sensors in parallel or sequentially - type: boolean - default: true - gatesNeedFullObservation: - title: Only evaluate gates when all inputs are observed - type: boolean - default: false - tags: - $ref: '#/components/schemas/TagsTaskObject' - variables: - $ref: '#/components/schemas/VariablesTaskObject' - TaskSettings: - title: Task related settings - type: object - allOf: - - $ref: '#/components/schemas/GenericTaskSettings' - - $ref: '#/components/schemas/TaskTypeSettings' - ValidationIssue: - title: Validation Issue - type: object - properties: - type: - type: string - description: Indication of "area" where validation issue is situated - example: BINDING - message: - description: Description of the issue - type: string - example: rawData fas no field status - severity: - type: string - description: Severity of the issue. ERROR means that object cannot be created - if the issue is not fixed. WARNING means that the object can be created, - but that errors might be encountered at runtime - enum: - - ERROR - - WARNING - example: WARNING - details: - type: object - description: Object containing identifying information on what gives the - issue - example: - nodeId: debugDialog_1 - property: message - binding: ${nodes.dice_1.rawData.status} - suggestion: - type: string - description: Suggestion on how to change the object to get the issue fixed - example: 'maybe you are looking for one of these: state, randomValue' - required: - - type - - message - - severity - ErrorResponse: - title: Error Response - type: object - properties: - statusCode: - type: integer - example: 400 - error: - type: string - code: - type: string - description: Optional error code - required: - - statusCode - - error - ErrorWithDetailsResponse: - allOf: - - $ref: '#/components/schemas/ErrorResponse' - - properties: - details: - type: array - items: - $ref: '#/components/schemas/ValidationIssue' - PagingSkip: - type: integer - title: Skipped Count - description: Number of items skipped before this page of results. - default: 0 - example: 85 - PagingLimit: - type: integer - title: Limit Count - description: Size of one page of results. - example: 10 - default: 10 - PagingTotal: - type: integer - title: Total Count - description: Total number of items matching the query of which this is one page - of results. - example: 2398 - PagingResult: - type: object - properties: - skip: - $ref: '#/components/schemas/PagingSkip' - limit: - $ref: '#/components/schemas/PagingLimit' - total: - $ref: '#/components/schemas/PagingTotal' - required: - - skip - - limit - - total - TaskUser: - type: string - description: Creation user mail address or 'system' for system generated tasks - example: user@waylay.io - TemplateUser: - type: string - description: Creation user mail address - example: user@waylay.io - TaskResourceIds: - description: List of resources that are used in the task - type: array - items: - $ref: '#/components/schemas/ResourceId' - TaskEntity: - type: object - properties: - ID: - $ref: '#/components/schemas/TaskId' - name: - $ref: '#/components/schemas/TaskName' - status: - $ref: '#/components/schemas/TaskStatus' - user: - $ref: '#/components/schemas/TaskUser' - createTime: - $ref: '#/components/schemas/UnixEpochMillis' - template: - $ref: '#/components/schemas/TemplateId' - network: - description: The graph, either from the template or from the task definition. - Depending on the `format` query parameter either BN or simplified format - type: object - resourceIds: - $ref: '#/components/schemas/TaskResourceIds' - required: - - ID - - status - - user - - createTime - - name - - network - TaskSpecification: - title: a task specification - oneOf: - - $ref: '#/components/schemas/TaskFromTemplate' - - $ref: '#/components/schemas/TaskWithRule' - requestBodies: - TaskSpecification: - description: Task Specification - content: - application/json: - schema: - $ref: '#/components/schemas/TaskSpecification' - required: true - BatchTasksSpecification: - description: Tasks Batch Operation - required: true - content: - application/json: - schema: - title: a tasks batch operation specification - type: object - oneOf: - - $ref: '#/components/schemas/BatchUpdatePlugin' - - $ref: '#/components/schemas/BatchTaskCommand' - - $ref: '#/components/schemas/BatchUpdateProperties' - examples: - Delete multiple tasks by query: - value: - entity: task - action: delete - query: - type: onetime - status: stopped - finishedBefore: 1648738809733 - Delete multiple tasks by id: - value: - entity: task - action: delete - query: - ids: - - 4bbec310-4b8a-4f82-954d-f6268e7736a3 - - b637dc9c-b8fc-4d1e-8743-b1456364e559 - - 0cf62e41-be40-42bf-a88f-6fc803bcb957 - Stop all task running for resource myResource: - value: - entity: task - action: stop - query: - status: running - resource: myResource - Plugin updates: - value: - entity: task - action: updatePlugins - query: - ids: - - 4bbec310-4b8a-4f82-954d-f6268e7736a3 - - b637dc9c-b8fc-4d1e-8743-b1456364e559 - - 0cf62e41-be40-42bf-a88f-6fc803bcb957 - actionParameters: - updates: - - name: myActuator - fromVersion: 1.0.1 - toVersion: 1.0.3 - - name: mySensor - fromVersion: any - toVersion: 2.3.4 - Properties update: - value: - entity: task - action: updateProperties - query: - status: running - template: myChangedTemplate - tags: - revision: 57 - actionParameters: - variables: - variableWithDefault: null - newVariable: 13 - tags: - revision: 58 - dummyTag: null - newTag: released - TemplatesSpecification: - description: Template Specification - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateEntity' - required: true - RunTemplateSpecification: - description: Specification to run template - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateRunSpecification' - RunTemplateSpecificationGraph: - description: Specification to run template through graph/BN. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateRunWithGraphSpecification' - ExecutePlugsSpecification: - description: Specification to execute a plug. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ExecutePlugsSpecification' - NodeCallsSpecification: - description: Command string to apply to a node of a task. - required: true - content: - text/plain: - schema: - type: string - anyOf: - - pattern: ^state= - description: State update command - - pattern: ^operation= - description: Operation command - example: state=Alive - StreamData: - description: Push (real-time) Data Specification - required: true - content: - application/json: - schema: - title: stream data - type: object - properties: - resource: - $ref: '#/components/schemas/ResourceId' - data: - oneOf: - - type: object - example: - parameterName: temperature - value: 23.0 - collectedTime: 1420629467 - - type: array - items: - type: object - example: - - parameterName: latitude - value: 51 - - parameterName: longitude - value: 3.73 - required: - - resource - - data - parameters: - TaskId: - name: taskId - in: path - description: Unique Task identifier - required: true - schema: - $ref: '#/components/schemas/TaskId' - TemplateId: - name: name - in: path - description: Unique Template identifier - required: true - schema: - $ref: '#/components/schemas/TemplateId' - LogLevel: - name: logLevel - in: query - description: 'sets the log level for filtering out logs to requested log level - or higher from the template run output. - - Value `NONE` will disable all logs. - - If not specified all logs will be returned.' - required: false - schema: - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - default: DEBUG - TargetNode: - name: targetNode - in: query - description: "The sensors and actuators part of response will contain only elements\ - \ related to the asked node of the graph. \nThe returned logs also will be\ - \ filtered and contain only logs related to the asked node(s)." - required: false - schema: - type: array - items: - type: string - example: myFirstNode - NodeId: - name: nodeId - in: path - description: Unique node label - required: true - schema: - $ref: '#/components/schemas/NodeId' - BatchId: - name: batchId - in: path - description: Unique Batch Operation identifier - required: true - schema: - $ref: '#/components/schemas/BatchId' - VersionId: - name: version - in: path - description: Version number of plugin - required: true - schema: - $ref: '#/components/schemas/Version' - PagingHits: - name: hits - in: query - description: (Paging) maximal number of items returned - schema: - $ref: '#/components/schemas/PagingLimit' - PagingStart: - name: startIndex - in: query - description: (Paging) items to skip in the listing - schema: - $ref: '#/components/schemas/PagingSkip' - Format: - name: format - in: query - description: Format of the graph definition - schema: - type: string - enum: - - bn - - simplified - default: bn - responses: - DefaultSuccessResponse: - description: Successful Response - content: - application/json: - schema: - type: object - VersionResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/VersionResponse' - TaskCreatedResponse: - description: Task Created - headers: - Location: - description: URI where the created Task can be fetched - schema: - type: string - content: - application/json: - schema: - type: object - properties: - ID: - $ref: '#/components/schemas/TaskId' - warnings: - type: array - description: List of task warning issues. Will only be there if query - parameter `returnWarnings` was set to `true` - items: - $ref: '#/components/schemas/ValidationIssue' - required: - - ID - TaskNotFoundResponse: - description: Task Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Task with id de1b26b1-31f0-4054-af44-da02331f06b5 not found - TemplateCreatedResponse: - description: Template Created - headers: - Location: - description: URI where the created Template can be fetched - schema: - type: string - content: - application/json: - schema: - type: object - properties: - statusCode: - type: integer - example: 201 - uri: - type: string - format: uri - example: /rules/v1/templates/internet.json - entity: - $ref: '#/components/schemas/TemplateEntity' - required: - - statusCode - - uri - - entity - TemplateNotFoundResponse: - description: Template Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: No template with name theInternet.json - BatchStartResponse: - description: Batch Operation Started - content: - application/json: - schema: - title: Batch operation enqueued - type: object - properties: - statusCode: - type: integer - example: 202 - uri: - type: string - description: URI where the batch operation status can be followed - format: uri - example: /rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - entity: - $ref: '#/components/schemas/BatchOperation' - required: - - statusCode - - uri - - entity - headers: - Location: - description: URI where the batch operation status can be followed - example: /rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - schema: - type: string - format: uri - BatchNotFoundResponse: - description: Batch Operation Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: No batch operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' - securitySchemes: - waylayApiKeySecret: - type: http - description: Waylay apiKey/apiSecret basic authentication. All endpoints support - also Waylay JWT Bearer authentication. - scheme: basic -servers: -- url: https://api.waylay.io - description: Waylay enterprise gateway diff --git a/test/_run/openapi/rules.openapi.yaml.json b/test/_run/openapi/rules.openapi.yaml.json deleted file mode 100644 index 92e4ac2..0000000 --- a/test/_run/openapi/rules.openapi.yaml.json +++ /dev/null @@ -1,4740 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "Waylay rules engine", - "version": "6.5.0", - "description": "The REST api to manage rule tasks and rule templates in the Waylay platform." - }, - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/", - "description": "Waylay Documentation" - }, - "tags": [ - { - "name": "Tasks", - "description": "Manage Waylay Tasks", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=task", - "description": "Waylay Documentation" - } - }, - { - "name": "Task Nodes", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=node-related-calls", - "description": "Waylay Documentation" - } - }, - { - "name": "Templates", - "description": "Manage Waylay Rule Templates", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=templates", - "description": "Waylay Documentation" - } - }, - { - "name": "Template Runs", - "description": "Running a template over a data set or once (with 1 tick)", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=bulk-data-processing", - "description": "Waylay Documentation" - } - }, - { - "name": "Tasks Batch Operations", - "description": "Batch operations on multiple Tasks. Batch operations are executed asynchronously. \nCreating a batch operation will return an url which you can use to retrieve the status and the results of the operation.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations", - "description": "Waylay Documentation" - } - }, - { - "name": "Version" - }, - { - "name": "Plugs Execution" - }, - { - "name": "Push Data", - "description": "Inject streaming data in tasks", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data", - "description": "Waylay Documentation" - } - } - ], - "paths": { - "/rules/v1": { - "get": { - "summary": "Get Version", - "operationId": "get_version", - "tags": [ - "Version" - ], - "description": "Get the status and version of the service.", - "responses": { - "200": { - "$ref": "#/components/responses/VersionResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "create_task", - "summary": "Create Task", - "description": "Create a new task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=create-a-task" - }, - "requestBody": { - "$ref": "#/components/requestBodies/TaskSpecification" - }, - "parameters": [ - { - "name": "failOnWarning", - "in": "query", - "description": "If `true` and there are task warnings, the response will be a `400 Validation failed`", - "schema": { - "type": "boolean", - "default": false - } - }, - { - "name": "returnWarnings", - "in": "query", - "description": "If `true`, result body will contain a list of task warnings that where detected", - "schema": { - "type": "boolean", - "default": false - } - } - ], - "responses": { - "201": { - "$ref": "#/components/responses/TaskCreatedResponse" - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Binding error at SensorLocation(debugDialog_1)/message/binding '${nodes.dice_1.rawData.status}' : rawData has no field status", - "code": "VALIDATION", - "details": [ - { - "type": "BINDING", - "message": "rawData has no field status", - "severity": "WARNING", - "details": { - "nodeId": "debugDialog_1", - "property": "message", - "binding": "${nodes.dice_1.rawData.status}" - }, - "suggestion": "maybe you are looking for one of these: state, randomValue" - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "get": { - "tags": [ - "Tasks" - ], - "operationId": "list_tasks", - "summary": "Query Multiple Tasks", - "description": "Query multiple tasks.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=query-multiple-tasks", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/PagingHits" - }, - { - "$ref": "#/components/parameters/PagingStart" - }, - { - "$ref": "#/components/parameters/Format" - }, - { - "name": "name", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "resource", - "in": "query", - "schema": { - "$ref": "#/components/schemas/ResourceId" - } - }, - { - "name": "resourceType", - "in": "query", - "schema": { - "$ref": "#/components/schemas/ResourceTypeId" - } - }, - { - "name": "type", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskScenarioType" - } - }, - { - "name": "status", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskStatus" - } - }, - { - "name": "ids", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskId" - } - }, - "explode": false - }, - { - "name": "id", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskId" - } - }, - { - "name": "plugin", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "template", - "in": "query", - "schema": { - "type": "string", - "nullable": true - } - }, - { - "name": "filter", - "in": "query", - "schema": { - "type": "string" - }, - "description": "fuzzy search on multiple properties" - }, - { - "name": "tags.key", - "in": "query", - "style": "form", - "explode": true, - "allowEmptyValue": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ] - }, - "description": "Parameter is `form` style serialized, with explode: true\n\nSee [Query multiple tasks tag examples](/#/api/rules/?id=queryTagExamples)\n\nYou can add the same tag query parameter multiple times with different values,\nwhich will be applied with a logical OR.\n\nYou can specify the `tags.` query parameter without a value, tasks which have a value for tag `` will be returned", - "example": 3904859080956 - }, - { - "name": "finishedBefore", - "in": "query", - "description": "Tasks stopped before provided time will be returned.", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - { - "name": "createdAfter", - "in": "query", - "description": "Tasks created after provided time will be returned.", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "example": 1661990400000 - }, - { - "name": "createdBefore", - "in": "query", - "description": "Tasks created before provided time will be returned", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "example": 1662768000000 - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of tasks that fulfill the query.", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "title": "Task listing", - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskEntity" - } - } - }, - "application/vnd.waylay.paged+json": { - "schema": { - "type": "object", - "allOf": [ - { - "properties": { - "values": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - { - "$ref": "#/components/schemas/PagingResult" - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}": { - "get": { - "tags": [ - "Tasks" - ], - "operationId": "get_task", - "summary": "Retrieve Task Details", - "description": "Retrieve the details of a task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=getting-a-single-task-by-id", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/Format" - } - ], - "responses": { - "200": { - "description": "Task Details", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "put": { - "tags": [ - "Tasks" - ], - "operationId": "replace_task", - "summary": "Update Task", - "description": "Update a task. \n\nRemark that the full specification of the task must be given", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=update-a-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/TaskSpecification" - }, - "responses": { - "200": { - "description": "Task Updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "delete": { - "tags": [ - "Tasks" - ], - "operationId": "delete_task", - "summary": "Delete Task", - "description": "Delete a task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=delete-a-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - } - ], - "responses": { - "204": { - "description": "Task Deleted" - }, - "400": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to remove task in status running" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}/conf": { - "get": { - "tags": [ - "Tasks" - ], - "operationId": "getConfiguration_task", - "summary": "Get Task Configuration", - "description": "Getting the configuration of an existing task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=getting-the-configuration-of-an-existing-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/Format" - } - ], - "responses": { - "200": { - "description": "Task Configuration", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskSpecification" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}/command/start": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "start_task", - "summary": "Start Task", - "description": "Start a task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=start-a-task" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - } - ], - "responses": { - "200": { - "description": "Task Started", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Task Cannot Be Started", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to apply action start, for the task in status running" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}/command/stop": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "stop_task", - "summary": "Stop Task", - "description": "Stop a task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=stop-a-task" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - } - ], - "responses": { - "200": { - "description": "Task Stopped", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Task Cannot Be Stopped", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to apply action stop, for the task in status stopped" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}/nodes/{nodeId}": { - "get": { - "tags": [ - "Task Nodes" - ], - "operationId": "get_task_node", - "x-visibility": "deprecated", - "summary": "Get Current States", - "description": "Get current states (posteriors) and raw data of the node.\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=node-related-calls" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/NodeId" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "patch": { - "tags": [ - "Task Nodes" - ], - "operationId": "patch_task_node", - "summary": "Set Node State", - "description": "Set the current state and rawData for the node. This can only be done for a running task", - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/NodeId" - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "state": { - "type": "string", - "description": "State to set. Should be one of the supported states of the sensor" - }, - "rawData": { - "type": "object", - "description": "rawData to set" - } - } - }, - "example": { - "state": "THREE", - "rawData": { - "randomValue": 0.3458795 - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "State FVE is invalid for node dice_1 on task 808aec38-3fb3-4163-a45e-1890e94081ea" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "post": { - "tags": [ - "Task Nodes" - ], - "operationId": "update_task_node_state", - "x-visibility": "deprecated", - "summary": "Set Current State", - "description": "Set the current state of the node.\n\nThis call is deprecated. Please use `PATCH /rules/v1/tasks/{taskId}/nodes/{nodeId}`\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=set-the-state" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/NodeId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/NodeCallsSpecification" - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/tasks/{taskId}/nodes/{nodeId}/states": { - "get": { - "tags": [ - "Task Nodes" - ], - "operationId": "getStates_task_node", - "x-visibility": "deprecated", - "summary": "Get Supported States", - "description": "Get the supported states of a node.\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=get-supported-states" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId" - }, - { - "$ref": "#/components/parameters/NodeId" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/templates": { - "post": { - "tags": [ - "Templates" - ], - "operationId": "create_template", - "summary": "Create Template", - "description": "Create a template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=create-a-new-template" - }, - "requestBody": { - "$ref": "#/components/requestBodies/TemplatesSpecification" - }, - "responses": { - "201": { - "$ref": "#/components/responses/TemplateCreatedResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "examples": { - "Duplicate name": { - "value": { - "statusCode": 400, - "error": "A template with name 'internet.json' already exists", - "code": "ERR_DUPLICATE_TEMPLATE_NAME" - } - }, - "Plugin not found": { - "value": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "get": { - "tags": [ - "Templates" - ], - "operationId": "list_templates", - "summary": "List Templates", - "description": "Query templates.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=list-all-templates" - }, - "parameters": [ - { - "$ref": "#/components/parameters/PagingHits" - }, - { - "$ref": "#/components/parameters/PagingStart" - }, - { - "name": "filter", - "description": "fuzzy search on multiple properties", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "ids", - "description": "comma separated string of template names", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "explode": false - }, - { - "name": "id", - "description": "filter on template name", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TemplateId" - } - }, - { - "name": "plugin", - "in": "query", - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "schema": { - "type": "string", - "example": "mySensor:1.0.3" - } - }, - { - "name": "tags.X", - "in": "query", - "schema": { - "type": "string", - "description": "String of form \"tags.: \".", - "example": "tags.myref: 3904859080956" - } - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of templates that fulfill the query.", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateEntityMetadata" - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "patch": { - "tags": [ - "Templates" - ], - "operationId": "upgradePlugins_templates", - "summary": "Upgrade Plugins", - "description": "Upgrade plugins on multiple templates.\n\nThe plugin upgrades specified in the body will be applied to all template that fullfil the query expresses by the query parameters.\nAt least one of the query parameters must be specified.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=modifying-existing-templates-batch", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "name": "ids", - "in": "query", - "description": "comma separated string of template names", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "explode": false - }, - { - "name": "id", - "in": "query", - "description": "filter on template name", - "schema": { - "$ref": "#/components/schemas/TemplateId" - } - }, - { - "name": "plugin", - "in": "query", - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "schema": { - "type": "string", - "example": { - "plugin": "mySensor:1.0.3" - } - } - }, - { - "name": "tags.X", - "in": "query", - "schema": { - "type": "string", - "description": "String of form \"tags.: \".", - "example": null - } - } - ], - "requestBody": { - "required": true, - "description": "Plugin Update Specifications", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateModification" - } - } - } - }, - "responses": { - "200": { - "description": "Successfully Updated", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "successful": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - } - } - } - } - } - }, - "400": { - "description": "Unsuccessful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "examples": { - "Partially applied": { - "value": { - "statusCode": 400, - "error": "Operation only partially applied", - "successful": [ - "internet.json" - ], - "failed": [ - { - "templateName": "fastInternet.json", - "error": "Node checkState_1 has timeout state ERRORED but it's sensor mySensor:2.4.13 has states [OK, NOK]" - } - ] - } - }, - "Plugin version does not exist": { - "value": { - "statusCode": 400, - "error": "mySensor:2.4.13 does not exist" - } - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/templates/{name}": { - "get": { - "tags": [ - "Templates" - ], - "operationId": "get_template", - "summary": "Retrieve Template Details", - "description": "Retrieve the details of a template.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=get-a-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId" - }, - { - "$ref": "#/components/parameters/Format" - } - ], - "responses": { - "200": { - "description": "Template Details", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "put": { - "tags": [ - "Templates" - ], - "operationId": "replace_template", - "summary": "Update Template", - "description": "Update a template. Note that this will not update any tasks using the template. You will need to do a batch reload operation on the tasks to accomplish that.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=update-a-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/TemplatesSpecification" - }, - "responses": { - "200": { - "description": "Template Updated", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/SimplifiedGraph" - } - ] - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "examples": { - "Changed name": { - "value": { - "statusCode": 400, - "error": "Path name and submitted template name don't match" - } - }, - "Plugin not found": { - "value": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "delete": { - "tags": [ - "Templates" - ], - "operationId": "delete_template", - "summary": "Delete Template", - "description": "Delete a template.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=delete-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId" - } - ], - "responses": { - "204": { - "description": "Template Deleted" - }, - "400": { - "description": "Template Still In Use", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Template with name internet.json in use by 6 task(s)" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/templates/{name}/run": { - "post": { - "tags": [ - "Template Runs" - ], - "operationId": "run_template", - "summary": "Run Template", - "description": "Run a template.\nIf `data` is specified, template will be run as reactive template. \nIf `data` is not specified, template will be run as a one-time template (1 tick)", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=running-a-template" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId" - }, - { - "$ref": "#/components/parameters/LogLevel" - }, - { - "$ref": "#/components/parameters/TargetNode" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/RunTemplateSpecification" - }, - "responses": { - "200": { - "description": "Stream Of Invocation Results", - "content": { - "application/x-ndjson": { - "schema": { - "$ref": "#/components/schemas/TemplateRunInvocation" - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Variable 'threshold' not found", - "code": "VALIDATION", - "details": [ - { - "type": "VARIABLE", - "message": "Variable 'threshold' not found", - "severity": "ERROR", - "details": { - "variable": "threshold" - } - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/templates/run": { - "post": { - "tags": [ - "Template Runs" - ], - "operationId": "runGraph", - "summary": "Run Graph Or Bayesian Network", - "description": "Run a graph or Bayesian Network.\nIf `data` is specified, template will be run as reactive template. \nIf `data` is not specified, template will be run as a one-time template (1 tick)", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=running-a-batch-dataset-through-a-graphbns" - }, - "parameters": [ - { - "$ref": "#/components/parameters/LogLevel" - }, - { - "$ref": "#/components/parameters/TargetNode" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/RunTemplateSpecificationGraph" - }, - "responses": { - "200": { - "description": "Stream Of Invocation Results", - "content": { - "application/x-ndjson": { - "schema": { - "$ref": "#/components/schemas/TemplateRunInvocation" - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/discoveryTemplate": { - "get": { - "tags": [ - "Templates" - ], - "operationId": "getDiscovery_template", - "summary": "Retrieve Discovery Template", - "description": "Get the discovery template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=discovery-template" - }, - "responses": { - "200": { - "description": "Discovery Template Details", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - }, - { - "type": "object", - "properties": { - "discoveryTemplate": { - "type": "boolean", - "example": true - } - } - } - ] - } - } - } - }, - "204": { - "description": "No Discovery Template" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - }, - "put": { - "tags": [ - "Templates" - ], - "operationId": "set_discovery_template", - "summary": "Set Discovery Template", - "description": "Set the discovery template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=set-the-discovery-template" - }, - "parameters": [ - { - "name": "name", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TemplateId" - }, - "example": "discoverResourceType", - "required": false, - "description": "The template to set as discovery template. If you do not specify this parameter, the current discovery template will be cleared." - } - ], - "responses": { - "200": { - "description": "Discovery Template Set", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "discoverResourceType" - }, - "discoveryTemplate": { - "type": "boolean", - "example": true - } - } - } - ] - } - } - } - }, - "204": { - "description": "Discovery Template Cleared" - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/batch": { - "post": { - "tags": [ - "Tasks Batch Operations" - ], - "operationId": "start_batch_operation", - "summary": "Start Batch Operations", - "description": "Start a batch operation.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations" - }, - "requestBody": { - "$ref": "#/components/requestBodies/BatchTasksSpecification" - }, - "responses": { - "202": { - "$ref": "#/components/responses/BatchStartResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "/action <- unknown action strt, we support updatePlugins, delete, start, restart, stop, reload" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/batch/{batchId}": { - "get": { - "tags": [ - "Tasks Batch Operations" - ], - "operationId": "get_batch_operation", - "summary": "Get Tasks Batch Operation Status", - "description": "Get the results of the Tasks Batch Operation.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations" - }, - "parameters": [ - { - "$ref": "#/components/parameters/BatchId" - } - ], - "responses": { - "200": { - "description": "Get Batch Operation", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/BatchOperationResult" - }, - { - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "title": "Result of a running Batch Operation" - } - ] - } - ] - }, - "examples": { - "Batch Operation still running": { - "value": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "task", - "action": "delete", - "description": "Remove tasks filtered by type=onetime AND status=stopped AND finishedBefore=1648738809733" - }, - "queueTime": 1663269720694 - } - }, - "Result of a finished Batch Operation": { - "value": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "task", - "action": "delete", - "description": "Remove tasks filtered by type=onetime AND status=stopped AND finishedBefore=1648738809733" - }, - "queueTime": 1663269720694, - "finishedTime": 1663269725784, - "results": { - "success": { - "4bbec310-4b8a-4f82-954d-f6268e7736a3": { - "statusCode": 200 - }, - "b637dc9c-b8fc-4d1e-8743-b1456364e559": { - "statusCode": 200 - } - }, - "failure": { - "0cf62e41-be40-42bf-a88f-6fc803bcb957": { - "statusCode": 404, - "error": "No task with id 0cf62e41-be40-42bf-a88f-6fc803bcb957" - } - } - } - } - } - } - } - } - }, - "404": { - "$ref": "#/components/responses/BatchNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/sensors/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeSensor", - "summary": "Execute Latest Sensor Version", - "description": "Execute latest version of a sensor.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-sensor" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 13 - }, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": false, - "error": "ReferenceError: callbackUrdl is not defined" - } - } - } - }, - "404": { - "description": "Sensor Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Sensor mySensor not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/sensors/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeSensorVersion", - "summary": "Execute Specified Sensor Version", - "description": "Execute the specified version of a sensor.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-sensor" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - }, - { - "$ref": "#/components/parameters/VersionId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 13 - }, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": false, - "error": "ReferenceError: callbackUrdl is not defined" - } - } - } - }, - "404": { - "description": "Sensor Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Sensor mySensor:3.14.5 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/actions/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeActuator", - "summary": "Execute Latest Actuator Version", - "description": "Execute latest version of an actuator.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-actuator" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Actuator Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Actuator myActuator not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/actions/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeActuatorVersion", - "summary": "Execute Specified Actuator Version", - "description": "Execute specified version of an actuator.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-actuator" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - }, - { - "$ref": "#/components/parameters/VersionId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Actuator Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Actuator myActuator:4.12.0 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/transformers/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeTransformer", - "summary": "Execute Latest Transformer Version", - "description": "Execute the latest transformer version.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-the-latest-transformer-version" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Transformer Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Transformer myTransformer not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/transformers/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeTransformerVersion", - "summary": "Execute Specified Transformer Version", - "description": "Execute specified version of a transformer.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-a-specific-transformer-version" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true - }, - { - "$ref": "#/components/parameters/VersionId" - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Transformer Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Transformer myTransformer:2.47.2 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - }, - "/rules/v1/data": { - "post": { - "tags": [ - "Push Data" - ], - "operationId": "push_data", - "summary": "Push Streaming Data", - "description": "Push (real-time) streaming data.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data" - }, - "requestBody": { - "$ref": "#/components/requestBodies/StreamData" - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Expecting json array or object" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ] - } - } - }, - "components": { - "schemas": { - "TaskId": { - "title": "Task identifier", - "description": "Unique task identifier", - "type": "string", - "example": "808aec38-3fb3-4163-a45e-1890e94081ea" - }, - "InvocationId": { - "title": "Invocation identifier", - "description": "Unique invocation identifier", - "type": "string", - "example": "45a85360-fe8a-4978-9636-90d741806033" - }, - "TemplateId": { - "title": "Template identifier", - "description": "Unique template identifier", - "type": "string", - "example": "internet.json" - }, - "LogLevel": { - "title": "Log Level", - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR", - "NONE" - ], - "example": "INFO" - }, - "ResourceId": { - "title": "Resource identifier", - "description": "Unique resource identifier", - "type": "string", - "example": "resource1" - }, - "ResourceTypeId": { - "title": "Resource Type identifier", - "description": "Unique resource type identifier", - "type": "string", - "example": "resourcetype1" - }, - "NodeId": { - "title": "Node label", - "description": "Unique node label", - "type": "string", - "example": "dice_1" - }, - "BatchId": { - "title": "Batch Operation id", - "type": "string", - "example": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "UnixEpochMillis": { - "type": "integer", - "title": "Unix Epoch Milliseconds", - "description": "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January 1970, \nnot counting leap seconds.", - "example": 1663269720694 - }, - "ISO8601Timestamp": { - "title": "ISO8601 timestamp", - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "VersionResponse": { - "type": "object", - "properties": { - "version": { - "type": "string", - "example": "5.12.1" - }, - "name": { - "type": "string", - "example": "waylay-engine" - }, - "startTime": { - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "uptime": { - "type": "integer", - "format": "int64", - "example": 12703737 - }, - "status": { - "type": "string", - "enum": [ - "STARTING", - "STARTED", - "FAILED" - ], - "example": "STARTED" - } - }, - "required": [ - "name", - "version", - "status" - ] - }, - "Position": { - "title": "Position ([X, Y] coordinates)", - "type": "array", - "minItems": 2, - "maxItems": 2, - "items": { - "type": "integer" - }, - "example": [ - 223, - 213 - ] - }, - "Version": { - "title": "Semantic version of a plug", - "type": "string", - "pattern": "\\d+\\.\\d+\\.\\d+", - "example": "2.4.13" - }, - "PluginUpdateSpec": { - "title": "Plugin Update Spec", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the plugin to update", - "example": "mySensor" - }, - "fromVersion": { - "description": "plugin version selection to upgrade", - "oneOf": [ - { - "$ref": "#/components/schemas/Version" - }, - { - "type": "string", - "title": "Any Version", - "enum": [ - "any" - ] - } - ], - "example": "any" - }, - "toVersion": { - "description": "Plugin version to upgrade to", - "allOf": [ - { - "$ref": "#/components/schemas/Version" - } - ] - } - }, - "required": [ - "name", - "fromVersion", - "toVersion" - ] - }, - "PropertyUpdatesSpec": { - "title": "Task properties Update Spec", - "type": "object", - "properties": { - "variables": { - "type": "object", - "description": "Set of variables to update. \nWill be merged with the current variables. \nTo delete any of the current variables (and fall back to the default value from the template) set the value to `null`" - }, - "tags": { - "type": "object", - "description": "Key-value pairs. \nWill be merged with the current tags. \nTo delete any of the current tags set the value to `null`" - } - }, - "anyOf": [ - { - "required": [ - "variables" - ] - }, - { - "required": [ - "tags" - ] - } - ] - }, - "TemplateModification": { - "title": "Templates Modification Specification", - "type": "object", - "properties": { - "operation": { - "type": "string", - "enum": [ - "updatePlugins" - ] - }, - "updates": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PluginUpdateSpec" - } - }, - "reloadTasks": { - "type": "boolean", - "description": "Should all tasks created from the template be reloaded", - "default": false, - "example": true - } - }, - "required": [ - "operation", - "updates" - ] - }, - "TemplateTags": { - "type": "object", - "description": "Key-value pairs on which you can filter to finding templates back", - "example": { - "useCase": "UC13.5" - } - }, - "TemplateEntityCommonAttributes": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TemplateId" - }, - "discoveryTemplate": { - "type": "boolean", - "description": "flag to indicate if the template is the discovery template", - "example": false - }, - "tags": { - "$ref": "#/components/schemas/TemplateTags" - }, - "variables": { - "description": "Variable declarations", - "type": "array", - "items": { - "$ref": "#/components/schemas/VariableDeclaration" - } - }, - "taskDefaults": { - "$ref": "#/components/schemas/TaskDefaultsElement" - }, - "notes": { - "description": "List of notes as explanation for users", - "type": "array", - "items": { - "$ref": "#/components/schemas/NoteElement" - } - } - }, - "required": [ - "name" - ] - }, - "TemplateEntity": { - "title": "Waylay Rule Template Specification", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityCommonAttributes" - }, - { - "$ref": "#/components/schemas/SimplifiedGraph" - } - ] - }, - "TemplateEntityMetadata": { - "title": "Waylay Template", - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityCommonAttributes" - }, - { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/TemplateUser" - }, - "createTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "lastUpdateTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "required": [ - "name", - "user", - "createTime", - "lastUpdateTime", - "discoveryTemplate" - ] - } - ] - }, - "SensorNode": { - "title": "Sensor node", - "required": [ - "label", - "name", - "version" - ], - "type": "object", - "properties": { - "label": { - "$ref": "#/components/schemas/NodeId" - }, - "name": { - "title": "Name of sensor", - "type": "string" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "properties": { - "title": "Key-value object of required properties", - "type": "object" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "sequence": { - "title": "Sequence number if omitted default is 1", - "type": "integer", - "default": 1 - }, - "position": { - "$ref": "#/components/schemas/Position" - }, - "dataTrigger": { - "title": "Boolean to indicate if sensor needs to be executed if data for `resource` is received", - "type": "boolean", - "default": true - }, - "tickTrigger": { - "title": "Boolean to indicate if sensor needs to be executed on task tick", - "type": "boolean", - "default": true - }, - "evictionTime": { - "title": "Time (in milliseconds) after which sensor goes back to default state", - "type": "integer", - "minimum": 0 - }, - "pollingPeriod": { - "title": "Time (in milliseconds) to give sensor it’s own tick", - "type": "integer", - "minimum": 1 - }, - "schedule": { - "title": "Schedule", - "type": "string", - "description": "Either a valid cron or RRule expression to set the sensor's own tick" - }, - "timeout": { - "title": "Time (in ISO 8601 duration format) before the plugin times out, defaults to PT50S (50 seconds)", - "type": "string", - "default": "PT50S" - }, - "timeoutState": { - "title": "State that will be returned as result if plug execution times out", - "type": "string" - }, - "loopDef": { - "title": "Loop definition", - "type": "string", - "minimum": 0, - "example": "[{\"name\": \"alpha\"}, {\"name\": \"beta\"}]", - "description": "A loop definition is a string that defines items over which node will be iterated multiple times. \nThe string is an JSON array of JSON objects.During template execution the sensor node with such \na defined loop definition will be invoked for every JSON Object in the JSON array.\nParameter is optional. Node will be executed only once if loop definition is not defined." - } - }, - "additionalProperties": false, - "description": "Representation of a sensor in a Rule Template.", - "example": { - "label": "dice_1", - "name": "dice", - "version": "1.0.9", - "position": [ - 100, - 150 - ], - "dataTrigger": false, - "tickTrigger": true, - "timeout": "PT5S" - } - }, - "ActuatorNode": { - "title": "Actuator node", - "required": [ - "label", - "name", - "version" - ], - "type": "object", - "properties": { - "label": { - "$ref": "#/components/schemas/NodeId" - }, - "name": { - "title": "Name of actuator", - "type": "string" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "properties": { - "title": "Key-value object of required properties", - "type": "object" - }, - "sequence": { - "title": "Sequence", - "type": "integer" - }, - "position": { - "$ref": "#/components/schemas/Position" - }, - "timeout": { - "title": "Time (in ISO 8601 duration format) before the plugin times out, defaults to PT50S (50 seconds)", - "type": "string", - "default": "PT50S" - } - }, - "additionalProperties": false, - "description": "Representation of an actuator in a Rule Template.", - "example": { - "label": "debugDialog_1", - "name": "debugDialog", - "version": "1.0.0", - "properties": { - "message": "Dice 1 has value ONE" - }, - "position": [ - 827, - 323 - ] - } - }, - "RelationNode": { - "title": "Gate node", - "required": [ - "label", - "type", - "parentLabels", - "combinations" - ], - "type": "object", - "properties": { - "label": { - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ], - "example": "AND_1" - }, - "type": { - "$ref": "#/components/schemas/GateType" - }, - "parentLabels": { - "title": "Labels of the sensors that are attached to this gate", - "type": "array", - "items": { - "$ref": "#/components/schemas/NodeId" - }, - "example": [ - "dice_1", - "dice_2" - ] - }, - "combinations": { - "title": "Combinations of connected sensor's states", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string", - "description": "State of one of the connected sensors" - }, - "example": [ - "ONE", - "TWO" - ] - } - }, - "position": { - "$ref": "#/components/schemas/Position" - } - }, - "additionalProperties": false, - "description": "Representation of a gate in a Rule Template." - }, - "GateType": { - "title": "Gate Type", - "enum": [ - "AND", - "OR", - "GENERAL", - "NAND" - ], - "type": "string", - "description": "Supported gate types." - }, - "GenericTrigger": { - "type": "object", - "properties": { - "sourceLabel": { - "title": "Label of source sensor or gate", - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ] - }, - "destinationLabel": { - "title": "Label of the destination sensor or actuator", - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ] - }, - "invocationPolicy": { - "title": "Time (in seconds) that defines how long to wait before firing the same actuator again, even if the condition is met.", - "type": "integer", - "minimum": 1 - } - } - }, - "TriggerStateChange": { - "title": "TriggerStateChange", - "required": [ - "stateFrom", - "stateTo" - ], - "type": "object", - "properties": { - "stateFrom": { - "title": "State from which to trigger, or '*'", - "type": "string" - }, - "stateTo": { - "title": "State to, or '*'", - "type": "string" - } - }, - "description": "State change specification under which to trigger the next node." - }, - "StateChangeTrigger": { - "title": "State Change Trigger", - "description": "A trigger that executes on state change.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "properties": { - "stateChangeTrigger": { - "$ref": "#/components/schemas/TriggerStateChange" - } - }, - "required": [ - "sourceLabel", - "destinationLabel", - "stateChangeTrigger" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_1", - "stateChangeTrigger": { - "stateFrom": "FALSE", - "stateTo": "*" - } - } - }, - "StatesTrigger": { - "title": "States trigger", - "description": "A trigger that is conditional on the states of the source.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "properties": { - "statesTrigger": { - "type": "array", - "description": "array of states of source node under which to fire", - "items": { - "type": "string" - } - } - }, - "required": [ - "sourceLabel", - "destinationLabel", - "statesTrigger" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_2", - "statesTrigger": [ - "TRUE" - ] - } - }, - "ExecutionTrigger": { - "title": "Execution Trigger", - "description": "A trigger that always executes on successful execution of the source.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "type": "object", - "required": [ - "sourceLabel", - "destinationLabel" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_3" - } - }, - "NoteElement": { - "title": "User Note", - "required": [ - "text", - "position" - ], - "type": "object", - "properties": { - "position": { - "$ref": "#/components/schemas/Position" - }, - "text": { - "title": "Text", - "type": "string", - "example": "Example template having some sensors and gates" - } - }, - "additionalProperties": false, - "description": "Representation of a note in a Rule Template." - }, - "VariableDeclaration": { - "title": "Declaration of a variable", - "description": "Variable declaration.", - "required": [ - "name", - "type" - ], - "type": "object", - "properties": { - "name": { - "description": "Variable Name", - "type": "string" - }, - "displayName": { - "description": "Display name. Will default to the name if not specified", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/VariableType" - }, - "format": { - "$ref": "#/components/schemas/VariableFormat" - }, - "mandatory": { - "description": "flag to indicate if value for variable is mandatory or not", - "type": "boolean", - "default": false - }, - "defaultValue": { - "description": "Default value for the variable", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "object" - } - ] - } - }, - "example": { - "name": "city", - "displayName": "City", - "type": "string", - "mandatory": true - } - }, - "VariableFormat": { - "title": "Variable format", - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "title": "Type", - "type": "string", - "example": "resource" - }, - "values": { - "title": "Possible values (enum declaration)", - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "object" - } - ] - } - } - }, - "description": "Format for a variable definition." - }, - "VariableType": { - "title": "VariableType", - "enum": [ - "string", - "boolean", - "integer", - "double", - "long", - "float", - "object" - ], - "type": "string", - "description": "Value type for a template variable." - }, - "TaskDefaultsElement": { - "title": "Task defaults", - "description": "default task settings that will be applied when creating a task from the template", - "type": "object", - "properties": { - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - }, - "type": { - "$ref": "#/components/schemas/TaskScenarioType" - }, - "resetObservations": { - "type": "boolean" - }, - "parallel": { - "type": "boolean" - }, - "gatesNeedFullObservation": { - "type": "boolean" - }, - "cron": { - "$ref": "#/components/schemas/CronExpression" - }, - "rrule": { - "$ref": "#/components/schemas/RRuleExpression" - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZoneId" - }, - "frequency": { - "description": "polling frequency in milliseconds", - "type": "integer" - } - }, - "example": { - "type": "periodic", - "frequency": 900000, - "resetObservations": false - } - }, - "TaskScenarioType": { - "title": "TaskScenarioType", - "enum": [ - "scheduled", - "periodic", - "onetime", - "reactive" - ], - "type": "string", - "description": "Triggering deployment scenario for a task." - }, - "TaskStatus": { - "title": "Task status", - "type": "string", - "enum": [ - "running", - "stopped", - "failed" - ], - "description": "Status of a task" - }, - "TemplateRunWithGraphSpecification": { - "title": "Specification to run template specifying the actual graph", - "allOf": [ - { - "$ref": "#/components/schemas/TemplateRunSpecification" - }, - { - "type": "object", - "properties": { - "graph": { - "$ref": "#/components/schemas/GraphDefinition" - } - }, - "required": [ - "graph" - ] - } - ] - }, - "ResourceDataInjection": { - "title": "Resource Data Injection", - "type": "object", - "description": "data to inject per resource", - "properties": { - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "timestamp": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "additionalProperties": true, - "required": [ - "resource" - ] - }, - "TemplateRunConfiguration": { - "title": "Template Run Configuration", - "type": "object", - "description": "Template run configurations", - "properties": { - "executeActuators": { - "type": "boolean", - "description": "Flag to trigger actual execution of actuators", - "default": false - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "resetObservations": { - "type": "boolean", - "description": "reset observations before injecting data", - "default": true - }, - "gatesNeedFullObservation": { - "type": "boolean", - "description": "Only evaluate gates when all inputs are observed", - "default": false - } - } - }, - "TemplateRunSpecification": { - "title": "Specification to run template", - "type": "object", - "properties": { - "data": { - "title": "Data Set", - "description": "The full dataset to process. If specified, template will be run as reactive template", - "type": "array", - "items": { - "type": "array", - "title": "Dataset For One Invocation", - "description": "dataset that will be processed by one invocation", - "items": { - "$ref": "#/components/schemas/ResourceDataInjection" - } - }, - "example": [ - [ - { - "resource": "resource1", - "temperature": 20 - }, - { - "resource": "resource2", - "co2": 100, - "humidity": 0.4 - } - ], - [ - { - "resource": "resource1", - "temperature": 21 - } - ] - ] - }, - "conf": { - "$ref": "#/components/schemas/TemplateRunConfiguration" - }, - "variables": { - "title": "Template variables", - "description": "The values for the variables declared in the template", - "type": "object", - "example": { - "threshold": 13 - } - }, - "resourceMetaData": { - "title": "Resource Metadata", - "description": "Metadata for any of the resources used in the template.\n\nThe current metadata for all resources used in the template is fetched at the start of the template run.\nThis provided metadata is used to overwrite this current metadata", - "type": "object", - "additionalProperties": { - "type": "object" - }, - "example": { - "resource1": { - "name": "outside_temperature", - "inside_sensor": { - "$$ref": "/resources/resource2" - } - } - } - } - } - }, - "SensorExecutionResult": { - "title": "Sensor execution result", - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the sensor was successfully executed" - }, - "state": { - "type": "string", - "description": "observedState field returned by the sensor execution" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "rawData": { - "type": "object", - "description": "the rawData returned by the sensor execution" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "TemplateRunSensorResult": { - "allOf": [ - { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - { - "type": "object", - "properties": { - "executed": { - "type": "boolean", - "description": "flag indicating if the sensor was executed" - } - }, - "required": [ - "executed" - ] - } - ] - }, - "ActuatorExecutionResult": { - "title": "Actuator execution result", - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the actuator was successfully executed" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "rawData": { - "type": "object" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "TemplateRunActuatorResult": { - "allOf": [ - { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - { - "type": "object", - "properties": { - "executed": { - "type": "boolean", - "description": "flag indicating if the actuator was executed" - } - }, - "required": [ - "executed" - ] - } - ] - }, - "TemplateRunInvocation": { - "type": "object", - "properties": { - "taskId": { - "$ref": "#/components/schemas/TaskId" - }, - "invocationId": { - "$ref": "#/components/schemas/InvocationId" - }, - "sensors": { - "title": "Sensors Results", - "description": "The execution result for each of the sensors of the template", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/TemplateRunSensorResult" - }, - "example": { - "alarm": { - "executed": true, - "result": true, - "state": "OK", - "rawData": {}, - "log": [] - }, - "streamingDataSensor": { - "executed": true, - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 20 - } - } - } - }, - "actuators": { - "title": "Actuator Results", - "description": "The execution result for each of the actuators of the template", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/TemplateRunActuatorResult" - }, - "example": { - "send_sms": { - "executed": true, - "result": true, - "log": [] - } - } - }, - "log": { - "title": "Logs", - "type": "array", - "items": { - "type": "object", - "properties": { - "time": { - "$ref": "#/components/schemas/ISO8601Timestamp" - }, - "level": { - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR" - ], - "example": "INFO" - }, - "message": { - "type": "string", - "example": "SMS sent" - } - }, - "additionalProperties": false, - "required": [ - "time", - "level", - "message" - ] - } - } - }, - "required": [ - "taskId", - "invocationId", - "sensors", - "actuators", - "log" - ] - }, - "TransformerExecutionResult": { - "title": "Transformer execution result", - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the actuator was Successfully Executed" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "data": { - "type": "object" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "ExecutePlugsSpecification": { - "title": "Specification to execute a plug", - "type": "object", - "properties": { - "properties": { - "title": "specific input parameters", - "type": "object", - "example": { - "threshold": 20 - } - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "streamData": { - "title": "Stream data", - "type": "object", - "example": { - "temperature": 21, - "timestamp": 1582988389 - } - } - } - }, - "BatchIdQuery": { - "title": "By Ids", - "type": "object", - "properties": { - "ids": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskId" - } - } - }, - "required": [ - "ids" - ] - }, - "BatchQuery": { - "title": "By Query", - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "type": { - "$ref": "#/components/schemas/TaskScenarioType" - }, - "status": { - "$ref": "#/components/schemas/TaskStatus" - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - }, - "plugin": { - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "type": "string", - "example": "mySensor:1.0.3" - }, - "user": { - "$ref": "#/components/schemas/TaskUser" - }, - "finishedBefore": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "createdAfter": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "createdBefore": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - } - } - }, - "BatchTask": { - "type": "object", - "properties": { - "entity": { - "type": "string", - "enum": [ - "task" - ] - }, - "action": { - "type": "string" - }, - "query": { - "oneOf": [ - { - "$ref": "#/components/schemas/BatchIdQuery" - }, - { - "$ref": "#/components/schemas/BatchQuery" - } - ] - } - } - }, - "BatchTaskCommand": { - "title": "Execute Command", - "description": "Execute command on multiple task", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "enum": [ - "delete", - "start", - "restart", - "stop", - "reload", - "stopAndDelete" - ] - } - }, - "required": [ - "entity", - "action", - "query" - ] - } - ] - }, - "BatchUpdatePlugin": { - "title": "Update plugins", - "description": "Upgrade plugins on multiple tasks", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "type": "string", - "enum": [ - "updatePlugins" - ] - }, - "actionParameters": { - "$ref": "#/components/schemas/PluginUpdateSpec" - } - }, - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - } - ] - }, - "BatchUpdateProperties": { - "title": "Update task properties", - "description": "Update variables and/or tags of multiple tasks", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "type": "string", - "enum": [ - "updateProperties" - ] - }, - "actionParameters": { - "$ref": "#/components/schemas/PropertyUpdatesSpec" - } - }, - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - } - ] - }, - "BatchOperation": { - "title": "Batch Operation", - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "user": { - "type": "string", - "description": "User id of the user who started the operation", - "example": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe" - }, - "operation": { - "type": "object", - "description": "Summary of the batch operation", - "properties": { - "entity": { - "type": "string", - "enum": [ - "task" - ] - }, - "action": { - "type": "string", - "enum": [ - "updatePlugins", - "delete", - "start", - "restart", - "stop", - "reload", - "updateProperties" - ], - "example": "delete" - }, - "description": { - "type": "string", - "description": "description of the operations", - "example": "Remove tasks filtered by ids=808aec38-3fb3-4163-a45e-1890e94081ea" - } - }, - "required": [ - "entity", - "action", - "description" - ] - }, - "queueTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "required": [ - "id", - "user", - "operation", - "queueTime" - ] - }, - "SuccessOperationResult": { - "type": "object", - "description": "Object containing the successful operation results. \nThe keys will be task ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be task ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - } - }, - "required": [ - "statusCode" - ] - } - }, - "FailureOperationResult": { - "type": "object", - "description": "Object containing the unsuccessful operation results. \nThe keys will be tasks ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be task ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - }, - "error": { - "type": "string", - "description": "Error description of what went wrong." - } - }, - "required": [ - "statusCode", - "error" - ] - } - }, - "OperationResultObject": { - "description": "Finished Batch Operation results", - "type": "object", - "properties": { - "finishedTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "results": { - "type": "object", - "properties": { - "success": { - "$ref": "#/components/schemas/SuccessOperationResult" - }, - "failure": { - "$ref": "#/components/schemas/FailureOperationResult" - } - }, - "required": [ - "success", - "failure" - ] - } - }, - "required": [ - "finishedTime", - "results" - ] - }, - "BatchOperationResult": { - "title": "Result of a finished Batch Operation", - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "$ref": "#/components/schemas/OperationResultObject" - } - ] - }, - "TaskFromTemplate": { - "title": "Task with rule defined in template", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/TaskSettings" - }, - { - "properties": { - "start": { - "title": "boolean to indicate whether task must be started after creation", - "type": "boolean", - "default": true - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "required": [ - "template", - "name" - ] - } - ] - }, - "SimplifiedGraph": { - "title": "Simplified Graph", - "description": "Graph in simplified format", - "type": "object", - "properties": { - "sensors": { - "description": "List of sensors with required properties", - "type": "array", - "items": { - "$ref": "#/components/schemas/SensorNode" - } - }, - "actuators": { - "description": "List of actuators with required properties", - "type": "array", - "items": { - "$ref": "#/components/schemas/ActuatorNode" - } - }, - "relations": { - "description": "List of relations (gates) between sensors", - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationNode" - } - }, - "triggers": { - "description": "List of conditions under which actuators/sensors get executed.", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/StateChangeTrigger" - }, - { - "$ref": "#/components/schemas/StatesTrigger" - }, - { - "$ref": "#/components/schemas/ExecutionTrigger" - } - ] - } - } - } - }, - "BayesianGraph": { - "title": "Bayesian Network", - "description": "Graph in BN format", - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "type": "object" - } - }, - "posterior": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "GraphDefinition": { - "title": "Graph", - "oneOf": [ - { - "$ref": "#/components/schemas/SimplifiedGraph" - }, - { - "$ref": "#/components/schemas/BayesianGraph" - } - ] - }, - "TaskWithRule": { - "title": "Task with rule defined in request", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/SimplifiedGraph" - }, - { - "properties": { - "notes": { - "title": "List of notes as explanation for users", - "type": "array", - "items": { - "$ref": "#/components/schemas/NoteElement" - } - }, - "task": { - "allOf": [ - { - "$ref": "#/components/schemas/TaskSettings" - }, - { - "type": "object", - "properties": { - "start": { - "title": "boolean to indicate whether task must be started after creation", - "type": "boolean", - "default": true - } - }, - "required": [ - "name" - ] - } - ] - } - }, - "required": [ - "task" - ] - } - ] - }, - "PeriodicTaskSetting": { - "title": "Task settings for periodic tasks", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "periodic" - ] - }, - "frequency": { - "type": "integer", - "description": "polling frequency in milliseconds", - "example": 900000 - } - }, - "required": [ - "type", - "frequency" - ] - }, - "TimeZoneId": { - "title": "Timezone Id", - "type": "string", - "description": "Optional identifier of the time zone in which the schedule expression is to be interpreted", - "example": "Europe/Brussels" - }, - "RRuleExpression": { - "type": "string", - "title": "RRule based", - "description": "RRule expression as defined in [RFC5545 3.8.5.3](https://www.rfc-editor.org/rfc/rfc5545#section-3.8.5.3)", - "example": "FREQ=MINUTELY;INTERVAL=15" - }, - "CronExpression": { - "type": "string", - "title": "cron based", - "description": "cron expression as defined in [Cron format](https://www.quartz-scheduler.org/documentation/quartz-1.8.6/tutorials/TutorialLesson06)", - "example": "15 * * * * ?" - }, - "ScheduledTaskSetting": { - "title": "Task settings for scheduled tasks", - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "type": "string", - "enum": [ - "scheduled" - ] - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZoneId" - } - }, - "required": [ - "type" - ] - }, - { - "oneOf": [ - { - "properties": { - "rrule": { - "$ref": "#/components/schemas/RRuleExpression" - } - }, - "required": [ - "rrule" - ] - }, - { - "properties": { - "cron": { - "$ref": "#/components/schemas/CronExpression" - } - }, - "required": [ - "cron" - ] - } - ] - } - ] - }, - "OneTimeTaskSetting": { - "title": "Task settings for onetime tasks", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "onetime" - ] - } - }, - "required": [ - "type" - ] - }, - "ReactiveTaskSetting": { - "title": "Task settings for reactive tasks", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "reactive" - ] - } - }, - "required": [ - "type" - ] - }, - "TaskTypeSettings": { - "title": "Task type related settings", - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/ScheduledTaskSetting" - }, - { - "$ref": "#/components/schemas/PeriodicTaskSetting" - }, - { - "$ref": "#/components/schemas/OneTimeTaskSetting" - }, - { - "$ref": "#/components/schemas/ReactiveTaskSetting" - } - ] - }, - "VariablesTaskObject": { - "type": "object", - "description": "set of variables which will be used when starting a task and will automatically be injected in the template before starting a task.", - "example": { - "email": "foo@gmail.com" - } - }, - "TagsTaskObject": { - "type": "object", - "description": "Key-value pairs on which you can set at task creation and later filter tasks", - "example": { - "myRef": "d8933cd4-7c70-11e9-8f9e-2a86e4085a59" - } - }, - "TaskName": { - "title": "Task Name", - "type": "string", - "example": "Example task 1" - }, - "GenericTaskSettings": { - "title": "Task related settings", - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "resetObservations": { - "title": "whether to clear observations before next invocation", - "type": "boolean", - "default": true - }, - "parallel": { - "title": "whether to run sensors in parallel or sequentially", - "type": "boolean", - "default": true - }, - "gatesNeedFullObservation": { - "title": "Only evaluate gates when all inputs are observed", - "type": "boolean", - "default": false - }, - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - }, - "variables": { - "$ref": "#/components/schemas/VariablesTaskObject" - } - } - }, - "TaskSettings": { - "title": "Task related settings", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTaskSettings" - }, - { - "$ref": "#/components/schemas/TaskTypeSettings" - } - ] - }, - "ValidationIssue": { - "title": "Validation Issue", - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Indication of \"area\" where validation issue is situated", - "example": "BINDING" - }, - "message": { - "description": "Description of the issue", - "type": "string", - "example": "rawData fas no field status" - }, - "severity": { - "type": "string", - "description": "Severity of the issue. ERROR means that object cannot be created if the issue is not fixed. WARNING means that the object can be created, but that errors might be encountered at runtime", - "enum": [ - "ERROR", - "WARNING" - ], - "example": "WARNING" - }, - "details": { - "type": "object", - "description": "Object containing identifying information on what gives the issue", - "example": { - "nodeId": "debugDialog_1", - "property": "message", - "binding": "${nodes.dice_1.rawData.status}" - } - }, - "suggestion": { - "type": "string", - "description": "Suggestion on how to change the object to get the issue fixed", - "example": "maybe you are looking for one of these: state, randomValue" - } - }, - "required": [ - "type", - "message", - "severity" - ] - }, - "ErrorResponse": { - "title": "Error Response", - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 400 - }, - "error": { - "type": "string" - }, - "code": { - "type": "string", - "description": "Optional error code" - } - }, - "required": [ - "statusCode", - "error" - ] - }, - "ErrorWithDetailsResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorResponse" - }, - { - "properties": { - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ValidationIssue" - } - } - } - } - ] - }, - "PagingSkip": { - "type": "integer", - "title": "Skipped Count", - "description": "Number of items skipped before this page of results.", - "default": 0, - "example": 85 - }, - "PagingLimit": { - "type": "integer", - "title": "Limit Count", - "description": "Size of one page of results.", - "example": 10, - "default": 10 - }, - "PagingTotal": { - "type": "integer", - "title": "Total Count", - "description": "Total number of items matching the query of which this is one page of results.", - "example": 2398 - }, - "PagingResult": { - "type": "object", - "properties": { - "skip": { - "$ref": "#/components/schemas/PagingSkip" - }, - "limit": { - "$ref": "#/components/schemas/PagingLimit" - }, - "total": { - "$ref": "#/components/schemas/PagingTotal" - } - }, - "required": [ - "skip", - "limit", - "total" - ] - }, - "TaskUser": { - "type": "string", - "description": "Creation user mail address or 'system' for system generated tasks", - "example": "user@waylay.io" - }, - "TemplateUser": { - "type": "string", - "description": "Creation user mail address", - "example": "user@waylay.io" - }, - "TaskResourceIds": { - "description": "List of resources that are used in the task", - "type": "array", - "items": { - "$ref": "#/components/schemas/ResourceId" - } - }, - "TaskEntity": { - "type": "object", - "properties": { - "ID": { - "$ref": "#/components/schemas/TaskId" - }, - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "status": { - "$ref": "#/components/schemas/TaskStatus" - }, - "user": { - "$ref": "#/components/schemas/TaskUser" - }, - "createTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - }, - "network": { - "description": "The graph, either from the template or from the task definition. Depending on the `format` query parameter either BN or simplified format", - "type": "object" - }, - "resourceIds": { - "$ref": "#/components/schemas/TaskResourceIds" - } - }, - "required": [ - "ID", - "status", - "user", - "createTime", - "name", - "network" - ] - }, - "TaskSpecification": { - "title": "a task specification", - "oneOf": [ - { - "$ref": "#/components/schemas/TaskFromTemplate" - }, - { - "$ref": "#/components/schemas/TaskWithRule" - } - ] - } - }, - "requestBodies": { - "TaskSpecification": { - "description": "Task Specification", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskSpecification" - } - } - }, - "required": true - }, - "BatchTasksSpecification": { - "description": "Tasks Batch Operation", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "a tasks batch operation specification", - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/BatchUpdatePlugin" - }, - { - "$ref": "#/components/schemas/BatchTaskCommand" - }, - { - "$ref": "#/components/schemas/BatchUpdateProperties" - } - ] - }, - "examples": { - "Delete multiple tasks by query": { - "value": { - "entity": "task", - "action": "delete", - "query": { - "type": "onetime", - "status": "stopped", - "finishedBefore": 1648738809733 - } - } - }, - "Delete multiple tasks by id": { - "value": { - "entity": "task", - "action": "delete", - "query": { - "ids": [ - "4bbec310-4b8a-4f82-954d-f6268e7736a3", - "b637dc9c-b8fc-4d1e-8743-b1456364e559", - "0cf62e41-be40-42bf-a88f-6fc803bcb957" - ] - } - } - }, - "Stop all task running for resource myResource": { - "value": { - "entity": "task", - "action": "stop", - "query": { - "status": "running", - "resource": "myResource" - } - } - }, - "Plugin updates": { - "value": { - "entity": "task", - "action": "updatePlugins", - "query": { - "ids": [ - "4bbec310-4b8a-4f82-954d-f6268e7736a3", - "b637dc9c-b8fc-4d1e-8743-b1456364e559", - "0cf62e41-be40-42bf-a88f-6fc803bcb957" - ] - }, - "actionParameters": { - "updates": [ - { - "name": "myActuator", - "fromVersion": "1.0.1", - "toVersion": "1.0.3" - }, - { - "name": "mySensor", - "fromVersion": "any", - "toVersion": "2.3.4" - } - ] - } - } - }, - "Properties update": { - "value": { - "entity": "task", - "action": "updateProperties", - "query": { - "status": "running", - "template": "myChangedTemplate", - "tags": { - "revision": 57 - } - }, - "actionParameters": { - "variables": { - "variableWithDefault": null, - "newVariable": 13 - }, - "tags": { - "revision": 58, - "dummyTag": null, - "newTag": "released" - } - } - } - } - } - } - } - }, - "TemplatesSpecification": { - "description": "Template Specification", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateEntity" - } - } - }, - "required": true - }, - "RunTemplateSpecification": { - "description": "Specification to run template", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateRunSpecification" - } - } - } - }, - "RunTemplateSpecificationGraph": { - "description": "Specification to run template through graph/BN.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateRunWithGraphSpecification" - } - } - } - }, - "ExecutePlugsSpecification": { - "description": "Specification to execute a plug.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ExecutePlugsSpecification" - } - } - } - }, - "NodeCallsSpecification": { - "description": "Command string to apply to a node of a task.", - "required": true, - "content": { - "text/plain": { - "schema": { - "type": "string", - "anyOf": [ - { - "pattern": "^state=", - "description": "State update command" - }, - { - "pattern": "^operation=", - "description": "Operation command" - } - ] - }, - "example": "state=Alive" - } - } - }, - "StreamData": { - "description": "Push (real-time) Data Specification", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "stream data", - "type": "object", - "properties": { - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "data": { - "oneOf": [ - { - "type": "object", - "example": { - "parameterName": "temperature", - "value": 23, - "collectedTime": 1420629467 - } - }, - { - "type": "array", - "items": { - "type": "object" - }, - "example": [ - { - "parameterName": "latitude", - "value": 51 - }, - { - "parameterName": "longitude", - "value": 3.73 - } - ] - } - ] - } - }, - "required": [ - "resource", - "data" - ] - } - } - } - } - }, - "parameters": { - "TaskId": { - "name": "taskId", - "in": "path", - "description": "Unique Task identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/TaskId" - } - }, - "TemplateId": { - "name": "name", - "in": "path", - "description": "Unique Template identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "LogLevel": { - "name": "logLevel", - "in": "query", - "description": "sets the log level for filtering out logs to requested log level or higher from the template run output.\nValue `NONE` will disable all logs.\nIf not specified all logs will be returned.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR" - ], - "default": "DEBUG" - } - }, - "TargetNode": { - "name": "targetNode", - "in": "query", - "description": "The sensors and actuators part of response will contain only elements related to the asked node of the graph. \nThe returned logs also will be filtered and contain only logs related to the asked node(s).", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string", - "example": "myFirstNode" - } - } - }, - "NodeId": { - "name": "nodeId", - "in": "path", - "description": "Unique node label", - "required": true, - "schema": { - "$ref": "#/components/schemas/NodeId" - } - }, - "BatchId": { - "name": "batchId", - "in": "path", - "description": "Unique Batch Operation identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/BatchId" - } - }, - "VersionId": { - "name": "version", - "in": "path", - "description": "Version number of plugin", - "required": true, - "schema": { - "$ref": "#/components/schemas/Version" - } - }, - "PagingHits": { - "name": "hits", - "in": "query", - "description": "(Paging) maximal number of items returned", - "schema": { - "$ref": "#/components/schemas/PagingLimit" - } - }, - "PagingStart": { - "name": "startIndex", - "in": "query", - "description": "(Paging) items to skip in the listing", - "schema": { - "$ref": "#/components/schemas/PagingSkip" - } - }, - "Format": { - "name": "format", - "in": "query", - "description": "Format of the graph definition", - "schema": { - "type": "string", - "enum": [ - "bn", - "simplified" - ], - "default": "bn" - } - } - }, - "responses": { - "DefaultSuccessResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "VersionResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionResponse" - } - } - } - }, - "TaskCreatedResponse": { - "description": "Task Created", - "headers": { - "Location": { - "description": "URI where the created Task can be fetched", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "ID": { - "$ref": "#/components/schemas/TaskId" - }, - "warnings": { - "type": "array", - "description": "List of task warning issues. Will only be there if query parameter `returnWarnings` was set to `true`", - "items": { - "$ref": "#/components/schemas/ValidationIssue" - } - } - }, - "required": [ - "ID" - ] - } - } - } - }, - "TaskNotFoundResponse": { - "description": "Task Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Task with id de1b26b1-31f0-4054-af44-da02331f06b5 not found" - } - } - } - }, - "TemplateCreatedResponse": { - "description": "Template Created", - "headers": { - "Location": { - "description": "URI where the created Template can be fetched", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 201 - }, - "uri": { - "type": "string", - "format": "uri", - "example": "/rules/v1/templates/internet.json" - }, - "entity": { - "$ref": "#/components/schemas/TemplateEntity" - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - } - }, - "TemplateNotFoundResponse": { - "description": "Template Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "No template with name theInternet.json" - } - } - } - }, - "BatchStartResponse": { - "description": "Batch Operation Started", - "content": { - "application/json": { - "schema": { - "title": "Batch operation enqueued", - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 202 - }, - "uri": { - "type": "string", - "description": "URI where the batch operation status can be followed", - "format": "uri", - "example": "/rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "entity": { - "$ref": "#/components/schemas/BatchOperation" - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - }, - "headers": { - "Location": { - "description": "URI where the batch operation status can be followed", - "example": "/rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "schema": { - "type": "string", - "format": "uri" - } - } - } - }, - "BatchNotFoundResponse": { - "description": "Batch Operation Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "No batch operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d'" - } - } - } - } - }, - "securitySchemes": { - "waylayApiKeySecret": { - "type": "http", - "description": "Waylay apiKey/apiSecret basic authentication. All endpoints support also Waylay JWT Bearer authentication.", - "scheme": "basic" - } - } - }, - "servers": [ - { - "url": "https://api.waylay.io", - "description": "Waylay enterprise gateway" - } - ] -} - diff --git a/test/_run/openapi/rules.transformed.openapi.yaml b/test/_run/openapi/rules.transformed.openapi.yaml deleted file mode 100644 index d82fb90..0000000 --- a/test/_run/openapi/rules.transformed.openapi.yaml +++ /dev/null @@ -1,3405 +0,0 @@ -openapi: 3.0.3 -info: - title: Waylay rules engine - version: 6.5.0 - description: The REST api to manage rule tasks and rule templates in the Waylay platform. -externalDocs: - url: https://docs.waylay.io/#/api/rules/ - description: Waylay Documentation -tags: - - name: Tasks - description: Manage Waylay Tasks - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=task - description: Waylay Documentation - - name: Task Nodes - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=node-related-calls - description: Waylay Documentation - - name: Templates - description: Manage Waylay Rule Templates - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=templates - description: Waylay Documentation - - name: Template Runs - description: Running a template over a data set or once (with 1 tick) - externalDocs: - url: https://docs.waylay.io/#/features/rules/?id=bulk-data-processing - description: Waylay Documentation - - name: Tasks Batch Operations - description: >- - Batch operations on multiple Tasks. Batch operations are executed - asynchronously. - - Creating a batch operation will return an url which you can use to - retrieve the status and the results of the operation. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - description: Waylay Documentation - - name: Version - - name: Plugs Execution - - name: Push Data - description: Inject streaming data in tasks - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data - description: Waylay Documentation -paths: - /rules/v1: - get: - summary: Get Version - operationId: get_version - tags: - - Version - description: Get the status and version of the service. - responses: - '200': - $ref: '#/components/responses/VersionResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks: - post: - tags: - - Tasks - operationId: create_task - summary: Create Task - description: Create a new task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=create-a-task - requestBody: - $ref: '#/components/requestBodies/TaskSpecification' - parameters: - - name: failOnWarning - in: query - description: >- - If `true` and there are task warnings, the response will be a `400 - Validation failed` - schema: - type: boolean - default: false - x-showExample: true - - name: returnWarnings - in: query - description: >- - If `true`, result body will contain a list of task warnings that - where detected - schema: - type: boolean - default: false - x-showExample: true - responses: - '201': - $ref: '#/components/responses/TaskCreatedResponse' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: >- - Binding error at SensorLocation(debugDialog_1)/message/binding - '${nodes.dice_1.rawData.status}' : rawData has no field status - code: VALIDATION - details: - - type: BINDING - message: rawData has no field status - severity: WARNING - details: - nodeId: debugDialog_1 - property: message - binding: ${nodes.dice_1.rawData.status} - suggestion: 'maybe you are looking for one of these: state, randomValue' - security: - - waylayApiKeySecret: [] - x-py-method: create - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - get: - tags: - - Tasks - operationId: list_tasks - summary: Query Multiple Tasks - description: Query multiple tasks. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=query-multiple-tasks - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/PagingHits' - x-showExample: false - - $ref: '#/components/parameters/PagingStart' - x-showExample: false - - $ref: '#/components/parameters/Format' - x-showExample: false - - name: name - in: query - schema: - type: string - x-showExample: false - - name: resource - in: query - schema: - $ref: '#/components/schemas/ResourceId' - x-example: '''resource1''' - x-showExample: true - - name: resourceType - in: query - schema: - $ref: '#/components/schemas/ResourceTypeId' - x-example: '''resourcetype1''' - x-showExample: true - - name: type - in: query - schema: - $ref: '#/components/schemas/TaskScenarioType' - x-showExample: true - - name: status - in: query - schema: - $ref: '#/components/schemas/TaskStatus' - x-showExample: true - - name: ids - in: query - schema: - type: array - items: - $ref: '#/components/schemas/TaskId' - explode: false - x-showExample: false - - name: id - in: query - schema: - $ref: '#/components/schemas/TaskId' - x-example: '''808aec38-3fb3-4163-a45e-1890e94081ea''' - x-showExample: true - - name: plugin - in: query - schema: - type: string - x-showExample: false - - name: template - in: query - schema: - type: string - nullable: true - x-showExample: false - - name: filter - in: query - schema: - type: string - description: fuzzy search on multiple properties - x-showExample: false - - name: tags.key - in: query - style: form - explode: true - allowEmptyValue: true - schema: - oneOf: - - type: string - - type: number - - type: boolean - description: >- - Parameter is `form` style serialized, with explode: true - - - See [Query multiple tasks tag - examples](/#/api/rules/?id=queryTagExamples) - - - You can add the same tag query parameter multiple times with - different values, - - which will be applied with a logical OR. - - - You can specify the `tags.` query parameter without a value, - tasks which have a value for tag `` will be returned - example: 3904859080956 - x-example: 3904859080956 - x-showExample: true - - name: finishedBefore - in: query - description: Tasks stopped before provided time will be returned. - schema: - $ref: '#/components/schemas/UnixEpochMillis' - x-example: 1663269720694 - x-showExample: true - - name: createdAfter - in: query - description: Tasks created after provided time will be returned. - schema: - $ref: '#/components/schemas/UnixEpochMillis' - example: 1661990400000 - x-example: 1661990400000 - x-showExample: true - - name: createdBefore - in: query - description: Tasks created before provided time will be returned - schema: - $ref: '#/components/schemas/UnixEpochMillis' - example: 1662768000000 - x-example: 1662768000000 - x-showExample: true - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of tasks that fulfill the query. - schema: - type: integer - content: - application/json: - schema: - title: Task listing - type: array - items: - $ref: '#/components/schemas/TaskEntity' - application/vnd.waylay.paged+json: - schema: - type: object - allOf: - - properties: - values: - type: array - items: - $ref: '#/components/schemas/TaskEntity' - - $ref: '#/components/schemas/PagingResult' - security: - - waylayApiKeySecret: [] - x-py-method: list - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}: - get: - tags: - - Tasks - operationId: get_task - summary: Retrieve Task Details - description: Retrieve the details of a task. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=getting-a-single-task-by-id - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/Format' - x-showExample: false - responses: - '200': - description: Task Details - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - put: - tags: - - Tasks - operationId: replace_task - summary: Update Task - description: |- - Update a task. - - Remark that the full specification of the task must be given - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=update-a-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/TaskSpecification' - responses: - '200': - description: Task Updated - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: replace - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - delete: - tags: - - Tasks - operationId: delete_task - summary: Delete Task - description: Delete a task. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=delete-a-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - responses: - '204': - description: Task Deleted - '400': - description: Error Response - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Not possible to remove task in status running - security: - - waylayApiKeySecret: [] - x-py-method: delete - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}/conf: - get: - tags: - - Tasks - operationId: getConfiguration_task - summary: Get Task Configuration - description: Getting the configuration of an existing task. - externalDocs: - url: >- - https://docs.waylay.io/#/api/rules/?id=getting-the-configuration-of-an-existing-task - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/Format' - x-showExample: false - responses: - '200': - description: Task Configuration - content: - application/json: - schema: - $ref: '#/components/schemas/TaskSpecification' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get_configuration - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}/command/start: - post: - tags: - - Tasks - operationId: start_task - summary: Start Task - description: Start a task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=start-a-task - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - responses: - '200': - description: Task Started - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Task Cannot Be Started - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: >- - Not possible to apply action start, for the task in status - running - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: start - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}/command/stop: - post: - tags: - - Tasks - operationId: stop_task - summary: Stop Task - description: Stop a task. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=stop-a-task - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - responses: - '200': - description: Task Stopped - content: - application/json: - schema: - $ref: '#/components/schemas/TaskEntity' - '400': - description: Task Cannot Be Stopped - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: >- - Not possible to apply action stop, for the task in status - stopped - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: stop - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}/nodes/{nodeId}: - get: - tags: - - Task Nodes - operationId: get_task_node - x-visibility: deprecated - summary: Get Current States - description: | - Get current states (posteriors) and raw data of the node. - - #### visibility - This definition has visibility status `deprecated`. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=node-related-calls - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/NodeId' - x-showExample: false - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - patch: - tags: - - Task Nodes - operationId: patch_task_node - summary: Set Node State - description: >- - Set the current state and rawData for the node. This can only be done - for a running task - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/NodeId' - x-showExample: false - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - state: - type: string - description: >- - State to set. Should be one of the supported states of the - sensor - rawData: - type: object - description: rawData to set - example: - state: THREE - rawData: - randomValue: 0.3458795 - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '400': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: >- - State FVE is invalid for node dice_1 on task - 808aec38-3fb3-4163-a45e-1890e94081ea - '404': - $ref: '#/components/responses/TaskNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: patch - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: true - x-consumes-other: false - post: - tags: - - Task Nodes - operationId: update_task_node_state - x-visibility: deprecated - summary: Set Current State - description: > - Set the current state of the node. - - - This call is deprecated. Please use `PATCH - /rules/v1/tasks/{taskId}/nodes/{nodeId}` - - - #### visibility - - This definition has visibility status `deprecated`. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=set-the-state - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/NodeId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/NodeCallsSpecification' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - security: - - waylayApiKeySecret: [] - x-py-method: update - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/tasks/{taskId}/nodes/{nodeId}/states: - get: - tags: - - Task Nodes - operationId: getStates_task_node - x-visibility: deprecated - summary: Get Supported States - description: | - Get the supported states of a node. - - #### visibility - This definition has visibility status `deprecated`. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=get-supported-states - parameters: - - $ref: '#/components/parameters/TaskId' - x-showExample: false - - $ref: '#/components/parameters/NodeId' - x-showExample: false - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get_states - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/templates: - post: - tags: - - Templates - operationId: create_template - summary: Create Template - description: Create a template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=create-a-new-template - requestBody: - $ref: '#/components/requestBodies/TemplatesSpecification' - responses: - '201': - $ref: '#/components/responses/TemplateCreatedResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - examples: - Duplicate name: - value: - statusCode: 400 - error: A template with name 'internet.json' already exists - code: ERR_DUPLICATE_TEMPLATE_NAME - Plugin not found: - value: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - security: - - waylayApiKeySecret: [] - x-py-method: create - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - get: - tags: - - Templates - operationId: list_templates - summary: List Templates - description: Query templates. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=list-all-templates - parameters: - - $ref: '#/components/parameters/PagingHits' - x-showExample: false - - $ref: '#/components/parameters/PagingStart' - x-showExample: false - - name: filter - description: fuzzy search on multiple properties - in: query - schema: - type: string - x-showExample: false - - name: ids - description: comma separated string of template names - in: query - schema: - type: array - items: - $ref: '#/components/schemas/TemplateId' - explode: false - x-showExample: false - - name: id - description: filter on template name - in: query - schema: - $ref: '#/components/schemas/TemplateId' - x-example: '''internet.json''' - x-showExample: true - - name: plugin - in: query - description: >- - either name of a plugin (e.g. `mySensor`), or full version - specification of the plug (e.g `mySensor:1.0.3`) - schema: - type: string - example: mySensor:1.0.3 - x-example: '''mySensor:1.0.3''' - x-showExample: true - - name: tags.X - in: query - schema: - type: string - description: 'String of form "tags.: ".' - example: 'tags.myref: 3904859080956' - x-example: '''tags.myref: 3904859080956''' - x-showExample: true - responses: - '200': - description: Successful Response - headers: - X-Count: - description: Total number of templates that fulfill the query. - schema: - type: integer - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/TemplateEntityMetadata' - security: - - waylayApiKeySecret: [] - x-py-method: list - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - patch: - tags: - - Templates - operationId: upgradePlugins_templates - summary: Upgrade Plugins - description: >- - Upgrade plugins on multiple templates. - - - The plugin upgrades specified in the body will be applied to all - template that fullfil the query expresses by the query parameters. - - At least one of the query parameters must be specified. - externalDocs: - url: >- - https://docs.waylay.io/#/api/rules/?id=modifying-existing-templates-batch - description: Waylay Documentation - parameters: - - name: ids - in: query - description: comma separated string of template names - schema: - type: array - items: - $ref: '#/components/schemas/TemplateId' - explode: false - x-showExample: false - - name: id - in: query - description: filter on template name - schema: - $ref: '#/components/schemas/TemplateId' - x-example: '''internet.json''' - x-showExample: true - - name: plugin - in: query - description: >- - either name of a plugin (e.g. `mySensor`), or full version - specification of the plug (e.g `mySensor:1.0.3`) - schema: - type: string - example: &ref_0 - plugin: mySensor:1.0.3 - x-example: *ref_0 - x-showExample: true - - name: tags.X - in: query - schema: - type: string - description: 'String of form "tags.: ".' - example: null - x-showExample: false - requestBody: - required: true - description: Plugin Update Specifications - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateModification' - responses: - '200': - description: Successfully Updated - content: - application/json: - schema: - type: object - properties: - successful: - type: array - items: - $ref: '#/components/schemas/TemplateId' - '400': - description: Unsuccessful - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - examples: - Partially applied: - value: - statusCode: 400 - error: Operation only partially applied - successful: - - internet.json - failed: - - templateName: fastInternet.json - error: >- - Node checkState_1 has timeout state ERRORED but it's - sensor mySensor:2.4.13 has states [OK, NOK] - Plugin version does not exist: - value: - statusCode: 400 - error: mySensor:2.4.13 does not exist - security: - - waylayApiKeySecret: [] - x-py-method: upgrade_plugins - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: true - x-consumes-other: false - /rules/v1/templates/{name}: - get: - tags: - - Templates - operationId: get_template - summary: Retrieve Template Details - description: Retrieve the details of a template. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=get-a-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - x-showExample: false - - $ref: '#/components/parameters/Format' - x-showExample: false - responses: - '200': - description: Template Details - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - put: - tags: - - Templates - operationId: replace_template - summary: Update Template - description: >- - Update a template. Note that this will not update any tasks using the - template. You will need to do a batch reload operation on the tasks to - accomplish that. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=update-a-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/TemplatesSpecification' - responses: - '200': - description: Template Updated - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/SimplifiedGraph' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - examples: - Changed name: - value: - statusCode: 400 - error: Path name and submitted template name don't match - Plugin not found: - value: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: replace - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - delete: - tags: - - Templates - operationId: delete_template - summary: Delete Template - description: Delete a template. - externalDocs: - url: https://docs.waylay.io/#/api/rules/?id=delete-template - description: Waylay Documentation - parameters: - - $ref: '#/components/parameters/TemplateId' - x-showExample: false - responses: - '204': - description: Template Deleted - '400': - description: Template Still In Use - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Template with name internet.json in use by 6 task(s) - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: delete - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/templates/{name}/run: - post: - tags: - - Template Runs - operationId: run_template - summary: Run Template - description: >- - Run a template. - - If `data` is specified, template will be run as reactive template. - - If `data` is not specified, template will be run as a one-time template - (1 tick) - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=running-a-template - parameters: - - $ref: '#/components/parameters/TemplateId' - x-showExample: false - - $ref: '#/components/parameters/LogLevel' - x-showExample: false - - $ref: '#/components/parameters/TargetNode' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/RunTemplateSpecification' - responses: - '200': - description: Stream Of Invocation Results - content: - application/x-ndjson: - schema: - $ref: '#/components/schemas/TemplateRunInvocation' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Variable 'threshold' not found - code: VALIDATION - details: - - type: VARIABLE - message: Variable 'threshold' not found - severity: ERROR - details: - variable: threshold - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: run - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/templates/run: - post: - tags: - - Template Runs - operationId: runGraph - summary: Run Graph Or Bayesian Network - description: >- - Run a graph or Bayesian Network. - - If `data` is specified, template will be run as reactive template. - - If `data` is not specified, template will be run as a one-time template - (1 tick) - externalDocs: - description: Waylay Documentation - url: >- - https://docs.waylay.io/#/api/rules/?id=running-a-batch-dataset-through-a-graphbns - parameters: - - $ref: '#/components/parameters/LogLevel' - x-showExample: false - - $ref: '#/components/parameters/TargetNode' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/RunTemplateSpecificationGraph' - responses: - '200': - description: Stream Of Invocation Results - content: - application/x-ndjson: - schema: - $ref: '#/components/schemas/TemplateRunInvocation' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorWithDetailsResponse' - example: - statusCode: 400 - error: Plugin dbDialog:1.2.3 not found - code: TRANSFORMATION - details: - - type: PLUGIN - message: Plugin dbDialog:1.2.3 not found - severity: ERROR - details: - nodeId: debugDialog_1 - plugin: - name: dbDialog - version: 1.2.3 - security: - - waylayApiKeySecret: [] - x-py-method: run_graph - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/discoveryTemplate: - get: - tags: - - Templates - operationId: getDiscovery_template - summary: Retrieve Discovery Template - description: Get the discovery template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=discovery-template - responses: - '200': - description: Discovery Template Details - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - - type: object - properties: - discoveryTemplate: - type: boolean - example: true - '204': - description: No Discovery Template - security: - - waylayApiKeySecret: [] - x-py-method: get_discovery - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - put: - tags: - - Templates - operationId: set_discovery_template - summary: Set Discovery Template - description: Set the discovery template. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=set-the-discovery-template - parameters: - - name: name - in: query - schema: - $ref: '#/components/schemas/TemplateId' - example: discoverResourceType - required: false - description: >- - The template to set as discovery template. If you do not specify - this parameter, the current discovery template will be cleared. - x-example: '''discoverResourceType''' - x-showExample: true - responses: - '200': - description: Discovery Template Set - content: - application/json: - schema: - allOf: - - $ref: '#/components/schemas/TemplateEntityMetadata' - - $ref: '#/components/schemas/GraphDefinition' - - type: object - properties: - name: - type: string - example: discoverResourceType - discoveryTemplate: - type: boolean - example: true - '204': - description: Discovery Template Cleared - '404': - $ref: '#/components/responses/TemplateNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: set - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/batch: - post: - tags: - - Tasks Batch Operations - operationId: start_batch_operation - summary: Start Batch Operations - description: Start a batch operation. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - requestBody: - $ref: '#/components/requestBodies/BatchTasksSpecification' - responses: - '202': - $ref: '#/components/responses/BatchStartResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: >- - /action <- unknown action strt, we support updatePlugins, - delete, start, restart, stop, reload - security: - - waylayApiKeySecret: [] - x-py-method: start - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/batch/{batchId}: - get: - tags: - - Tasks Batch Operations - operationId: get_batch_operation - summary: Get Tasks Batch Operation Status - description: Get the results of the Tasks Batch Operation. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations - parameters: - - $ref: '#/components/parameters/BatchId' - x-showExample: false - responses: - '200': - description: Get Batch Operation - content: - application/json: - schema: - oneOf: - - $ref: '#/components/schemas/BatchOperationResult' - - allOf: - - $ref: '#/components/schemas/BatchOperation' - - title: Result of a running Batch Operation - examples: - Batch Operation still running: - value: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: task - action: delete - description: >- - Remove tasks filtered by type=onetime AND status=stopped - AND finishedBefore=1648738809733 - queueTime: 1663269720694 - Result of a finished Batch Operation: - value: - id: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - user: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - entity: task - action: delete - description: >- - Remove tasks filtered by type=onetime AND status=stopped - AND finishedBefore=1648738809733 - queueTime: 1663269720694 - finishedTime: 1663269725784 - results: - success: - 4bbec310-4b8a-4f82-954d-f6268e7736a3: - statusCode: 200 - b637dc9c-b8fc-4d1e-8743-b1456364e559: - statusCode: 200 - failure: - 0cf62e41-be40-42bf-a88f-6fc803bcb957: - statusCode: 404 - error: No task with id 0cf62e41-be40-42bf-a88f-6fc803bcb957 - '404': - $ref: '#/components/responses/BatchNotFoundResponse' - security: - - waylayApiKeySecret: [] - x-py-method: get - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/sensors/{name}: - post: - tags: - - Plugs Execution - operationId: executeSensor - summary: Execute Latest Sensor Version - description: Execute latest version of a sensor. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-sensor - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 13 - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: false - error: 'ReferenceError: callbackUrdl is not defined' - '404': - description: Sensor Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Sensor mySensor not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_sensor - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/sensors/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeSensorVersion - summary: Execute Specified Sensor Version - description: Execute the specified version of a sensor. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-sensor - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - - $ref: '#/components/parameters/VersionId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 13 - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/SensorExecutionResult' - example: - result: false - error: 'ReferenceError: callbackUrdl is not defined' - '404': - description: Sensor Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Sensor mySensor:3.14.5 not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_sensor_version - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/actions/{name}: - post: - tags: - - Plugs Execution - operationId: executeActuator - summary: Execute Latest Actuator Version - description: Execute latest version of an actuator. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-actuator - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Actuator Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Actuator myActuator not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_actuator - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/actions/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeActuatorVersion - summary: Execute Specified Actuator Version - description: Execute specified version of an actuator. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=execute-actuator - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - - $ref: '#/components/parameters/VersionId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/ActuatorExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Actuator Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Actuator myActuator:4.12.0 not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_actuator_version - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/transformers/{name}: - post: - tags: - - Plugs Execution - operationId: executeTransformer - summary: Execute Latest Transformer Version - description: Execute the latest transformer version. - externalDocs: - description: Waylay Documentation - url: >- - https://docs.waylay.io/#/api/rules/?id=execute-the-latest-transformer-version - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Transformer Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Transformer myTransformer not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_transformer - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/transformers/{name}/versions/{version}: - post: - tags: - - Plugs Execution - operationId: executeTransformerVersion - summary: Execute Specified Transformer Version - description: Execute specified version of a transformer. - externalDocs: - description: Waylay Documentation - url: >- - https://docs.waylay.io/#/api/rules/?id=execute-a-specific-transformer-version - parameters: - - name: name - in: path - schema: - type: string - required: true - x-showExample: false - - $ref: '#/components/parameters/VersionId' - x-showExample: false - requestBody: - $ref: '#/components/requestBodies/ExecutePlugsSpecification' - responses: - '200': - description: Successfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: true - log: [] - '400': - description: Unsuccessfully Executed - content: - application/json: - schema: - $ref: '#/components/schemas/TransformerExecutionResult' - example: - result: false - error: Missing properties - '404': - description: Transformer Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Transformer myTransformer:2.47.2 not found - security: - - waylayApiKeySecret: [] - x-py-method: execute_transformer_version - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false - /rules/v1/data: - post: - tags: - - Push Data - operationId: push_data - summary: Push Streaming Data - description: Push (real-time) streaming data. - externalDocs: - description: Waylay Documentation - url: https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data - requestBody: - $ref: '#/components/requestBodies/StreamData' - responses: - '200': - $ref: '#/components/responses/DefaultSuccessResponse' - '400': - description: Validation Failed - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 400 - error: Expecting json array or object - security: - - waylayApiKeySecret: [] - x-py-method: push - x-consumes-multipart: false - x-consumes-urlencoded: false - x-consumes-json: false - x-consumes-other: false -components: - schemas: - TaskId: - description: Unique task identifier - type: string - example: 808aec38-3fb3-4163-a45e-1890e94081ea - InvocationId: - description: Unique invocation identifier - type: string - example: 45a85360-fe8a-4978-9636-90d741806033 - TemplateId: - description: Unique template identifier - type: string - example: internet.json - LogLevel: - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - - NONE - example: INFO - ResourceId: - description: Unique resource identifier - type: string - example: resource1 - ResourceTypeId: - description: Unique resource type identifier - type: string - example: resourcetype1 - NodeId: - description: Unique node label - type: string - example: dice_1 - BatchId: - type: string - example: afcea5a1-81df-44f6-bd34-e0b602a2cf3d - UnixEpochMillis: - type: integer - description: >- - Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January - 1970, - - not counting leap seconds. - example: 1663269720694 - SO8601Timestamp: - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - VersionResponse: - type: object - properties: - version: - type: string - example: 5.12.1 - name: - type: string - example: waylay-engine - startTime: - type: string - format: date-time - example: '2011-09-06T12:03:27.845Z' - uptime: - type: integer - format: int64 - example: 12703737 - status: - type: string - enum: - - STARTING - - STARTED - - FAILED - example: STARTED - required: - - name - - version - - status - Position: - type: array - minItems: 2 - maxItems: 2 - items: - type: integer - example: - - 223 - - 213 - Version: - type: string - pattern: \d+\.\d+\.\d+ - example: 2.4.13 - PluginUpdateSpec: - type: object - properties: - name: - type: string - description: Name of the plugin to update - example: mySensor - fromVersion: - description: plugin version selection to upgrade - oneOf: - - $ref: '#/components/schemas/Version' - - type: string - enum: - - any - example: any - toVersion: - description: Plugin version to upgrade to - allOf: - - $ref: '#/components/schemas/Version' - required: - - name - - fromVersion - - toVersion - PropertyUpdatesSpec: - type: object - properties: - variables: - type: object - description: >- - Set of variables to update. - - Will be merged with the current variables. - - To delete any of the current variables (and fall back to the default - value from the template) set the value to `null` - tags: - type: object - description: |- - Key-value pairs. - Will be merged with the current tags. - To delete any of the current tags set the value to `null` - anyOf: - - required: - - variables - - required: - - tags - TemplateModification: - type: object - properties: - operation: - type: string - enum: - - updatePlugins - updates: - type: array - items: - $ref: '#/components/schemas/PluginUpdateSpec' - reloadTasks: - type: boolean - description: Should all tasks created from the template be reloaded - default: false - example: true - required: - - operation - - updates - TemplateTags: - type: object - description: Key-value pairs on which you can filter to finding templates back - example: - useCase: UC13.5 - TemplateEntityCommonAttributes: - type: object - properties: - name: - $ref: '#/components/schemas/TemplateId' - discoveryTemplate: - type: boolean - description: flag to indicate if the template is the discovery template - example: false - tags: - $ref: '#/components/schemas/TemplateTags' - variables: - description: Variable declarations - type: array - items: - $ref: '#/components/schemas/VariableDeclaration' - taskDefaults: - $ref: '#/components/schemas/TaskDefaultsElement' - notes: - description: List of notes as explanation for users - type: array - items: - $ref: '#/components/schemas/NoteElement' - required: - - name - TemplateEntity: - type: object - allOf: - - $ref: '#/components/schemas/TemplateEntityCommonAttributes' - - $ref: '#/components/schemas/SimplifiedGraph' - TemplateEntityMetadata: - allOf: - - $ref: '#/components/schemas/TemplateEntityCommonAttributes' - - type: object - properties: - user: - $ref: '#/components/schemas/TemplateUser' - createTime: - $ref: '#/components/schemas/UnixEpochMillis' - lastUpdateTime: - $ref: '#/components/schemas/UnixEpochMillis' - required: - - name - - user - - createTime - - lastUpdateTime - - discoveryTemplate - SensorNode: - required: - - label - - name - - version - type: object - properties: - label: - $ref: '#/components/schemas/NodeId' - name: - title: Name of sensor - type: string - version: - $ref: '#/components/schemas/Version' - properties: - title: Key-value object of required properties - type: object - resource: - $ref: '#/components/schemas/ResourceId' - sequence: - title: Sequence number if omitted default is 1 - type: integer - default: 1 - position: - $ref: '#/components/schemas/Position' - dataTrigger: - title: >- - Boolean to indicate if sensor needs to be executed if data for - `resource` is received - type: boolean - default: true - tickTrigger: - title: Boolean to indicate if sensor needs to be executed on task tick - type: boolean - default: true - evictionTime: - title: Time (in milliseconds) after which sensor goes back to default state - type: integer - minimum: 0 - pollingPeriod: - title: Time (in milliseconds) to give sensor it’s own tick - type: integer - minimum: 1 - schedule: - title: Schedule - type: string - description: Either a valid cron or RRule expression to set the sensor's own tick - timeout: - title: >- - Time (in ISO 8601 duration format) before the plugin times out, - defaults to PT50S (50 seconds) - type: string - default: PT50S - timeoutState: - title: State that will be returned as result if plug execution times out - type: string - loopDef: - title: Loop definition - type: string - minimum: 0 - example: '[{"name": "alpha"}, {"name": "beta"}]' - description: >- - A loop definition is a string that defines items over which node - will be iterated multiple times. - - The string is an JSON array of JSON objects.During template - execution the sensor node with such - - a defined loop definition will be invoked for every JSON Object in - the JSON array. - - Parameter is optional. Node will be executed only once if loop - definition is not defined. - additionalProperties: false - description: Representation of a sensor in a Rule Template. - example: - label: dice_1 - name: dice - version: 1.0.9 - position: - - 100 - - 150 - dataTrigger: false - tickTrigger: true - timeout: PT5S - ActuatorNode: - required: - - label - - name - - version - type: object - properties: - label: - $ref: '#/components/schemas/NodeId' - name: - title: Name of actuator - type: string - version: - $ref: '#/components/schemas/Version' - properties: - title: Key-value object of required properties - type: object - sequence: - title: Sequence - type: integer - position: - $ref: '#/components/schemas/Position' - timeout: - title: >- - Time (in ISO 8601 duration format) before the plugin times out, - defaults to PT50S (50 seconds) - type: string - default: PT50S - additionalProperties: false - description: Representation of an actuator in a Rule Template. - example: - label: debugDialog_1 - name: debugDialog - version: 1.0.0 - properties: - message: Dice 1 has value ONE - position: - - 827 - - 323 - RelationNode: - required: - - label - - type - - parentLabels - - combinations - type: object - properties: - label: - allOf: - - $ref: '#/components/schemas/NodeId' - example: AND_1 - type: - $ref: '#/components/schemas/GateType' - parentLabels: - title: Labels of the sensors that are attached to this gate - type: array - items: - $ref: '#/components/schemas/NodeId' - example: - - dice_1 - - dice_2 - combinations: - title: Combinations of connected sensor's states - type: array - items: - type: array - items: - type: string - description: State of one of the connected sensors - example: - - ONE - - TWO - position: - $ref: '#/components/schemas/Position' - additionalProperties: false - description: Representation of a gate in a Rule Template. - GateType: - enum: - - AND - - OR - - GENERAL - - NAND - type: string - description: Supported gate types. - GenericTrigger: - type: object - properties: - sourceLabel: - title: Label of source sensor or gate - allOf: - - $ref: '#/components/schemas/NodeId' - destinationLabel: - title: Label of the destination sensor or actuator - allOf: - - $ref: '#/components/schemas/NodeId' - invocationPolicy: - title: >- - Time (in seconds) that defines how long to wait before firing the - same actuator again, even if the condition is met. - type: integer - minimum: 1 - TriggerStateChange: - required: - - stateFrom - - stateTo - type: object - properties: - stateFrom: - title: State from which to trigger, or '*' - type: string - stateTo: - title: State to, or '*' - type: string - description: State change specification under which to trigger the next node. - StateChangeTrigger: - description: A trigger that executes on state change. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - properties: - stateChangeTrigger: - $ref: '#/components/schemas/TriggerStateChange' - required: - - sourceLabel - - destinationLabel - - stateChangeTrigger - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_1 - stateChangeTrigger: - stateFrom: 'FALSE' - stateTo: '*' - StatesTrigger: - description: A trigger that is conditional on the states of the source. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - properties: - statesTrigger: - type: array - description: array of states of source node under which to fire - items: - type: string - required: - - sourceLabel - - destinationLabel - - statesTrigger - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_2 - statesTrigger: - - 'TRUE' - ExecutionTrigger: - description: A trigger that always executes on successful execution of the source. - allOf: - - $ref: '#/components/schemas/GenericTrigger' - - type: object - required: - - sourceLabel - - destinationLabel - example: - sourceLabel: AND_1 - destinationLabel: debugDialog_3 - NoteElement: - required: - - text - - position - type: object - properties: - position: - $ref: '#/components/schemas/Position' - text: - title: Text - type: string - example: Example template having some sensors and gates - additionalProperties: false - description: Representation of a note in a Rule Template. - VariableDeclaration: - description: Variable declaration. - required: - - name - - type - type: object - properties: - name: - description: Variable Name - type: string - displayName: - description: Display name. Will default to the name if not specified - type: string - type: - $ref: '#/components/schemas/VariableType' - format: - $ref: '#/components/schemas/VariableFormat' - mandatory: - description: flag to indicate if value for variable is mandatory or not - type: boolean - default: false - defaultValue: - description: Default value for the variable - anyOf: - - type: string - - type: number - - type: boolean - - type: object - example: - name: city - displayName: City - type: string - mandatory: true - VariableFormat: - required: - - type - type: object - properties: - type: - title: Type - type: string - example: resource - values: - title: Possible values (enum declaration) - type: array - items: - oneOf: - - type: string - - type: number - - type: object - description: Format for a variable definition. - VariableType: - enum: - - string - - boolean - - integer - - double - - long - - float - - object - type: string - description: Value type for a template variable. - TaskDefaultsElement: - description: >- - default task settings that will be applied when creating a task from the - template - type: object - properties: - tags: - $ref: '#/components/schemas/TagsTaskObject' - type: - $ref: '#/components/schemas/TaskScenarioType' - resetObservations: - type: boolean - parallel: - type: boolean - gatesNeedFullObservation: - type: boolean - cron: - $ref: '#/components/schemas/CronExpression' - rrule: - $ref: '#/components/schemas/RRuleExpression' - timeZone: - $ref: '#/components/schemas/TimeZoneId' - frequency: - description: polling frequency in milliseconds - type: integer - example: - type: periodic - frequency: 900000 - resetObservations: false - TaskScenarioType: - enum: - - scheduled - - periodic - - onetime - - reactive - type: string - description: Triggering deployment scenario for a task. - TaskStatus: - type: string - enum: - - running - - stopped - - failed - description: Status of a task - TemplateRunWithGraphSpecification: - allOf: - - $ref: '#/components/schemas/TemplateRunSpecification' - - type: object - properties: - graph: - $ref: '#/components/schemas/GraphDefinition' - required: - - graph - ResourceDataInjection: - type: object - description: data to inject per resource - properties: - resource: - $ref: '#/components/schemas/ResourceId' - timestamp: - $ref: '#/components/schemas/UnixEpochMillis' - additionalProperties: true - required: - - resource - TemplateRunConfiguration: - type: object - description: Template run configurations - properties: - executeActuators: - type: boolean - description: Flag to trigger actual execution of actuators - default: false - resource: - $ref: '#/components/schemas/ResourceId' - resetObservations: - type: boolean - description: reset observations before injecting data - default: true - gatesNeedFullObservation: - type: boolean - description: Only evaluate gates when all inputs are observed - default: false - TemplateRunSpecification: - type: object - properties: - data: - title: Data Set - description: >- - The full dataset to process. If specified, template will be run as - reactive template - type: array - items: - type: array - title: Dataset For One Invocation - description: dataset that will be processed by one invocation - items: - $ref: '#/components/schemas/ResourceDataInjection' - example: - - - resource: resource1 - temperature: 20 - - resource: resource2 - co2: 100 - humidity: 0.4 - - - resource: resource1 - temperature: 21 - conf: - $ref: '#/components/schemas/TemplateRunConfiguration' - variables: - title: Template variables - description: The values for the variables declared in the template - type: object - example: - threshold: 13 - resourceMetaData: - title: Resource Metadata - description: >- - Metadata for any of the resources used in the template. - - - The current metadata for all resources used in the template is - fetched at the start of the template run. - - This provided metadata is used to overwrite this current metadata - type: object - additionalProperties: - type: object - example: - resource1: - name: outside_temperature - inside_sensor: - $$ref: /resources/resource2 - SensorExecutionResult: - type: object - properties: - result: - type: boolean - description: flag indicating if the sensor was successfully executed - state: - type: string - description: observedState field returned by the sensor execution - error: - type: string - description: error message in case of failure - rawData: - type: object - description: the rawData returned by the sensor execution - log: - type: array - items: - type: object - TemplateRunSensorResult: - allOf: - - $ref: '#/components/schemas/SensorExecutionResult' - - type: object - properties: - executed: - type: boolean - description: flag indicating if the sensor was executed - required: - - executed - ActuatorExecutionResult: - type: object - properties: - result: - type: boolean - description: flag indicating if the actuator was successfully executed - error: - type: string - description: error message in case of failure - rawData: - type: object - log: - type: array - items: - type: object - TemplateRunActuatorResult: - allOf: - - $ref: '#/components/schemas/ActuatorExecutionResult' - - type: object - properties: - executed: - type: boolean - description: flag indicating if the actuator was executed - required: - - executed - TemplateRunInvocation: - type: object - properties: - taskId: - $ref: '#/components/schemas/TaskId' - invocationId: - $ref: '#/components/schemas/InvocationId' - sensors: - title: Sensors Results - description: The execution result for each of the sensors of the template - type: object - additionalProperties: - $ref: '#/components/schemas/TemplateRunSensorResult' - example: - alarm: - executed: true - result: true - state: OK - rawData: {} - log: [] - streamingDataSensor: - executed: true - result: true - state: ABOVE - rawData: - parameter: temperature - threshold: 20 - actuators: - title: Actuator Results - description: The execution result for each of the actuators of the template - type: object - additionalProperties: - $ref: '#/components/schemas/TemplateRunActuatorResult' - example: - send_sms: - executed: true - result: true - log: [] - log: - title: Logs - type: array - items: - type: object - properties: - time: - $ref: '#/components/schemas/SO8601Timestamp' - level: - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - example: INFO - message: - type: string - example: SMS sent - additionalProperties: false - required: - - time - - level - - message - required: - - taskId - - invocationId - - sensors - - actuators - - log - TransformerExecutionResult: - type: object - properties: - result: - type: boolean - description: flag indicating if the actuator was Successfully Executed - error: - type: string - description: error message in case of failure - data: - type: object - log: - type: array - items: - type: object - ExecutePlugsSpecification: - type: object - properties: - properties: - title: specific input parameters - type: object - example: - threshold: 20 - resource: - $ref: '#/components/schemas/ResourceId' - streamData: - title: Stream data - type: object - example: - temperature: 21 - timestamp: 1582988389 - BatchIdQuery: - type: object - properties: - ids: - type: array - items: - $ref: '#/components/schemas/TaskId' - required: - - ids - BatchQuery: - type: object - properties: - name: - $ref: '#/components/schemas/TaskName' - resource: - $ref: '#/components/schemas/ResourceId' - type: - $ref: '#/components/schemas/TaskScenarioType' - status: - $ref: '#/components/schemas/TaskStatus' - template: - $ref: '#/components/schemas/TemplateId' - plugin: - description: >- - either name of a plugin (e.g. `mySensor`), or full version - specification of the plug (e.g `mySensor:1.0.3`) - type: string - example: mySensor:1.0.3 - user: - $ref: '#/components/schemas/TaskUser' - finishedBefore: - $ref: '#/components/schemas/UnixEpochMillis' - createdAfter: - $ref: '#/components/schemas/UnixEpochMillis' - createdBefore: - $ref: '#/components/schemas/UnixEpochMillis' - tags: - $ref: '#/components/schemas/TagsTaskObject' - BatchTask: - type: object - properties: - entity: - type: string - enum: - - task - action: - type: string - query: - oneOf: - - $ref: '#/components/schemas/BatchIdQuery' - - $ref: '#/components/schemas/BatchQuery' - BatchTaskCommand: - description: Execute command on multiple task - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - enum: - - delete - - start - - restart - - stop - - reload - - stopAndDelete - required: - - entity - - action - - query - BatchUpdatePlugin: - description: Upgrade plugins on multiple tasks - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - type: string - enum: - - updatePlugins - actionParameters: - $ref: '#/components/schemas/PluginUpdateSpec' - required: - - entity - - action - - query - - actionParameters - BatchUpdateProperties: - description: Update variables and/or tags of multiple tasks - type: object - allOf: - - $ref: '#/components/schemas/BatchTask' - - properties: - action: - type: string - enum: - - updateProperties - actionParameters: - $ref: '#/components/schemas/PropertyUpdatesSpec' - required: - - entity - - action - - query - - actionParameters - BatchOperation: - type: object - properties: - id: - $ref: '#/components/schemas/BatchId' - user: - type: string - description: User id of the user who started the operation - example: user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe - operation: - type: object - description: Summary of the batch operation - properties: - entity: - type: string - enum: - - task - action: - type: string - enum: - - updatePlugins - - delete - - start - - restart - - stop - - reload - - updateProperties - example: delete - description: - type: string - description: description of the operations - example: >- - Remove tasks filtered by - ids=808aec38-3fb3-4163-a45e-1890e94081ea - required: - - entity - - action - - description - queueTime: - $ref: '#/components/schemas/UnixEpochMillis' - required: - - id - - user - - operation - - queueTime - SuccessOperationResult: - type: object - description: |- - Object containing the successful operation results. - The keys will be task ids. - additionalProperties: - type: object - description: The keys will be task ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - required: - - statusCode - FailureOperationResult: - type: object - description: |- - Object containing the unsuccessful operation results. - The keys will be tasks ids. - additionalProperties: - type: object - description: The keys will be task ids. - properties: - statusCode: - type: integer - description: The statusCode of the operation - error: - type: string - description: Error description of what went wrong. - required: - - statusCode - - error - OperationResultObject: - description: Finished Batch Operation results - type: object - properties: - finishedTime: - $ref: '#/components/schemas/UnixEpochMillis' - results: - type: object - properties: - success: - $ref: '#/components/schemas/SuccessOperationResult' - failure: - $ref: '#/components/schemas/FailureOperationResult' - required: - - success - - failure - required: - - finishedTime - - results - BatchOperationResult: - allOf: - - $ref: '#/components/schemas/BatchOperation' - - $ref: '#/components/schemas/OperationResultObject' - TaskFromTemplate: - type: object - allOf: - - $ref: '#/components/schemas/TaskSettings' - - properties: - start: - title: boolean to indicate whether task must be started after creation - type: boolean - default: true - template: - $ref: '#/components/schemas/TemplateId' - required: - - template - - name - SimplifiedGraph: - description: Graph in simplified format - type: object - properties: - sensors: - description: List of sensors with required properties - type: array - items: - $ref: '#/components/schemas/SensorNode' - actuators: - description: List of actuators with required properties - type: array - items: - $ref: '#/components/schemas/ActuatorNode' - relations: - description: List of relations (gates) between sensors - type: array - items: - $ref: '#/components/schemas/RelationNode' - triggers: - description: List of conditions under which actuators/sensors get executed. - type: array - items: - anyOf: - - $ref: '#/components/schemas/StateChangeTrigger' - - $ref: '#/components/schemas/StatesTrigger' - - $ref: '#/components/schemas/ExecutionTrigger' - BayesianGraph: - description: Graph in BN format - type: object - properties: - nodes: - type: array - items: - type: object - posterior: - type: array - items: - type: object - GraphDefinition: - oneOf: - - $ref: '#/components/schemas/SimplifiedGraph' - - $ref: '#/components/schemas/BayesianGraph' - TaskWithRule: - type: object - allOf: - - $ref: '#/components/schemas/SimplifiedGraph' - - properties: - notes: - title: List of notes as explanation for users - type: array - items: - $ref: '#/components/schemas/NoteElement' - task: - allOf: - - $ref: '#/components/schemas/TaskSettings' - - type: object - properties: - start: - title: >- - boolean to indicate whether task must be started after - creation - type: boolean - default: true - required: - - name - required: - - task - PeriodicTaskSetting: - type: object - properties: - type: - type: string - enum: - - periodic - frequency: - type: integer - description: polling frequency in milliseconds - example: 900000 - required: - - type - - frequency - TimeZoneId: - type: string - description: >- - Optional identifier of the time zone in which the schedule expression is - to be interpreted - example: Europe/Brussels - RRuleExpression: - type: string - description: >- - RRule expression as defined in [RFC5545 - 3.8.5.3](https://www.rfc-editor.org/rfc/rfc5545#section-3.8.5.3) - example: FREQ=MINUTELY;INTERVAL=15 - CronExpression: - type: string - description: >- - cron expression as defined in [Cron - format](https://www.quartz-scheduler.org/documentation/quartz-1.8.6/tutorials/TutorialLesson06) - example: 15 * * * * ? - ScheduledTaskSetting: - type: object - allOf: - - properties: - type: - type: string - enum: - - scheduled - timeZone: - $ref: '#/components/schemas/TimeZoneId' - required: - - type - - oneOf: - - properties: - rrule: - $ref: '#/components/schemas/RRuleExpression' - required: - - rrule - - properties: - cron: - $ref: '#/components/schemas/CronExpression' - required: - - cron - OneTimeTaskSetting: - type: object - properties: - type: - type: string - enum: - - onetime - required: - - type - ReactiveTaskSetting: - type: object - properties: - type: - type: string - enum: - - reactive - required: - - type - TaskTypeSettings: - type: object - oneOf: - - $ref: '#/components/schemas/ScheduledTaskSetting' - - $ref: '#/components/schemas/PeriodicTaskSetting' - - $ref: '#/components/schemas/OneTimeTaskSetting' - - $ref: '#/components/schemas/ReactiveTaskSetting' - VariablesTaskObject: - type: object - description: >- - set of variables which will be used when starting a task and will - automatically be injected in the template before starting a task. - example: - email: foo@gmail.com - TagsTaskObject: - type: object - description: >- - Key-value pairs on which you can set at task creation and later filter - tasks - example: - myRef: d8933cd4-7c70-11e9-8f9e-2a86e4085a59 - TaskName: - type: string - example: Example task 1 - GenericTaskSettings: - type: object - properties: - name: - $ref: '#/components/schemas/TaskName' - resource: - $ref: '#/components/schemas/ResourceId' - resetObservations: - title: whether to clear observations before next invocation - type: boolean - default: true - parallel: - title: whether to run sensors in parallel or sequentially - type: boolean - default: true - gatesNeedFullObservation: - title: Only evaluate gates when all inputs are observed - type: boolean - default: false - tags: - $ref: '#/components/schemas/TagsTaskObject' - variables: - $ref: '#/components/schemas/VariablesTaskObject' - TaskSettings: - type: object - allOf: - - $ref: '#/components/schemas/GenericTaskSettings' - - $ref: '#/components/schemas/TaskTypeSettings' - ValidationIssue: - type: object - properties: - type: - type: string - description: Indication of "area" where validation issue is situated - example: BINDING - message: - description: Description of the issue - type: string - example: rawData fas no field status - severity: - type: string - description: >- - Severity of the issue. ERROR means that object cannot be created if - the issue is not fixed. WARNING means that the object can be - created, but that errors might be encountered at runtime - enum: - - ERROR - - WARNING - example: WARNING - details: - type: object - description: Object containing identifying information on what gives the issue - example: - nodeId: debugDialog_1 - property: message - binding: ${nodes.dice_1.rawData.status} - suggestion: - type: string - description: Suggestion on how to change the object to get the issue fixed - example: 'maybe you are looking for one of these: state, randomValue' - required: - - type - - message - - severity - ErrorResponse: - type: object - properties: - statusCode: - type: integer - example: 400 - error: - type: string - code: - type: string - description: Optional error code - required: - - statusCode - - error - ErrorWithDetailsResponse: - allOf: - - $ref: '#/components/schemas/ErrorResponse' - - properties: - details: - type: array - items: - $ref: '#/components/schemas/ValidationIssue' - PagingSkip: - type: integer - description: Number of items skipped before this page of results. - default: 0 - example: 85 - PagingLimit: - type: integer - description: Size of one page of results. - example: 10 - default: 10 - PagingTotal: - type: integer - description: >- - Total number of items matching the query of which this is one page of - results. - example: 2398 - PagingResult: - type: object - properties: - skip: - $ref: '#/components/schemas/PagingSkip' - limit: - $ref: '#/components/schemas/PagingLimit' - total: - $ref: '#/components/schemas/PagingTotal' - required: - - skip - - limit - - total - TaskUser: - type: string - description: Creation user mail address or 'system' for system generated tasks - example: user@waylay.io - TemplateUser: - type: string - description: Creation user mail address - example: user@waylay.io - TaskResourceIds: - description: List of resources that are used in the task - type: array - items: - $ref: '#/components/schemas/ResourceId' - TaskEntity: - type: object - properties: - ID: - $ref: '#/components/schemas/TaskId' - name: - $ref: '#/components/schemas/TaskName' - status: - $ref: '#/components/schemas/TaskStatus' - user: - $ref: '#/components/schemas/TaskUser' - createTime: - $ref: '#/components/schemas/UnixEpochMillis' - template: - $ref: '#/components/schemas/TemplateId' - network: - description: >- - The graph, either from the template or from the task definition. - Depending on the `format` query parameter either BN or simplified - format - type: object - resourceIds: - $ref: '#/components/schemas/TaskResourceIds' - required: - - ID - - status - - user - - createTime - - name - - network - TaskSpecification: - oneOf: - - $ref: '#/components/schemas/TaskFromTemplate' - - $ref: '#/components/schemas/TaskWithRule' - requestBodies: - TaskSpecification: - description: Task Specification - content: - application/json: - schema: - $ref: '#/components/schemas/TaskSpecification' - required: true - BatchTasksSpecification: - description: Tasks Batch Operation - required: true - content: - application/json: - schema: - title: a tasks batch operation specification - type: object - oneOf: - - $ref: '#/components/schemas/BatchUpdatePlugin' - - $ref: '#/components/schemas/BatchTaskCommand' - - $ref: '#/components/schemas/BatchUpdateProperties' - examples: - Delete multiple tasks by query: - value: - entity: task - action: delete - query: - type: onetime - status: stopped - finishedBefore: 1648738809733 - Delete multiple tasks by id: - value: - entity: task - action: delete - query: - ids: - - 4bbec310-4b8a-4f82-954d-f6268e7736a3 - - b637dc9c-b8fc-4d1e-8743-b1456364e559 - - 0cf62e41-be40-42bf-a88f-6fc803bcb957 - Stop all task running for resource myResource: - value: - entity: task - action: stop - query: - status: running - resource: myResource - Plugin updates: - value: - entity: task - action: updatePlugins - query: - ids: - - 4bbec310-4b8a-4f82-954d-f6268e7736a3 - - b637dc9c-b8fc-4d1e-8743-b1456364e559 - - 0cf62e41-be40-42bf-a88f-6fc803bcb957 - actionParameters: - updates: - - name: myActuator - fromVersion: 1.0.1 - toVersion: 1.0.3 - - name: mySensor - fromVersion: any - toVersion: 2.3.4 - Properties update: - value: - entity: task - action: updateProperties - query: - status: running - template: myChangedTemplate - tags: - revision: 57 - actionParameters: - variables: - variableWithDefault: null - newVariable: 13 - tags: - revision: 58 - dummyTag: null - newTag: released - TemplatesSpecification: - description: Template Specification - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateEntity' - required: true - RunTemplateSpecification: - description: Specification to run template - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateRunSpecification' - RunTemplateSpecificationGraph: - description: Specification to run template through graph/BN. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TemplateRunWithGraphSpecification' - ExecutePlugsSpecification: - description: Specification to execute a plug. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ExecutePlugsSpecification' - NodeCallsSpecification: - description: Command string to apply to a node of a task. - required: true - content: - text/plain: - schema: - type: string - anyOf: - - pattern: ^state= - description: State update command - - pattern: ^operation= - description: Operation command - example: state=Alive - StreamData: - description: Push (real-time) Data Specification - required: true - content: - application/json: - schema: - title: stream data - type: object - properties: - resource: - $ref: '#/components/schemas/ResourceId' - data: - oneOf: - - type: object - example: - parameterName: temperature - value: 23 - collectedTime: 1420629467 - - type: array - items: - type: object - example: - - parameterName: latitude - value: 51 - - parameterName: longitude - value: 3.73 - required: - - resource - - data - parameters: - TaskId: - name: taskId - in: path - description: Unique Task identifier - required: true - schema: - $ref: '#/components/schemas/TaskId' - TemplateId: - name: name - in: path - description: Unique Template identifier - required: true - schema: - $ref: '#/components/schemas/TemplateId' - LogLevel: - name: logLevel - in: query - description: >- - sets the log level for filtering out logs to requested log level or - higher from the template run output. - - Value `NONE` will disable all logs. - - If not specified all logs will be returned. - required: false - schema: - type: string - enum: - - DEBUG - - INFO - - WARN - - ERROR - default: DEBUG - TargetNode: - name: targetNode - in: query - description: >- - The sensors and actuators part of response will contain only elements - related to the asked node of the graph. - - The returned logs also will be filtered and contain only logs related to - the asked node(s). - required: false - schema: - type: array - items: - type: string - example: myFirstNode - NodeId: - name: nodeId - in: path - description: Unique node label - required: true - schema: - $ref: '#/components/schemas/NodeId' - BatchId: - name: batchId - in: path - description: Unique Batch Operation identifier - required: true - schema: - $ref: '#/components/schemas/BatchId' - VersionId: - name: version - in: path - description: Version number of plugin - required: true - schema: - $ref: '#/components/schemas/Version' - PagingHits: - name: hits - in: query - description: (Paging) maximal number of items returned - schema: - $ref: '#/components/schemas/PagingLimit' - PagingStart: - name: startIndex - in: query - description: (Paging) items to skip in the listing - schema: - $ref: '#/components/schemas/PagingSkip' - Format: - name: format - in: query - description: Format of the graph definition - schema: - type: string - enum: - - bn - - simplified - default: bn - responses: - DefaultSuccessResponse: - description: Successful Response - content: - application/json: - schema: - type: object - VersionResponse: - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/VersionResponse' - TaskCreatedResponse: - description: Task Created - headers: - Location: - description: URI where the created Task can be fetched - schema: - type: string - content: - application/json: - schema: - type: object - properties: - ID: - $ref: '#/components/schemas/TaskId' - warnings: - type: array - description: >- - List of task warning issues. Will only be there if query - parameter `returnWarnings` was set to `true` - items: - $ref: '#/components/schemas/ValidationIssue' - required: - - ID - TaskNotFoundResponse: - description: Task Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: Task with id de1b26b1-31f0-4054-af44-da02331f06b5 not found - TemplateCreatedResponse: - description: Template Created - headers: - Location: - description: URI where the created Template can be fetched - schema: - type: string - content: - application/json: - schema: - type: object - properties: - statusCode: - type: integer - example: 201 - uri: - type: string - format: uri - example: /rules/v1/templates/internet.json - entity: - $ref: '#/components/schemas/TemplateEntity' - required: - - statusCode - - uri - - entity - TemplateNotFoundResponse: - description: Template Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: No template with name theInternet.json - BatchStartResponse: - description: Batch Operation Started - content: - application/json: - schema: - title: Batch operation enqueued - type: object - properties: - statusCode: - type: integer - example: 202 - uri: - type: string - description: URI where the batch operation status can be followed - format: uri - example: /rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - entity: - $ref: '#/components/schemas/BatchOperation' - required: - - statusCode - - uri - - entity - headers: - Location: - description: URI where the batch operation status can be followed - example: /rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d - schema: - type: string - format: uri - BatchNotFoundResponse: - description: Batch Operation Not Found - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - example: - statusCode: 404 - error: No batch operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d' - securitySchemes: - waylayApiKeySecret: - type: http - description: >- - Waylay apiKey/apiSecret basic authentication. All endpoints support also - Waylay JWT Bearer authentication. - scheme: basic -servers: - - url: https://api.waylay.io - description: Waylay enterprise gateway diff --git a/test/_run/openapi/rules.transformed.openapi.yaml.json b/test/_run/openapi/rules.transformed.openapi.yaml.json deleted file mode 100644 index ceef66a..0000000 --- a/test/_run/openapi/rules.transformed.openapi.yaml.json +++ /dev/null @@ -1,4911 +0,0 @@ -{ - "openapi": "3.0.3", - "info": { - "title": "Waylay rules engine", - "version": "6.5.0", - "description": "The REST api to manage rule tasks and rule templates in the Waylay platform." - }, - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/", - "description": "Waylay Documentation" - }, - "tags": [ - { - "name": "Tasks", - "description": "Manage Waylay Tasks", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=task", - "description": "Waylay Documentation" - } - }, - { - "name": "Task Nodes", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=node-related-calls", - "description": "Waylay Documentation" - } - }, - { - "name": "Templates", - "description": "Manage Waylay Rule Templates", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=templates", - "description": "Waylay Documentation" - } - }, - { - "name": "Template Runs", - "description": "Running a template over a data set or once (with 1 tick)", - "externalDocs": { - "url": "https://docs.waylay.io/#/features/rules/?id=bulk-data-processing", - "description": "Waylay Documentation" - } - }, - { - "name": "Tasks Batch Operations", - "description": "Batch operations on multiple Tasks. Batch operations are executed asynchronously. \nCreating a batch operation will return an url which you can use to retrieve the status and the results of the operation.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations", - "description": "Waylay Documentation" - } - }, - { - "name": "Version" - }, - { - "name": "Plugs Execution" - }, - { - "name": "Push Data", - "description": "Inject streaming data in tasks", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data", - "description": "Waylay Documentation" - } - } - ], - "paths": { - "/rules/v1": { - "get": { - "summary": "Get Version", - "operationId": "get_version", - "tags": [ - "Version" - ], - "description": "Get the status and version of the service.", - "responses": { - "200": { - "$ref": "#/components/responses/VersionResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "create_task", - "summary": "Create Task", - "description": "Create a new task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=create-a-task" - }, - "requestBody": { - "$ref": "#/components/requestBodies/TaskSpecification" - }, - "parameters": [ - { - "name": "failOnWarning", - "in": "query", - "description": "If `true` and there are task warnings, the response will be a `400 Validation failed`", - "schema": { - "type": "boolean", - "default": false - }, - "x-showExample": true - }, - { - "name": "returnWarnings", - "in": "query", - "description": "If `true`, result body will contain a list of task warnings that where detected", - "schema": { - "type": "boolean", - "default": false - }, - "x-showExample": true - } - ], - "responses": { - "201": { - "$ref": "#/components/responses/TaskCreatedResponse" - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Binding error at SensorLocation(debugDialog_1)/message/binding '${nodes.dice_1.rawData.status}' : rawData has no field status", - "code": "VALIDATION", - "details": [ - { - "type": "BINDING", - "message": "rawData has no field status", - "severity": "WARNING", - "details": { - "nodeId": "debugDialog_1", - "property": "message", - "binding": "${nodes.dice_1.rawData.status}" - }, - "suggestion": "maybe you are looking for one of these: state, randomValue" - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "create", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "get": { - "tags": [ - "Tasks" - ], - "operationId": "list_tasks", - "summary": "Query Multiple Tasks", - "description": "Query multiple tasks.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=query-multiple-tasks", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/PagingHits", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/PagingStart", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/Format", - "x-showExample": false - }, - { - "name": "name", - "in": "query", - "schema": { - "type": "string" - }, - "x-showExample": false - }, - { - "name": "resource", - "in": "query", - "schema": { - "$ref": "#/components/schemas/ResourceId" - }, - "x-example": "'resource1'", - "x-showExample": true - }, - { - "name": "resourceType", - "in": "query", - "schema": { - "$ref": "#/components/schemas/ResourceTypeId" - }, - "x-example": "'resourcetype1'", - "x-showExample": true - }, - { - "name": "type", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskScenarioType" - }, - "x-showExample": true - }, - { - "name": "status", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskStatus" - }, - "x-showExample": true - }, - { - "name": "ids", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskId" - } - }, - "explode": false, - "x-showExample": false - }, - { - "name": "id", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TaskId" - }, - "x-example": "'808aec38-3fb3-4163-a45e-1890e94081ea'", - "x-showExample": true - }, - { - "name": "plugin", - "in": "query", - "schema": { - "type": "string" - }, - "x-showExample": false - }, - { - "name": "template", - "in": "query", - "schema": { - "type": "string", - "nullable": true - }, - "x-showExample": false - }, - { - "name": "filter", - "in": "query", - "schema": { - "type": "string" - }, - "description": "fuzzy search on multiple properties", - "x-showExample": false - }, - { - "name": "tags.key", - "in": "query", - "style": "form", - "explode": true, - "allowEmptyValue": true, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ] - }, - "description": "Parameter is `form` style serialized, with explode: true\n\nSee [Query multiple tasks tag examples](/#/api/rules/?id=queryTagExamples)\n\nYou can add the same tag query parameter multiple times with different values,\nwhich will be applied with a logical OR.\n\nYou can specify the `tags.` query parameter without a value, tasks which have a value for tag `` will be returned", - "example": 3904859080956, - "x-example": 3904859080956, - "x-showExample": true - }, - { - "name": "finishedBefore", - "in": "query", - "description": "Tasks stopped before provided time will be returned.", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "x-example": 1663269720694, - "x-showExample": true - }, - { - "name": "createdAfter", - "in": "query", - "description": "Tasks created after provided time will be returned.", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "example": 1661990400000, - "x-example": 1661990400000, - "x-showExample": true - }, - { - "name": "createdBefore", - "in": "query", - "description": "Tasks created before provided time will be returned", - "schema": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "example": 1662768000000, - "x-example": 1662768000000, - "x-showExample": true - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of tasks that fulfill the query.", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "title": "Task listing", - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskEntity" - } - } - }, - "application/vnd.waylay.paged+json": { - "schema": { - "type": "object", - "allOf": [ - { - "properties": { - "values": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - { - "$ref": "#/components/schemas/PagingResult" - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "list", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}": { - "get": { - "tags": [ - "Tasks" - ], - "operationId": "get_task", - "summary": "Retrieve Task Details", - "description": "Retrieve the details of a task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=getting-a-single-task-by-id", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/Format", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Task Details", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "put": { - "tags": [ - "Tasks" - ], - "operationId": "replace_task", - "summary": "Update Task", - "description": "Update a task. \n\nRemark that the full specification of the task must be given", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=update-a-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/TaskSpecification" - }, - "responses": { - "200": { - "description": "Task Updated", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "replace", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "delete": { - "tags": [ - "Tasks" - ], - "operationId": "delete_task", - "summary": "Delete Task", - "description": "Delete a task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=delete-a-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - } - ], - "responses": { - "204": { - "description": "Task Deleted" - }, - "400": { - "description": "Error Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to remove task in status running" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "delete", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}/conf": { - "get": { - "tags": [ - "Tasks" - ], - "operationId": "getConfiguration_task", - "summary": "Get Task Configuration", - "description": "Getting the configuration of an existing task.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=getting-the-configuration-of-an-existing-task", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/Format", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Task Configuration", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskSpecification" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get_configuration", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}/command/start": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "start_task", - "summary": "Start Task", - "description": "Start a task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=start-a-task" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Task Started", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Task Cannot Be Started", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to apply action start, for the task in status running" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "start", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}/command/stop": { - "post": { - "tags": [ - "Tasks" - ], - "operationId": "stop_task", - "summary": "Stop Task", - "description": "Stop a task.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=stop-a-task" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Task Stopped", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskEntity" - } - } - } - }, - "400": { - "description": "Task Cannot Be Stopped", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Not possible to apply action stop, for the task in status stopped" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "stop", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}/nodes/{nodeId}": { - "get": { - "tags": [ - "Task Nodes" - ], - "operationId": "get_task_node", - "x-visibility": "deprecated", - "summary": "Get Current States", - "description": "Get current states (posteriors) and raw data of the node.\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=node-related-calls" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/NodeId", - "x-showExample": false - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "patch": { - "tags": [ - "Task Nodes" - ], - "operationId": "patch_task_node", - "summary": "Set Node State", - "description": "Set the current state and rawData for the node. This can only be done for a running task", - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/NodeId", - "x-showExample": false - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "state": { - "type": "string", - "description": "State to set. Should be one of the supported states of the sensor" - }, - "rawData": { - "type": "object", - "description": "rawData to set" - } - } - }, - "example": { - "state": "THREE", - "rawData": { - "randomValue": 0.3458795 - } - } - } - } - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "400": { - "description": "Validation Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "State FVE is invalid for node dice_1 on task 808aec38-3fb3-4163-a45e-1890e94081ea" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TaskNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "patch", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": true, - "x-consumes-other": false - }, - "post": { - "tags": [ - "Task Nodes" - ], - "operationId": "update_task_node_state", - "x-visibility": "deprecated", - "summary": "Set Current State", - "description": "Set the current state of the node.\n\nThis call is deprecated. Please use `PATCH /rules/v1/tasks/{taskId}/nodes/{nodeId}`\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=set-the-state" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/NodeId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/NodeCallsSpecification" - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "update", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/tasks/{taskId}/nodes/{nodeId}/states": { - "get": { - "tags": [ - "Task Nodes" - ], - "operationId": "getStates_task_node", - "x-visibility": "deprecated", - "summary": "Get Supported States", - "description": "Get the supported states of a node.\n\n#### visibility\nThis definition has visibility status `deprecated`.\n", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=get-supported-states" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TaskId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/NodeId", - "x-showExample": false - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get_states", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/templates": { - "post": { - "tags": [ - "Templates" - ], - "operationId": "create_template", - "summary": "Create Template", - "description": "Create a template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=create-a-new-template" - }, - "requestBody": { - "$ref": "#/components/requestBodies/TemplatesSpecification" - }, - "responses": { - "201": { - "$ref": "#/components/responses/TemplateCreatedResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "examples": { - "Duplicate name": { - "value": { - "statusCode": 400, - "error": "A template with name 'internet.json' already exists", - "code": "ERR_DUPLICATE_TEMPLATE_NAME" - } - }, - "Plugin not found": { - "value": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "create", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "get": { - "tags": [ - "Templates" - ], - "operationId": "list_templates", - "summary": "List Templates", - "description": "Query templates.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=list-all-templates" - }, - "parameters": [ - { - "$ref": "#/components/parameters/PagingHits", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/PagingStart", - "x-showExample": false - }, - { - "name": "filter", - "description": "fuzzy search on multiple properties", - "in": "query", - "schema": { - "type": "string" - }, - "x-showExample": false - }, - { - "name": "ids", - "description": "comma separated string of template names", - "in": "query", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "explode": false, - "x-showExample": false - }, - { - "name": "id", - "description": "filter on template name", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TemplateId" - }, - "x-example": "'internet.json'", - "x-showExample": true - }, - { - "name": "plugin", - "in": "query", - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "schema": { - "type": "string", - "example": "mySensor:1.0.3" - }, - "x-example": "'mySensor:1.0.3'", - "x-showExample": true - }, - { - "name": "tags.X", - "in": "query", - "schema": { - "type": "string", - "description": "String of form \"tags.: \".", - "example": "tags.myref: 3904859080956" - }, - "x-example": "'tags.myref: 3904859080956'", - "x-showExample": true - } - ], - "responses": { - "200": { - "description": "Successful Response", - "headers": { - "X-Count": { - "description": "Total number of templates that fulfill the query.", - "schema": { - "type": "integer" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateEntityMetadata" - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "list", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "patch": { - "tags": [ - "Templates" - ], - "operationId": "upgradePlugins_templates", - "summary": "Upgrade Plugins", - "description": "Upgrade plugins on multiple templates.\n\nThe plugin upgrades specified in the body will be applied to all template that fullfil the query expresses by the query parameters.\nAt least one of the query parameters must be specified.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=modifying-existing-templates-batch", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "name": "ids", - "in": "query", - "description": "comma separated string of template names", - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "explode": false, - "x-showExample": false - }, - { - "name": "id", - "in": "query", - "description": "filter on template name", - "schema": { - "$ref": "#/components/schemas/TemplateId" - }, - "x-example": "'internet.json'", - "x-showExample": true - }, - { - "name": "plugin", - "in": "query", - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "schema": { - "type": "string", - "example": { - "plugin": "mySensor:1.0.3" - } - }, - "x-example": { - "plugin": "mySensor:1.0.3" - }, - "x-showExample": true - }, - { - "name": "tags.X", - "in": "query", - "schema": { - "type": "string", - "description": "String of form \"tags.: \".", - "example": null - }, - "x-showExample": false - } - ], - "requestBody": { - "required": true, - "description": "Plugin Update Specifications", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateModification" - } - } - } - }, - "responses": { - "200": { - "description": "Successfully Updated", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "successful": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TemplateId" - } - } - } - } - } - } - }, - "400": { - "description": "Unsuccessful", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "examples": { - "Partially applied": { - "value": { - "statusCode": 400, - "error": "Operation only partially applied", - "successful": [ - "internet.json" - ], - "failed": [ - { - "templateName": "fastInternet.json", - "error": "Node checkState_1 has timeout state ERRORED but it's sensor mySensor:2.4.13 has states [OK, NOK]" - } - ] - } - }, - "Plugin version does not exist": { - "value": { - "statusCode": 400, - "error": "mySensor:2.4.13 does not exist" - } - } - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "upgrade_plugins", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": true, - "x-consumes-other": false - } - }, - "/rules/v1/templates/{name}": { - "get": { - "tags": [ - "Templates" - ], - "operationId": "get_template", - "summary": "Retrieve Template Details", - "description": "Retrieve the details of a template.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=get-a-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/Format", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Template Details", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "put": { - "tags": [ - "Templates" - ], - "operationId": "replace_template", - "summary": "Update Template", - "description": "Update a template. Note that this will not update any tasks using the template. You will need to do a batch reload operation on the tasks to accomplish that.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=update-a-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/TemplatesSpecification" - }, - "responses": { - "200": { - "description": "Template Updated", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/SimplifiedGraph" - } - ] - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "examples": { - "Changed name": { - "value": { - "statusCode": 400, - "error": "Path name and submitted template name don't match" - } - }, - "Plugin not found": { - "value": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "replace", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "delete": { - "tags": [ - "Templates" - ], - "operationId": "delete_template", - "summary": "Delete Template", - "description": "Delete a template.", - "externalDocs": { - "url": "https://docs.waylay.io/#/api/rules/?id=delete-template", - "description": "Waylay Documentation" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId", - "x-showExample": false - } - ], - "responses": { - "204": { - "description": "Template Deleted" - }, - "400": { - "description": "Template Still In Use", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Template with name internet.json in use by 6 task(s)" - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "delete", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/templates/{name}/run": { - "post": { - "tags": [ - "Template Runs" - ], - "operationId": "run_template", - "summary": "Run Template", - "description": "Run a template.\nIf `data` is specified, template will be run as reactive template. \nIf `data` is not specified, template will be run as a one-time template (1 tick)", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=running-a-template" - }, - "parameters": [ - { - "$ref": "#/components/parameters/TemplateId", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/LogLevel", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/TargetNode", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/RunTemplateSpecification" - }, - "responses": { - "200": { - "description": "Stream Of Invocation Results", - "content": { - "application/x-ndjson": { - "schema": { - "$ref": "#/components/schemas/TemplateRunInvocation" - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Variable 'threshold' not found", - "code": "VALIDATION", - "details": [ - { - "type": "VARIABLE", - "message": "Variable 'threshold' not found", - "severity": "ERROR", - "details": { - "variable": "threshold" - } - } - ] - } - } - } - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "run", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/templates/run": { - "post": { - "tags": [ - "Template Runs" - ], - "operationId": "runGraph", - "summary": "Run Graph Or Bayesian Network", - "description": "Run a graph or Bayesian Network.\nIf `data` is specified, template will be run as reactive template. \nIf `data` is not specified, template will be run as a one-time template (1 tick)", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=running-a-batch-dataset-through-a-graphbns" - }, - "parameters": [ - { - "$ref": "#/components/parameters/LogLevel", - "x-showExample": false - }, - { - "$ref": "#/components/parameters/TargetNode", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/RunTemplateSpecificationGraph" - }, - "responses": { - "200": { - "description": "Stream Of Invocation Results", - "content": { - "application/x-ndjson": { - "schema": { - "$ref": "#/components/schemas/TemplateRunInvocation" - } - } - } - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorWithDetailsResponse" - }, - "example": { - "statusCode": 400, - "error": "Plugin dbDialog:1.2.3 not found", - "code": "TRANSFORMATION", - "details": [ - { - "type": "PLUGIN", - "message": "Plugin dbDialog:1.2.3 not found", - "severity": "ERROR", - "details": { - "nodeId": "debugDialog_1", - "plugin": { - "name": "dbDialog", - "version": "1.2.3" - } - } - } - ] - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "run_graph", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/discoveryTemplate": { - "get": { - "tags": [ - "Templates" - ], - "operationId": "getDiscovery_template", - "summary": "Retrieve Discovery Template", - "description": "Get the discovery template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=discovery-template" - }, - "responses": { - "200": { - "description": "Discovery Template Details", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - }, - { - "type": "object", - "properties": { - "discoveryTemplate": { - "type": "boolean", - "example": true - } - } - } - ] - } - } - } - }, - "204": { - "description": "No Discovery Template" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get_discovery", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - }, - "put": { - "tags": [ - "Templates" - ], - "operationId": "set_discovery_template", - "summary": "Set Discovery Template", - "description": "Set the discovery template.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=set-the-discovery-template" - }, - "parameters": [ - { - "name": "name", - "in": "query", - "schema": { - "$ref": "#/components/schemas/TemplateId" - }, - "example": "discoverResourceType", - "required": false, - "description": "The template to set as discovery template. If you do not specify this parameter, the current discovery template will be cleared.", - "x-example": "'discoverResourceType'", - "x-showExample": true - } - ], - "responses": { - "200": { - "description": "Discovery Template Set", - "content": { - "application/json": { - "schema": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityMetadata" - }, - { - "$ref": "#/components/schemas/GraphDefinition" - }, - { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "discoverResourceType" - }, - "discoveryTemplate": { - "type": "boolean", - "example": true - } - } - } - ] - } - } - } - }, - "204": { - "description": "Discovery Template Cleared" - }, - "404": { - "$ref": "#/components/responses/TemplateNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "set", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/batch": { - "post": { - "tags": [ - "Tasks Batch Operations" - ], - "operationId": "start_batch_operation", - "summary": "Start Batch Operations", - "description": "Start a batch operation.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations" - }, - "requestBody": { - "$ref": "#/components/requestBodies/BatchTasksSpecification" - }, - "responses": { - "202": { - "$ref": "#/components/responses/BatchStartResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "/action <- unknown action strt, we support updatePlugins, delete, start, restart, stop, reload" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "start", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/batch/{batchId}": { - "get": { - "tags": [ - "Tasks Batch Operations" - ], - "operationId": "get_batch_operation", - "summary": "Get Tasks Batch Operation Status", - "description": "Get the results of the Tasks Batch Operation.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=batch-tasks-operations" - }, - "parameters": [ - { - "$ref": "#/components/parameters/BatchId", - "x-showExample": false - } - ], - "responses": { - "200": { - "description": "Get Batch Operation", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/BatchOperationResult" - }, - { - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "title": "Result of a running Batch Operation" - } - ] - } - ] - }, - "examples": { - "Batch Operation still running": { - "value": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "task", - "action": "delete", - "description": "Remove tasks filtered by type=onetime AND status=stopped AND finishedBefore=1648738809733" - }, - "queueTime": 1663269720694 - } - }, - "Result of a finished Batch Operation": { - "value": { - "id": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "user": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe", - "operation": { - "entity": "task", - "action": "delete", - "description": "Remove tasks filtered by type=onetime AND status=stopped AND finishedBefore=1648738809733" - }, - "queueTime": 1663269720694, - "finishedTime": 1663269725784, - "results": { - "success": { - "4bbec310-4b8a-4f82-954d-f6268e7736a3": { - "statusCode": 200 - }, - "b637dc9c-b8fc-4d1e-8743-b1456364e559": { - "statusCode": 200 - } - }, - "failure": { - "0cf62e41-be40-42bf-a88f-6fc803bcb957": { - "statusCode": 404, - "error": "No task with id 0cf62e41-be40-42bf-a88f-6fc803bcb957" - } - } - } - } - } - } - } - } - }, - "404": { - "$ref": "#/components/responses/BatchNotFoundResponse" - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "get", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/sensors/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeSensor", - "summary": "Execute Latest Sensor Version", - "description": "Execute latest version of a sensor.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-sensor" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 13 - }, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": false, - "error": "ReferenceError: callbackUrdl is not defined" - } - } - } - }, - "404": { - "description": "Sensor Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Sensor mySensor not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_sensor", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/sensors/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeSensorVersion", - "summary": "Execute Specified Sensor Version", - "description": "Execute the specified version of a sensor.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-sensor" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - }, - { - "$ref": "#/components/parameters/VersionId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 13 - }, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - "example": { - "result": false, - "error": "ReferenceError: callbackUrdl is not defined" - } - } - } - }, - "404": { - "description": "Sensor Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Sensor mySensor:3.14.5 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_sensor_version", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/actions/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeActuator", - "summary": "Execute Latest Actuator Version", - "description": "Execute latest version of an actuator.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-actuator" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Actuator Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Actuator myActuator not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_actuator", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/actions/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeActuatorVersion", - "summary": "Execute Specified Actuator Version", - "description": "Execute specified version of an actuator.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-actuator" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - }, - { - "$ref": "#/components/parameters/VersionId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Actuator Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Actuator myActuator:4.12.0 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_actuator_version", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/transformers/{name}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeTransformer", - "summary": "Execute Latest Transformer Version", - "description": "Execute the latest transformer version.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-the-latest-transformer-version" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Transformer Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Transformer myTransformer not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_transformer", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/transformers/{name}/versions/{version}": { - "post": { - "tags": [ - "Plugs Execution" - ], - "operationId": "executeTransformerVersion", - "summary": "Execute Specified Transformer Version", - "description": "Execute specified version of a transformer.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=execute-a-specific-transformer-version" - }, - "parameters": [ - { - "name": "name", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "x-showExample": false - }, - { - "$ref": "#/components/parameters/VersionId", - "x-showExample": false - } - ], - "requestBody": { - "$ref": "#/components/requestBodies/ExecutePlugsSpecification" - }, - "responses": { - "200": { - "description": "Successfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": true, - "log": [] - } - } - } - }, - "400": { - "description": "Unsuccessfully Executed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TransformerExecutionResult" - }, - "example": { - "result": false, - "error": "Missing properties" - } - } - } - }, - "404": { - "description": "Transformer Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Transformer myTransformer:2.47.2 not found" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "execute_transformer_version", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - }, - "/rules/v1/data": { - "post": { - "tags": [ - "Push Data" - ], - "operationId": "push_data", - "summary": "Push Streaming Data", - "description": "Push (real-time) streaming data.", - "externalDocs": { - "description": "Waylay Documentation", - "url": "https://docs.waylay.io/#/api/rules/?id=streaming-real-time-data" - }, - "requestBody": { - "$ref": "#/components/requestBodies/StreamData" - }, - "responses": { - "200": { - "$ref": "#/components/responses/DefaultSuccessResponse" - }, - "400": { - "description": "Validation Failed", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 400, - "error": "Expecting json array or object" - } - } - } - } - }, - "security": [ - { - "waylayApiKeySecret": [] - } - ], - "x-py-method": "push", - "x-consumes-multipart": false, - "x-consumes-urlencoded": false, - "x-consumes-json": false, - "x-consumes-other": false - } - } - }, - "components": { - "schemas": { - "TaskId": { - "description": "Unique task identifier", - "type": "string", - "example": "808aec38-3fb3-4163-a45e-1890e94081ea" - }, - "InvocationId": { - "description": "Unique invocation identifier", - "type": "string", - "example": "45a85360-fe8a-4978-9636-90d741806033" - }, - "TemplateId": { - "description": "Unique template identifier", - "type": "string", - "example": "internet.json" - }, - "LogLevel": { - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR", - "NONE" - ], - "example": "INFO" - }, - "ResourceId": { - "description": "Unique resource identifier", - "type": "string", - "example": "resource1" - }, - "ResourceTypeId": { - "description": "Unique resource type identifier", - "type": "string", - "example": "resourcetype1" - }, - "NodeId": { - "description": "Unique node label", - "type": "string", - "example": "dice_1" - }, - "BatchId": { - "type": "string", - "example": "afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "UnixEpochMillis": { - "type": "integer", - "description": "Timestamp expressed as milliseconds since 00:00:00 UTC on 1 January 1970, \nnot counting leap seconds.", - "example": 1663269720694 - }, - "SO8601Timestamp": { - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "VersionResponse": { - "type": "object", - "properties": { - "version": { - "type": "string", - "example": "5.12.1" - }, - "name": { - "type": "string", - "example": "waylay-engine" - }, - "startTime": { - "type": "string", - "format": "date-time", - "example": "2011-09-06T12:03:27.845Z" - }, - "uptime": { - "type": "integer", - "format": "int64", - "example": 12703737 - }, - "status": { - "type": "string", - "enum": [ - "STARTING", - "STARTED", - "FAILED" - ], - "example": "STARTED" - } - }, - "required": [ - "name", - "version", - "status" - ] - }, - "Position": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "items": { - "type": "integer" - }, - "example": [ - 223, - 213 - ] - }, - "Version": { - "type": "string", - "pattern": "\\d+\\.\\d+\\.\\d+", - "example": "2.4.13" - }, - "PluginUpdateSpec": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the plugin to update", - "example": "mySensor" - }, - "fromVersion": { - "description": "plugin version selection to upgrade", - "oneOf": [ - { - "$ref": "#/components/schemas/Version" - }, - { - "type": "string", - "enum": [ - "any" - ] - } - ], - "example": "any" - }, - "toVersion": { - "description": "Plugin version to upgrade to", - "allOf": [ - { - "$ref": "#/components/schemas/Version" - } - ] - } - }, - "required": [ - "name", - "fromVersion", - "toVersion" - ] - }, - "PropertyUpdatesSpec": { - "type": "object", - "properties": { - "variables": { - "type": "object", - "description": "Set of variables to update. \nWill be merged with the current variables. \nTo delete any of the current variables (and fall back to the default value from the template) set the value to `null`" - }, - "tags": { - "type": "object", - "description": "Key-value pairs. \nWill be merged with the current tags. \nTo delete any of the current tags set the value to `null`" - } - }, - "anyOf": [ - { - "required": [ - "variables" - ] - }, - { - "required": [ - "tags" - ] - } - ] - }, - "TemplateModification": { - "type": "object", - "properties": { - "operation": { - "type": "string", - "enum": [ - "updatePlugins" - ] - }, - "updates": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PluginUpdateSpec" - } - }, - "reloadTasks": { - "type": "boolean", - "description": "Should all tasks created from the template be reloaded", - "default": false, - "example": true - } - }, - "required": [ - "operation", - "updates" - ] - }, - "TemplateTags": { - "type": "object", - "description": "Key-value pairs on which you can filter to finding templates back", - "example": { - "useCase": "UC13.5" - } - }, - "TemplateEntityCommonAttributes": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TemplateId" - }, - "discoveryTemplate": { - "type": "boolean", - "description": "flag to indicate if the template is the discovery template", - "example": false - }, - "tags": { - "$ref": "#/components/schemas/TemplateTags" - }, - "variables": { - "description": "Variable declarations", - "type": "array", - "items": { - "$ref": "#/components/schemas/VariableDeclaration" - } - }, - "taskDefaults": { - "$ref": "#/components/schemas/TaskDefaultsElement" - }, - "notes": { - "description": "List of notes as explanation for users", - "type": "array", - "items": { - "$ref": "#/components/schemas/NoteElement" - } - } - }, - "required": [ - "name" - ] - }, - "TemplateEntity": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityCommonAttributes" - }, - { - "$ref": "#/components/schemas/SimplifiedGraph" - } - ] - }, - "TemplateEntityMetadata": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateEntityCommonAttributes" - }, - { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/TemplateUser" - }, - "createTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "lastUpdateTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "required": [ - "name", - "user", - "createTime", - "lastUpdateTime", - "discoveryTemplate" - ] - } - ] - }, - "SensorNode": { - "required": [ - "label", - "name", - "version" - ], - "type": "object", - "properties": { - "label": { - "$ref": "#/components/schemas/NodeId" - }, - "name": { - "title": "Name of sensor", - "type": "string" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "properties": { - "title": "Key-value object of required properties", - "type": "object" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "sequence": { - "title": "Sequence number if omitted default is 1", - "type": "integer", - "default": 1 - }, - "position": { - "$ref": "#/components/schemas/Position" - }, - "dataTrigger": { - "title": "Boolean to indicate if sensor needs to be executed if data for `resource` is received", - "type": "boolean", - "default": true - }, - "tickTrigger": { - "title": "Boolean to indicate if sensor needs to be executed on task tick", - "type": "boolean", - "default": true - }, - "evictionTime": { - "title": "Time (in milliseconds) after which sensor goes back to default state", - "type": "integer", - "minimum": 0 - }, - "pollingPeriod": { - "title": "Time (in milliseconds) to give sensor it’s own tick", - "type": "integer", - "minimum": 1 - }, - "schedule": { - "title": "Schedule", - "type": "string", - "description": "Either a valid cron or RRule expression to set the sensor's own tick" - }, - "timeout": { - "title": "Time (in ISO 8601 duration format) before the plugin times out, defaults to PT50S (50 seconds)", - "type": "string", - "default": "PT50S" - }, - "timeoutState": { - "title": "State that will be returned as result if plug execution times out", - "type": "string" - }, - "loopDef": { - "title": "Loop definition", - "type": "string", - "minimum": 0, - "example": "[{\"name\": \"alpha\"}, {\"name\": \"beta\"}]", - "description": "A loop definition is a string that defines items over which node will be iterated multiple times. \nThe string is an JSON array of JSON objects.During template execution the sensor node with such \na defined loop definition will be invoked for every JSON Object in the JSON array.\nParameter is optional. Node will be executed only once if loop definition is not defined." - } - }, - "additionalProperties": false, - "description": "Representation of a sensor in a Rule Template.", - "example": { - "label": "dice_1", - "name": "dice", - "version": "1.0.9", - "position": [ - 100, - 150 - ], - "dataTrigger": false, - "tickTrigger": true, - "timeout": "PT5S" - } - }, - "ActuatorNode": { - "required": [ - "label", - "name", - "version" - ], - "type": "object", - "properties": { - "label": { - "$ref": "#/components/schemas/NodeId" - }, - "name": { - "title": "Name of actuator", - "type": "string" - }, - "version": { - "$ref": "#/components/schemas/Version" - }, - "properties": { - "title": "Key-value object of required properties", - "type": "object" - }, - "sequence": { - "title": "Sequence", - "type": "integer" - }, - "position": { - "$ref": "#/components/schemas/Position" - }, - "timeout": { - "title": "Time (in ISO 8601 duration format) before the plugin times out, defaults to PT50S (50 seconds)", - "type": "string", - "default": "PT50S" - } - }, - "additionalProperties": false, - "description": "Representation of an actuator in a Rule Template.", - "example": { - "label": "debugDialog_1", - "name": "debugDialog", - "version": "1.0.0", - "properties": { - "message": "Dice 1 has value ONE" - }, - "position": [ - 827, - 323 - ] - } - }, - "RelationNode": { - "required": [ - "label", - "type", - "parentLabels", - "combinations" - ], - "type": "object", - "properties": { - "label": { - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ], - "example": "AND_1" - }, - "type": { - "$ref": "#/components/schemas/GateType" - }, - "parentLabels": { - "title": "Labels of the sensors that are attached to this gate", - "type": "array", - "items": { - "$ref": "#/components/schemas/NodeId" - }, - "example": [ - "dice_1", - "dice_2" - ] - }, - "combinations": { - "title": "Combinations of connected sensor's states", - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string", - "description": "State of one of the connected sensors" - }, - "example": [ - "ONE", - "TWO" - ] - } - }, - "position": { - "$ref": "#/components/schemas/Position" - } - }, - "additionalProperties": false, - "description": "Representation of a gate in a Rule Template." - }, - "GateType": { - "enum": [ - "AND", - "OR", - "GENERAL", - "NAND" - ], - "type": "string", - "description": "Supported gate types." - }, - "GenericTrigger": { - "type": "object", - "properties": { - "sourceLabel": { - "title": "Label of source sensor or gate", - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ] - }, - "destinationLabel": { - "title": "Label of the destination sensor or actuator", - "allOf": [ - { - "$ref": "#/components/schemas/NodeId" - } - ] - }, - "invocationPolicy": { - "title": "Time (in seconds) that defines how long to wait before firing the same actuator again, even if the condition is met.", - "type": "integer", - "minimum": 1 - } - } - }, - "TriggerStateChange": { - "required": [ - "stateFrom", - "stateTo" - ], - "type": "object", - "properties": { - "stateFrom": { - "title": "State from which to trigger, or '*'", - "type": "string" - }, - "stateTo": { - "title": "State to, or '*'", - "type": "string" - } - }, - "description": "State change specification under which to trigger the next node." - }, - "StateChangeTrigger": { - "description": "A trigger that executes on state change.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "properties": { - "stateChangeTrigger": { - "$ref": "#/components/schemas/TriggerStateChange" - } - }, - "required": [ - "sourceLabel", - "destinationLabel", - "stateChangeTrigger" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_1", - "stateChangeTrigger": { - "stateFrom": "FALSE", - "stateTo": "*" - } - } - }, - "StatesTrigger": { - "description": "A trigger that is conditional on the states of the source.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "properties": { - "statesTrigger": { - "type": "array", - "description": "array of states of source node under which to fire", - "items": { - "type": "string" - } - } - }, - "required": [ - "sourceLabel", - "destinationLabel", - "statesTrigger" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_2", - "statesTrigger": [ - "TRUE" - ] - } - }, - "ExecutionTrigger": { - "description": "A trigger that always executes on successful execution of the source.", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTrigger" - }, - { - "type": "object", - "required": [ - "sourceLabel", - "destinationLabel" - ] - } - ], - "example": { - "sourceLabel": "AND_1", - "destinationLabel": "debugDialog_3" - } - }, - "NoteElement": { - "required": [ - "text", - "position" - ], - "type": "object", - "properties": { - "position": { - "$ref": "#/components/schemas/Position" - }, - "text": { - "title": "Text", - "type": "string", - "example": "Example template having some sensors and gates" - } - }, - "additionalProperties": false, - "description": "Representation of a note in a Rule Template." - }, - "VariableDeclaration": { - "description": "Variable declaration.", - "required": [ - "name", - "type" - ], - "type": "object", - "properties": { - "name": { - "description": "Variable Name", - "type": "string" - }, - "displayName": { - "description": "Display name. Will default to the name if not specified", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/VariableType" - }, - "format": { - "$ref": "#/components/schemas/VariableFormat" - }, - "mandatory": { - "description": "flag to indicate if value for variable is mandatory or not", - "type": "boolean", - "default": false - }, - "defaultValue": { - "description": "Default value for the variable", - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "type": "object" - } - ] - } - }, - "example": { - "name": "city", - "displayName": "City", - "type": "string", - "mandatory": true - } - }, - "VariableFormat": { - "required": [ - "type" - ], - "type": "object", - "properties": { - "type": { - "title": "Type", - "type": "string", - "example": "resource" - }, - "values": { - "title": "Possible values (enum declaration)", - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "object" - } - ] - } - } - }, - "description": "Format for a variable definition." - }, - "VariableType": { - "enum": [ - "string", - "boolean", - "integer", - "double", - "long", - "float", - "object" - ], - "type": "string", - "description": "Value type for a template variable." - }, - "TaskDefaultsElement": { - "description": "default task settings that will be applied when creating a task from the template", - "type": "object", - "properties": { - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - }, - "type": { - "$ref": "#/components/schemas/TaskScenarioType" - }, - "resetObservations": { - "type": "boolean" - }, - "parallel": { - "type": "boolean" - }, - "gatesNeedFullObservation": { - "type": "boolean" - }, - "cron": { - "$ref": "#/components/schemas/CronExpression" - }, - "rrule": { - "$ref": "#/components/schemas/RRuleExpression" - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZoneId" - }, - "frequency": { - "description": "polling frequency in milliseconds", - "type": "integer" - } - }, - "example": { - "type": "periodic", - "frequency": 900000, - "resetObservations": false - } - }, - "TaskScenarioType": { - "enum": [ - "scheduled", - "periodic", - "onetime", - "reactive" - ], - "type": "string", - "description": "Triggering deployment scenario for a task." - }, - "TaskStatus": { - "type": "string", - "enum": [ - "running", - "stopped", - "failed" - ], - "description": "Status of a task" - }, - "TemplateRunWithGraphSpecification": { - "allOf": [ - { - "$ref": "#/components/schemas/TemplateRunSpecification" - }, - { - "type": "object", - "properties": { - "graph": { - "$ref": "#/components/schemas/GraphDefinition" - } - }, - "required": [ - "graph" - ] - } - ] - }, - "ResourceDataInjection": { - "type": "object", - "description": "data to inject per resource", - "properties": { - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "timestamp": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "additionalProperties": true, - "required": [ - "resource" - ] - }, - "TemplateRunConfiguration": { - "type": "object", - "description": "Template run configurations", - "properties": { - "executeActuators": { - "type": "boolean", - "description": "Flag to trigger actual execution of actuators", - "default": false - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "resetObservations": { - "type": "boolean", - "description": "reset observations before injecting data", - "default": true - }, - "gatesNeedFullObservation": { - "type": "boolean", - "description": "Only evaluate gates when all inputs are observed", - "default": false - } - } - }, - "TemplateRunSpecification": { - "type": "object", - "properties": { - "data": { - "title": "Data Set", - "description": "The full dataset to process. If specified, template will be run as reactive template", - "type": "array", - "items": { - "type": "array", - "title": "Dataset For One Invocation", - "description": "dataset that will be processed by one invocation", - "items": { - "$ref": "#/components/schemas/ResourceDataInjection" - } - }, - "example": [ - [ - { - "resource": "resource1", - "temperature": 20 - }, - { - "resource": "resource2", - "co2": 100, - "humidity": 0.4 - } - ], - [ - { - "resource": "resource1", - "temperature": 21 - } - ] - ] - }, - "conf": { - "$ref": "#/components/schemas/TemplateRunConfiguration" - }, - "variables": { - "title": "Template variables", - "description": "The values for the variables declared in the template", - "type": "object", - "example": { - "threshold": 13 - } - }, - "resourceMetaData": { - "title": "Resource Metadata", - "description": "Metadata for any of the resources used in the template.\n\nThe current metadata for all resources used in the template is fetched at the start of the template run.\nThis provided metadata is used to overwrite this current metadata", - "type": "object", - "additionalProperties": { - "type": "object" - }, - "example": { - "resource1": { - "name": "outside_temperature", - "inside_sensor": { - "$$ref": "/resources/resource2" - } - } - } - } - } - }, - "SensorExecutionResult": { - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the sensor was successfully executed" - }, - "state": { - "type": "string", - "description": "observedState field returned by the sensor execution" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "rawData": { - "type": "object", - "description": "the rawData returned by the sensor execution" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "TemplateRunSensorResult": { - "allOf": [ - { - "$ref": "#/components/schemas/SensorExecutionResult" - }, - { - "type": "object", - "properties": { - "executed": { - "type": "boolean", - "description": "flag indicating if the sensor was executed" - } - }, - "required": [ - "executed" - ] - } - ] - }, - "ActuatorExecutionResult": { - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the actuator was successfully executed" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "rawData": { - "type": "object" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "TemplateRunActuatorResult": { - "allOf": [ - { - "$ref": "#/components/schemas/ActuatorExecutionResult" - }, - { - "type": "object", - "properties": { - "executed": { - "type": "boolean", - "description": "flag indicating if the actuator was executed" - } - }, - "required": [ - "executed" - ] - } - ] - }, - "TemplateRunInvocation": { - "type": "object", - "properties": { - "taskId": { - "$ref": "#/components/schemas/TaskId" - }, - "invocationId": { - "$ref": "#/components/schemas/InvocationId" - }, - "sensors": { - "title": "Sensors Results", - "description": "The execution result for each of the sensors of the template", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/TemplateRunSensorResult" - }, - "example": { - "alarm": { - "executed": true, - "result": true, - "state": "OK", - "rawData": {}, - "log": [] - }, - "streamingDataSensor": { - "executed": true, - "result": true, - "state": "ABOVE", - "rawData": { - "parameter": "temperature", - "threshold": 20 - } - } - } - }, - "actuators": { - "title": "Actuator Results", - "description": "The execution result for each of the actuators of the template", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/TemplateRunActuatorResult" - }, - "example": { - "send_sms": { - "executed": true, - "result": true, - "log": [] - } - } - }, - "log": { - "title": "Logs", - "type": "array", - "items": { - "type": "object", - "properties": { - "time": { - "$ref": "#/components/schemas/SO8601Timestamp" - }, - "level": { - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR" - ], - "example": "INFO" - }, - "message": { - "type": "string", - "example": "SMS sent" - } - }, - "additionalProperties": false, - "required": [ - "time", - "level", - "message" - ] - } - } - }, - "required": [ - "taskId", - "invocationId", - "sensors", - "actuators", - "log" - ] - }, - "TransformerExecutionResult": { - "type": "object", - "properties": { - "result": { - "type": "boolean", - "description": "flag indicating if the actuator was Successfully Executed" - }, - "error": { - "type": "string", - "description": "error message in case of failure" - }, - "data": { - "type": "object" - }, - "log": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "ExecutePlugsSpecification": { - "type": "object", - "properties": { - "properties": { - "title": "specific input parameters", - "type": "object", - "example": { - "threshold": 20 - } - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "streamData": { - "title": "Stream data", - "type": "object", - "example": { - "temperature": 21, - "timestamp": 1582988389 - } - } - } - }, - "BatchIdQuery": { - "type": "object", - "properties": { - "ids": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TaskId" - } - } - }, - "required": [ - "ids" - ] - }, - "BatchQuery": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "type": { - "$ref": "#/components/schemas/TaskScenarioType" - }, - "status": { - "$ref": "#/components/schemas/TaskStatus" - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - }, - "plugin": { - "description": "either name of a plugin (e.g. `mySensor`), or full version specification of the plug (e.g `mySensor:1.0.3`)", - "type": "string", - "example": "mySensor:1.0.3" - }, - "user": { - "$ref": "#/components/schemas/TaskUser" - }, - "finishedBefore": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "createdAfter": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "createdBefore": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - } - } - }, - "BatchTask": { - "type": "object", - "properties": { - "entity": { - "type": "string", - "enum": [ - "task" - ] - }, - "action": { - "type": "string" - }, - "query": { - "oneOf": [ - { - "$ref": "#/components/schemas/BatchIdQuery" - }, - { - "$ref": "#/components/schemas/BatchQuery" - } - ] - } - } - }, - "BatchTaskCommand": { - "description": "Execute command on multiple task", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "enum": [ - "delete", - "start", - "restart", - "stop", - "reload", - "stopAndDelete" - ] - } - }, - "required": [ - "entity", - "action", - "query" - ] - } - ] - }, - "BatchUpdatePlugin": { - "description": "Upgrade plugins on multiple tasks", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "type": "string", - "enum": [ - "updatePlugins" - ] - }, - "actionParameters": { - "$ref": "#/components/schemas/PluginUpdateSpec" - } - }, - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - } - ] - }, - "BatchUpdateProperties": { - "description": "Update variables and/or tags of multiple tasks", - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/BatchTask" - }, - { - "properties": { - "action": { - "type": "string", - "enum": [ - "updateProperties" - ] - }, - "actionParameters": { - "$ref": "#/components/schemas/PropertyUpdatesSpec" - } - }, - "required": [ - "entity", - "action", - "query", - "actionParameters" - ] - } - ] - }, - "BatchOperation": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/BatchId" - }, - "user": { - "type": "string", - "description": "User id of the user who started the operation", - "example": "user/22f6dfdf-a50c-4eab-953e-8d2e56891dbe" - }, - "operation": { - "type": "object", - "description": "Summary of the batch operation", - "properties": { - "entity": { - "type": "string", - "enum": [ - "task" - ] - }, - "action": { - "type": "string", - "enum": [ - "updatePlugins", - "delete", - "start", - "restart", - "stop", - "reload", - "updateProperties" - ], - "example": "delete" - }, - "description": { - "type": "string", - "description": "description of the operations", - "example": "Remove tasks filtered by ids=808aec38-3fb3-4163-a45e-1890e94081ea" - } - }, - "required": [ - "entity", - "action", - "description" - ] - }, - "queueTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - } - }, - "required": [ - "id", - "user", - "operation", - "queueTime" - ] - }, - "SuccessOperationResult": { - "type": "object", - "description": "Object containing the successful operation results. \nThe keys will be task ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be task ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - } - }, - "required": [ - "statusCode" - ] - } - }, - "FailureOperationResult": { - "type": "object", - "description": "Object containing the unsuccessful operation results. \nThe keys will be tasks ids.", - "additionalProperties": { - "type": "object", - "description": "The keys will be task ids.", - "properties": { - "statusCode": { - "type": "integer", - "description": "The statusCode of the operation" - }, - "error": { - "type": "string", - "description": "Error description of what went wrong." - } - }, - "required": [ - "statusCode", - "error" - ] - } - }, - "OperationResultObject": { - "description": "Finished Batch Operation results", - "type": "object", - "properties": { - "finishedTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "results": { - "type": "object", - "properties": { - "success": { - "$ref": "#/components/schemas/SuccessOperationResult" - }, - "failure": { - "$ref": "#/components/schemas/FailureOperationResult" - } - }, - "required": [ - "success", - "failure" - ] - } - }, - "required": [ - "finishedTime", - "results" - ] - }, - "BatchOperationResult": { - "allOf": [ - { - "$ref": "#/components/schemas/BatchOperation" - }, - { - "$ref": "#/components/schemas/OperationResultObject" - } - ] - }, - "TaskFromTemplate": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/TaskSettings" - }, - { - "properties": { - "start": { - "title": "boolean to indicate whether task must be started after creation", - "type": "boolean", - "default": true - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "required": [ - "template", - "name" - ] - } - ] - }, - "SimplifiedGraph": { - "description": "Graph in simplified format", - "type": "object", - "properties": { - "sensors": { - "description": "List of sensors with required properties", - "type": "array", - "items": { - "$ref": "#/components/schemas/SensorNode" - } - }, - "actuators": { - "description": "List of actuators with required properties", - "type": "array", - "items": { - "$ref": "#/components/schemas/ActuatorNode" - } - }, - "relations": { - "description": "List of relations (gates) between sensors", - "type": "array", - "items": { - "$ref": "#/components/schemas/RelationNode" - } - }, - "triggers": { - "description": "List of conditions under which actuators/sensors get executed.", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/StateChangeTrigger" - }, - { - "$ref": "#/components/schemas/StatesTrigger" - }, - { - "$ref": "#/components/schemas/ExecutionTrigger" - } - ] - } - } - } - }, - "BayesianGraph": { - "description": "Graph in BN format", - "type": "object", - "properties": { - "nodes": { - "type": "array", - "items": { - "type": "object" - } - }, - "posterior": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "GraphDefinition": { - "oneOf": [ - { - "$ref": "#/components/schemas/SimplifiedGraph" - }, - { - "$ref": "#/components/schemas/BayesianGraph" - } - ] - }, - "TaskWithRule": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/SimplifiedGraph" - }, - { - "properties": { - "notes": { - "title": "List of notes as explanation for users", - "type": "array", - "items": { - "$ref": "#/components/schemas/NoteElement" - } - }, - "task": { - "allOf": [ - { - "$ref": "#/components/schemas/TaskSettings" - }, - { - "type": "object", - "properties": { - "start": { - "title": "boolean to indicate whether task must be started after creation", - "type": "boolean", - "default": true - } - }, - "required": [ - "name" - ] - } - ] - } - }, - "required": [ - "task" - ] - } - ] - }, - "PeriodicTaskSetting": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "periodic" - ] - }, - "frequency": { - "type": "integer", - "description": "polling frequency in milliseconds", - "example": 900000 - } - }, - "required": [ - "type", - "frequency" - ] - }, - "TimeZoneId": { - "type": "string", - "description": "Optional identifier of the time zone in which the schedule expression is to be interpreted", - "example": "Europe/Brussels" - }, - "RRuleExpression": { - "type": "string", - "description": "RRule expression as defined in [RFC5545 3.8.5.3](https://www.rfc-editor.org/rfc/rfc5545#section-3.8.5.3)", - "example": "FREQ=MINUTELY;INTERVAL=15" - }, - "CronExpression": { - "type": "string", - "description": "cron expression as defined in [Cron format](https://www.quartz-scheduler.org/documentation/quartz-1.8.6/tutorials/TutorialLesson06)", - "example": "15 * * * * ?" - }, - "ScheduledTaskSetting": { - "type": "object", - "allOf": [ - { - "properties": { - "type": { - "type": "string", - "enum": [ - "scheduled" - ] - }, - "timeZone": { - "$ref": "#/components/schemas/TimeZoneId" - } - }, - "required": [ - "type" - ] - }, - { - "oneOf": [ - { - "properties": { - "rrule": { - "$ref": "#/components/schemas/RRuleExpression" - } - }, - "required": [ - "rrule" - ] - }, - { - "properties": { - "cron": { - "$ref": "#/components/schemas/CronExpression" - } - }, - "required": [ - "cron" - ] - } - ] - } - ] - }, - "OneTimeTaskSetting": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "onetime" - ] - } - }, - "required": [ - "type" - ] - }, - "ReactiveTaskSetting": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "reactive" - ] - } - }, - "required": [ - "type" - ] - }, - "TaskTypeSettings": { - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/ScheduledTaskSetting" - }, - { - "$ref": "#/components/schemas/PeriodicTaskSetting" - }, - { - "$ref": "#/components/schemas/OneTimeTaskSetting" - }, - { - "$ref": "#/components/schemas/ReactiveTaskSetting" - } - ] - }, - "VariablesTaskObject": { - "type": "object", - "description": "set of variables which will be used when starting a task and will automatically be injected in the template before starting a task.", - "example": { - "email": "foo@gmail.com" - } - }, - "TagsTaskObject": { - "type": "object", - "description": "Key-value pairs on which you can set at task creation and later filter tasks", - "example": { - "myRef": "d8933cd4-7c70-11e9-8f9e-2a86e4085a59" - } - }, - "TaskName": { - "type": "string", - "example": "Example task 1" - }, - "GenericTaskSettings": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "resetObservations": { - "title": "whether to clear observations before next invocation", - "type": "boolean", - "default": true - }, - "parallel": { - "title": "whether to run sensors in parallel or sequentially", - "type": "boolean", - "default": true - }, - "gatesNeedFullObservation": { - "title": "Only evaluate gates when all inputs are observed", - "type": "boolean", - "default": false - }, - "tags": { - "$ref": "#/components/schemas/TagsTaskObject" - }, - "variables": { - "$ref": "#/components/schemas/VariablesTaskObject" - } - } - }, - "TaskSettings": { - "type": "object", - "allOf": [ - { - "$ref": "#/components/schemas/GenericTaskSettings" - }, - { - "$ref": "#/components/schemas/TaskTypeSettings" - } - ] - }, - "ValidationIssue": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Indication of \"area\" where validation issue is situated", - "example": "BINDING" - }, - "message": { - "description": "Description of the issue", - "type": "string", - "example": "rawData fas no field status" - }, - "severity": { - "type": "string", - "description": "Severity of the issue. ERROR means that object cannot be created if the issue is not fixed. WARNING means that the object can be created, but that errors might be encountered at runtime", - "enum": [ - "ERROR", - "WARNING" - ], - "example": "WARNING" - }, - "details": { - "type": "object", - "description": "Object containing identifying information on what gives the issue", - "example": { - "nodeId": "debugDialog_1", - "property": "message", - "binding": "${nodes.dice_1.rawData.status}" - } - }, - "suggestion": { - "type": "string", - "description": "Suggestion on how to change the object to get the issue fixed", - "example": "maybe you are looking for one of these: state, randomValue" - } - }, - "required": [ - "type", - "message", - "severity" - ] - }, - "ErrorResponse": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 400 - }, - "error": { - "type": "string" - }, - "code": { - "type": "string", - "description": "Optional error code" - } - }, - "required": [ - "statusCode", - "error" - ] - }, - "ErrorWithDetailsResponse": { - "allOf": [ - { - "$ref": "#/components/schemas/ErrorResponse" - }, - { - "properties": { - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ValidationIssue" - } - } - } - } - ] - }, - "PagingSkip": { - "type": "integer", - "description": "Number of items skipped before this page of results.", - "default": 0, - "example": 85 - }, - "PagingLimit": { - "type": "integer", - "description": "Size of one page of results.", - "example": 10, - "default": 10 - }, - "PagingTotal": { - "type": "integer", - "description": "Total number of items matching the query of which this is one page of results.", - "example": 2398 - }, - "PagingResult": { - "type": "object", - "properties": { - "skip": { - "$ref": "#/components/schemas/PagingSkip" - }, - "limit": { - "$ref": "#/components/schemas/PagingLimit" - }, - "total": { - "$ref": "#/components/schemas/PagingTotal" - } - }, - "required": [ - "skip", - "limit", - "total" - ] - }, - "TaskUser": { - "type": "string", - "description": "Creation user mail address or 'system' for system generated tasks", - "example": "user@waylay.io" - }, - "TemplateUser": { - "type": "string", - "description": "Creation user mail address", - "example": "user@waylay.io" - }, - "TaskResourceIds": { - "description": "List of resources that are used in the task", - "type": "array", - "items": { - "$ref": "#/components/schemas/ResourceId" - } - }, - "TaskEntity": { - "type": "object", - "properties": { - "ID": { - "$ref": "#/components/schemas/TaskId" - }, - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "status": { - "$ref": "#/components/schemas/TaskStatus" - }, - "user": { - "$ref": "#/components/schemas/TaskUser" - }, - "createTime": { - "$ref": "#/components/schemas/UnixEpochMillis" - }, - "template": { - "$ref": "#/components/schemas/TemplateId" - }, - "network": { - "description": "The graph, either from the template or from the task definition. Depending on the `format` query parameter either BN or simplified format", - "type": "object" - }, - "resourceIds": { - "$ref": "#/components/schemas/TaskResourceIds" - } - }, - "required": [ - "ID", - "status", - "user", - "createTime", - "name", - "network" - ] - }, - "TaskSpecification": { - "oneOf": [ - { - "$ref": "#/components/schemas/TaskFromTemplate" - }, - { - "$ref": "#/components/schemas/TaskWithRule" - } - ] - } - }, - "requestBodies": { - "TaskSpecification": { - "description": "Task Specification", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TaskSpecification" - } - } - }, - "required": true - }, - "BatchTasksSpecification": { - "description": "Tasks Batch Operation", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "a tasks batch operation specification", - "type": "object", - "oneOf": [ - { - "$ref": "#/components/schemas/BatchUpdatePlugin" - }, - { - "$ref": "#/components/schemas/BatchTaskCommand" - }, - { - "$ref": "#/components/schemas/BatchUpdateProperties" - } - ] - }, - "examples": { - "Delete multiple tasks by query": { - "value": { - "entity": "task", - "action": "delete", - "query": { - "type": "onetime", - "status": "stopped", - "finishedBefore": 1648738809733 - } - } - }, - "Delete multiple tasks by id": { - "value": { - "entity": "task", - "action": "delete", - "query": { - "ids": [ - "4bbec310-4b8a-4f82-954d-f6268e7736a3", - "b637dc9c-b8fc-4d1e-8743-b1456364e559", - "0cf62e41-be40-42bf-a88f-6fc803bcb957" - ] - } - } - }, - "Stop all task running for resource myResource": { - "value": { - "entity": "task", - "action": "stop", - "query": { - "status": "running", - "resource": "myResource" - } - } - }, - "Plugin updates": { - "value": { - "entity": "task", - "action": "updatePlugins", - "query": { - "ids": [ - "4bbec310-4b8a-4f82-954d-f6268e7736a3", - "b637dc9c-b8fc-4d1e-8743-b1456364e559", - "0cf62e41-be40-42bf-a88f-6fc803bcb957" - ] - }, - "actionParameters": { - "updates": [ - { - "name": "myActuator", - "fromVersion": "1.0.1", - "toVersion": "1.0.3" - }, - { - "name": "mySensor", - "fromVersion": "any", - "toVersion": "2.3.4" - } - ] - } - } - }, - "Properties update": { - "value": { - "entity": "task", - "action": "updateProperties", - "query": { - "status": "running", - "template": "myChangedTemplate", - "tags": { - "revision": 57 - } - }, - "actionParameters": { - "variables": { - "variableWithDefault": null, - "newVariable": 13 - }, - "tags": { - "revision": 58, - "dummyTag": null, - "newTag": "released" - } - } - } - } - } - } - } - }, - "TemplatesSpecification": { - "description": "Template Specification", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateEntity" - } - } - }, - "required": true - }, - "RunTemplateSpecification": { - "description": "Specification to run template", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateRunSpecification" - } - } - } - }, - "RunTemplateSpecificationGraph": { - "description": "Specification to run template through graph/BN.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TemplateRunWithGraphSpecification" - } - } - } - }, - "ExecutePlugsSpecification": { - "description": "Specification to execute a plug.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ExecutePlugsSpecification" - } - } - } - }, - "NodeCallsSpecification": { - "description": "Command string to apply to a node of a task.", - "required": true, - "content": { - "text/plain": { - "schema": { - "type": "string", - "anyOf": [ - { - "pattern": "^state=", - "description": "State update command" - }, - { - "pattern": "^operation=", - "description": "Operation command" - } - ] - }, - "example": "state=Alive" - } - } - }, - "StreamData": { - "description": "Push (real-time) Data Specification", - "required": true, - "content": { - "application/json": { - "schema": { - "title": "stream data", - "type": "object", - "properties": { - "resource": { - "$ref": "#/components/schemas/ResourceId" - }, - "data": { - "oneOf": [ - { - "type": "object", - "example": { - "parameterName": "temperature", - "value": 23, - "collectedTime": 1420629467 - } - }, - { - "type": "array", - "items": { - "type": "object" - }, - "example": [ - { - "parameterName": "latitude", - "value": 51 - }, - { - "parameterName": "longitude", - "value": 3.73 - } - ] - } - ] - } - }, - "required": [ - "resource", - "data" - ] - } - } - } - } - }, - "parameters": { - "TaskId": { - "name": "taskId", - "in": "path", - "description": "Unique Task identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/TaskId" - } - }, - "TemplateId": { - "name": "name", - "in": "path", - "description": "Unique Template identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/TemplateId" - } - }, - "LogLevel": { - "name": "logLevel", - "in": "query", - "description": "sets the log level for filtering out logs to requested log level or higher from the template run output.\nValue `NONE` will disable all logs.\nIf not specified all logs will be returned.", - "required": false, - "schema": { - "type": "string", - "enum": [ - "DEBUG", - "INFO", - "WARN", - "ERROR" - ], - "default": "DEBUG" - } - }, - "TargetNode": { - "name": "targetNode", - "in": "query", - "description": "The sensors and actuators part of response will contain only elements related to the asked node of the graph. \nThe returned logs also will be filtered and contain only logs related to the asked node(s).", - "required": false, - "schema": { - "type": "array", - "items": { - "type": "string", - "example": "myFirstNode" - } - } - }, - "NodeId": { - "name": "nodeId", - "in": "path", - "description": "Unique node label", - "required": true, - "schema": { - "$ref": "#/components/schemas/NodeId" - } - }, - "BatchId": { - "name": "batchId", - "in": "path", - "description": "Unique Batch Operation identifier", - "required": true, - "schema": { - "$ref": "#/components/schemas/BatchId" - } - }, - "VersionId": { - "name": "version", - "in": "path", - "description": "Version number of plugin", - "required": true, - "schema": { - "$ref": "#/components/schemas/Version" - } - }, - "PagingHits": { - "name": "hits", - "in": "query", - "description": "(Paging) maximal number of items returned", - "schema": { - "$ref": "#/components/schemas/PagingLimit" - } - }, - "PagingStart": { - "name": "startIndex", - "in": "query", - "description": "(Paging) items to skip in the listing", - "schema": { - "$ref": "#/components/schemas/PagingSkip" - } - }, - "Format": { - "name": "format", - "in": "query", - "description": "Format of the graph definition", - "schema": { - "type": "string", - "enum": [ - "bn", - "simplified" - ], - "default": "bn" - } - } - }, - "responses": { - "DefaultSuccessResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "VersionResponse": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionResponse" - } - } - } - }, - "TaskCreatedResponse": { - "description": "Task Created", - "headers": { - "Location": { - "description": "URI where the created Task can be fetched", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "ID": { - "$ref": "#/components/schemas/TaskId" - }, - "warnings": { - "type": "array", - "description": "List of task warning issues. Will only be there if query parameter `returnWarnings` was set to `true`", - "items": { - "$ref": "#/components/schemas/ValidationIssue" - } - } - }, - "required": [ - "ID" - ] - } - } - } - }, - "TaskNotFoundResponse": { - "description": "Task Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "Task with id de1b26b1-31f0-4054-af44-da02331f06b5 not found" - } - } - } - }, - "TemplateCreatedResponse": { - "description": "Template Created", - "headers": { - "Location": { - "description": "URI where the created Template can be fetched", - "schema": { - "type": "string" - } - } - }, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 201 - }, - "uri": { - "type": "string", - "format": "uri", - "example": "/rules/v1/templates/internet.json" - }, - "entity": { - "$ref": "#/components/schemas/TemplateEntity" - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - } - }, - "TemplateNotFoundResponse": { - "description": "Template Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "No template with name theInternet.json" - } - } - } - }, - "BatchStartResponse": { - "description": "Batch Operation Started", - "content": { - "application/json": { - "schema": { - "title": "Batch operation enqueued", - "type": "object", - "properties": { - "statusCode": { - "type": "integer", - "example": 202 - }, - "uri": { - "type": "string", - "description": "URI where the batch operation status can be followed", - "format": "uri", - "example": "/rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d" - }, - "entity": { - "$ref": "#/components/schemas/BatchOperation" - } - }, - "required": [ - "statusCode", - "uri", - "entity" - ] - } - } - }, - "headers": { - "Location": { - "description": "URI where the batch operation status can be followed", - "example": "/rules/v1/batch/afcea5a1-81df-44f6-bd34-e0b602a2cf3d", - "schema": { - "type": "string", - "format": "uri" - } - } - } - }, - "BatchNotFoundResponse": { - "description": "Batch Operation Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - }, - "example": { - "statusCode": 404, - "error": "No batch operation with id 'afcea5a1-81df-44f6-bd34-e0b602a2cf3d'" - } - } - } - } - }, - "securitySchemes": { - "waylayApiKeySecret": { - "type": "http", - "description": "Waylay apiKey/apiSecret basic authentication. All endpoints support also Waylay JWT Bearer authentication.", - "scheme": "basic" - } - } - }, - "servers": [ - { - "url": "https://api.waylay.io", - "description": "Waylay enterprise gateway" - } - ] -} - diff --git a/test/_run/rules.openapi.yaml b/test/_run/rules.openapi.yaml deleted file mode 120000 index f5cdf68..0000000 --- a/test/_run/rules.openapi.yaml +++ /dev/null @@ -1 +0,0 @@ -openapi/rules.openapi.yaml.json \ No newline at end of file diff --git a/test/_run/rules.transformed.openapi.yaml b/test/_run/rules.transformed.openapi.yaml deleted file mode 120000 index 69ff6eb..0000000 --- a/test/_run/rules.transformed.openapi.yaml +++ /dev/null @@ -1 +0,0 @@ -openapi/rules.transformed.openapi.yaml.json \ No newline at end of file diff --git a/test/api/version_api_test.py b/test/api/about_api_test.py similarity index 83% rename from test/api/version_api_test.py rename to test/api/about_api_test.py index e4c526b..3479101 100644 --- a/test/api/version_api_test.py +++ b/test/api/about_api_test.py @@ -18,7 +18,7 @@ from typeguard import check_type from waylay.sdk import ApiClient, WaylayClient from waylay.sdk.api._models import Model -from waylay.services.rules.api import VersionApi +from waylay.services.rules.api import AboutApi from waylay.services.rules.service import RulesService from ..types.version_response_stub import VersionResponseStub @@ -36,13 +36,13 @@ @pytest.fixture -def version_api(waylay_api_client: ApiClient) -> VersionApi: - return VersionApi(waylay_api_client) +def about_api(waylay_api_client: ApiClient) -> AboutApi: + return AboutApi(waylay_api_client) def test_registered(waylay_client: WaylayClient): - """Test that VersionApi api is registered in the sdk client.""" - assert isinstance(waylay_client.rules.version, VersionApi) + """Test that AboutApi api is registered in the sdk client.""" + assert isinstance(waylay_client.rules.about, AboutApi) def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): @@ -60,12 +60,12 @@ def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): @pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") async def test_get(service: RulesService, gateway_url: str, httpx_mock: HTTPXMock): """Test case for get - Get Version + Get Service Information """ # set path params kwargs = {} _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.version.get(**kwargs) + resp = await service.about.get(**kwargs) check_type(resp, Union[VersionResponse,]) @@ -75,10 +75,10 @@ async def test_get_without_types( service: RulesService, gateway_url: str, httpx_mock: HTTPXMock ): """Test case for get with models not installed - Get Version + Get Service Information """ # set path params kwargs = {} _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.version.get(**kwargs) + resp = await service.about.get(**kwargs) check_type(resp, Model) diff --git a/test/api/template_runs_api_test.py b/test/api/template_runs_api_test.py index 60dd77c..94302c6 100644 --- a/test/api/template_runs_api_test.py +++ b/test/api/template_runs_api_test.py @@ -11,7 +11,7 @@ import json import re from importlib.util import find_spec -from typing import Union +from typing import AsyncIterator, Union, get_args from urllib.parse import quote import pytest @@ -54,8 +54,9 @@ def _run_graph_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): httpx_mock_kwargs = { "method": "POST", "url": re.compile(f"^{gateway_url}/rules/v1/templates/run(\\?.*)?"), - "content": json.dumps(mock_response, default=str), + "content": json.dumps(mock_response, default=str) + "\n", "status_code": 200, + "headers": {"content-type": "application/x-ndjson"}, } httpx_mock.add_response(**httpx_mock_kwargs) @@ -78,7 +79,10 @@ async def test_run_graph( } _run_graph_set_mock_response(httpx_mock, gateway_url) resp = await service.template_runs.run_graph(**kwargs) - check_type(resp, Union[TemplateRunInvocation,]) + check_type(resp, Union[AsyncIterator[TemplateRunInvocation],]) + async for item in resp: + check_type(item, get_args(Union[AsyncIterator[TemplateRunInvocation],])[0]) + break # Test only the first value @pytest.mark.asyncio @@ -99,6 +103,9 @@ async def test_run_graph_without_types( _run_graph_set_mock_response(httpx_mock, gateway_url) resp = await service.template_runs.run_graph(**kwargs) check_type(resp, Model) + async for item in resp: + check_type(item, Model) + break # Test only the first value def _run_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str, name: str): @@ -106,8 +113,9 @@ def _run_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str, name: str): httpx_mock_kwargs = { "method": "POST", "url": re.compile(f"^{gateway_url}/rules/v1/templates/{name}/run(\\?.*)?"), - "content": json.dumps(mock_response, default=str), + "content": json.dumps(mock_response, default=str) + "\n", "status_code": 200, + "headers": {"content-type": "application/x-ndjson"}, } httpx_mock.add_response(**httpx_mock_kwargs) @@ -130,7 +138,10 @@ async def test_run(service: RulesService, gateway_url: str, httpx_mock: HTTPXMoc } _run_set_mock_response(httpx_mock, gateway_url, quote(str(name))) resp = await service.template_runs.run(name, **kwargs) - check_type(resp, Union[TemplateRunInvocation,]) + check_type(resp, Union[AsyncIterator[TemplateRunInvocation],]) + async for item in resp: + check_type(item, get_args(Union[AsyncIterator[TemplateRunInvocation],])[0]) + break # Test only the first value @pytest.mark.asyncio @@ -153,3 +164,6 @@ async def test_run_without_types( _run_set_mock_response(httpx_mock, gateway_url, quote(str(name))) resp = await service.template_runs.run(name, **kwargs) check_type(resp, Model) + async for item in resp: + check_type(item, Model) + break # Test only the first value diff --git a/test/openapi.py b/test/openapi.py index afb2724..0ca576b 100644 --- a/test/openapi.py +++ b/test/openapi.py @@ -1000,7 +1000,7 @@ def with_example_provider(dct): _periodic_task_setting_model_schema = json.loads( r"""{ - "required" : [ "type" ], + "required" : [ "frequency", "type" ], "type" : "object", "properties" : { "type" : { @@ -1240,6 +1240,40 @@ def with_example_provider(dct): "ResourceDataInjection": _resource_data_injection_model_schema }) +_retry_config_model_schema = json.loads( + r"""{ + "required" : [ "maxBackoff", "maxRetries", "minBackoff" ], + "type" : "object", + "properties" : { + "maxRetries" : { + "minimum" : 0, + "type" : "integer", + "example" : 3 + }, + "minBackoff" : { + "type" : "string", + "format" : "duration", + "example" : "PT1S" + }, + "maxBackoff" : { + "type" : "string", + "format" : "duration", + "example" : "PT10S" + }, + "errorState" : { + "type" : "string", + "description" : "Optional sensor state which will be used to set the state of the node when the maxRetries is reached.", + "format" : "string", + "example" : "Error" + } + }, + "description" : "Configuration for retrying a template node.\nThe node execution will be retried `maxRetries` times.\nThe delay between retries will be exponentially increased starting from `minBackoff` to `maxBackoff`.\nIf the node execution fails after `maxRetries` retries, the node state will be set to `errorState` if it that property is provided.\nOtherwise node execution will fail. Error state should be one of the possible states defined by the sensor node." +} +""", + object_hook=with_example_provider, +) +MODEL_DEFINITIONS.update({"RetryConfig": _retry_config_model_schema}) + _run_template_log_level_parameter_model_schema = json.loads( r"""{ "type" : "string", @@ -1395,6 +1429,9 @@ def with_example_provider(dct): "type" : "string", "description" : "A loop definition is a string that defines items over which node will be iterated multiple times.\nThe string is an JSON array of JSON objects.During template execution the sensor node with such\na defined loop definition will be invoked for every JSON Object in the JSON array.\nParameter is optional. Node will be executed only once if loop definition is not defined.", "example" : "[{\"name\": \"alpha\"}, {\"name\": \"beta\"}]" + }, + "retryConfig" : { + "$ref" : "#/components/schemas/RetryConfig" } }, "additionalProperties" : false, @@ -1712,8 +1749,7 @@ def with_example_provider(dct): "example" : { "name" : "myTask", "template" : "myTemplate", - "type" : "reactive", - "frequency" : 900000 + "type" : "reactive" }, "allOf" : [ { "$ref" : "#/components/schemas/TaskSettings" diff --git a/test/types/periodic_task_setting_stub.py b/test/types/periodic_task_setting_stub.py index d09c9f9..0609eb0 100644 --- a/test/types/periodic_task_setting_stub.py +++ b/test/types/periodic_task_setting_stub.py @@ -25,7 +25,7 @@ periodic_task_setting_model_schema = json.loads( r"""{ - "required" : [ "type" ], + "required" : [ "frequency", "type" ], "type" : "object", "properties" : { "type" : { diff --git a/test/types/retry_config_stub.py b/test/types/retry_config_stub.py new file mode 100644 index 0000000..ccac6e3 --- /dev/null +++ b/test/types/retry_config_stub.py @@ -0,0 +1,76 @@ +# coding: utf-8 +"""Waylay rules engine model tests. + +This code was generated from the OpenAPI documentation of 'Waylay rules engine' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" + +import json + +from jsf import JSF +from pydantic import TypeAdapter + +from ..openapi import MODEL_DEFINITIONS, with_example_provider + +try: + from waylay.services.rules.models.retry_config import RetryConfig + + RetryConfigAdapter = TypeAdapter(RetryConfig) + MODELS_AVAILABLE = True +except ImportError as exc: + MODELS_AVAILABLE = False + +retry_config_model_schema = json.loads( + r"""{ + "required" : [ "maxBackoff", "maxRetries", "minBackoff" ], + "type" : "object", + "properties" : { + "maxRetries" : { + "minimum" : 0, + "type" : "integer", + "example" : 3 + }, + "minBackoff" : { + "type" : "string", + "format" : "duration", + "example" : "PT1S" + }, + "maxBackoff" : { + "type" : "string", + "format" : "duration", + "example" : "PT10S" + }, + "errorState" : { + "type" : "string", + "description" : "Optional sensor state which will be used to set the state of the node when the maxRetries is reached.", + "format" : "string", + "example" : "Error" + } + }, + "description" : "Configuration for retrying a template node.\nThe node execution will be retried `maxRetries` times.\nThe delay between retries will be exponentially increased starting from `minBackoff` to `maxBackoff`.\nIf the node execution fails after `maxRetries` retries, the node state will be set to `errorState` if it that property is provided.\nOtherwise node execution will fail. Error state should be one of the possible states defined by the sensor node." +} +""", + object_hook=with_example_provider, +) +retry_config_model_schema.update({"definitions": MODEL_DEFINITIONS}) + +retry_config_faker = JSF(retry_config_model_schema, allow_none_optionals=1) + + +class RetryConfigStub: + """RetryConfig unit test stubs.""" + + @classmethod + def create_json(cls): + """Create a dict stub instance.""" + return retry_config_faker.generate() + + @classmethod + def create_instance(cls) -> "RetryConfig": + """Create RetryConfig stub instance.""" + if not MODELS_AVAILABLE: + raise ImportError("Models must be installed to create class stubs") + return RetryConfigAdapter.validate_python(cls.create_json()) diff --git a/test/types/sensor_node_stub.py b/test/types/sensor_node_stub.py index 6999af1..5c095a9 100644 --- a/test/types/sensor_node_stub.py +++ b/test/types/sensor_node_stub.py @@ -94,6 +94,9 @@ "type" : "string", "description" : "A loop definition is a string that defines items over which node will be iterated multiple times.\nThe string is an JSON array of JSON objects.During template execution the sensor node with such\na defined loop definition will be invoked for every JSON Object in the JSON array.\nParameter is optional. Node will be executed only once if loop definition is not defined.", "example" : "[{\"name\": \"alpha\"}, {\"name\": \"beta\"}]" + }, + "retryConfig" : { + "$ref" : "#/components/schemas/RetryConfig" } }, "additionalProperties" : false, diff --git a/test/types/task_from_template_stub.py b/test/types/task_from_template_stub.py index 96dc80b..183678f 100644 --- a/test/types/task_from_template_stub.py +++ b/test/types/task_from_template_stub.py @@ -29,8 +29,7 @@ "example" : { "name" : "myTask", "template" : "myTemplate", - "type" : "reactive", - "frequency" : 900000 + "type" : "reactive" }, "allOf" : [ { "$ref" : "#/components/schemas/TaskSettings" diff --git a/waylay-sdk-rules-types/.openapi-generator/FILES b/waylay-sdk-rules-types/.openapi-generator/FILES index b89770d..0a093b5 100644 --- a/waylay-sdk-rules-types/.openapi-generator/FILES +++ b/waylay-sdk-rules-types/.openapi-generator/FILES @@ -1,5 +1,4 @@ LICENSE.txt -README.md pyproject.toml src/waylay/services/rules/models/__init__.py src/waylay/services/rules/models/a_tasks_batch_operation_specification.py @@ -59,6 +58,7 @@ src/waylay/services/rules/models/reactive_task_setting_type.py src/waylay/services/rules/models/relation_node.py src/waylay/services/rules/models/replace_template200_response.py src/waylay/services/rules/models/resource_data_injection.py +src/waylay/services/rules/models/retry_config.py src/waylay/services/rules/models/run_template_log_level_parameter.py src/waylay/services/rules/models/scheduled_task_setting.py src/waylay/services/rules/models/scheduled_task_setting_all_of_type.py @@ -106,6 +106,7 @@ src/waylay/services/rules/models/variable_type.py src/waylay/services/rules/models/version_response.py src/waylay/services/rules/models/version_response_status.py src/waylay/services/rules/queries/__init__.py +src/waylay/services/rules/queries/about_api.py src/waylay/services/rules/queries/plugs_execution_api.py src/waylay/services/rules/queries/push_data_api.py src/waylay/services/rules/queries/py.typed @@ -114,4 +115,3 @@ src/waylay/services/rules/queries/tasks_api.py src/waylay/services/rules/queries/tasks_batch_operations_api.py src/waylay/services/rules/queries/template_runs_api.py src/waylay/services/rules/queries/templates_api.py -src/waylay/services/rules/queries/version_api.py diff --git a/waylay-sdk-rules-types/README.md b/waylay-sdk-rules-types/README.md index 481b735..c5ce378 100644 --- a/waylay-sdk-rules-types/README.md +++ b/waylay-sdk-rules-types/README.md @@ -3,6 +3,7 @@ The REST api to manage rule tasks and rule templates in the Waylay platform. This Python package is automatically generated based on the Waylay Rules OpenAPI specification (API version: 6.5.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/rules.html). It is considered an extension of the waylay-sdk-rules package, and it consists of the typed model classes for all path params, query params, body params and responses for each of the api methods in `waylay-sdk-rules`. @@ -10,21 +11,20 @@ It is considered an extension of the waylay-sdk-rules package, and it consists o This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-rules is included in: -- ```pip install waylay-sdk[rules]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[rules]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-rules and waylay-sdk-rules-types are included in: -- ```pip install waylay-sdk[rules,rules-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[rules,rules-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -32,19 +32,17 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-rules-types` is installed -from ..models.execute_plugs_specification import ExecutePlugsSpecification -from ..models.transformer_execution_result import TransformerExecutionResult +from waylay.services.rules.models.version_response import VersionResponse try: - # Execute Specified Transformer Version - # calls `POST /rules/v1/transformers/{name}/versions/{version}` - api_response = await waylay_client.rules.plugs_execution.execute_transformer_version( - 'name_example', # name | path param "name" - 'version_example', # version | path param "version" + # Get Service Information + # calls `GET /rules/v1` + api_response = await waylay_client.rules.about.get( ) - print("The response of rules.plugs_execution.execute_transformer_version:\n") + print("The response of rules.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling rules.plugs_execution.execute_transformer_version: %s\n" % e) + print("Exception when calling rules.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). diff --git a/waylay-sdk-rules-types/pyproject.toml b/waylay-sdk-rules-types/pyproject.toml index a3b6501..6c99105 100644 --- a/waylay-sdk-rules-types/pyproject.toml +++ b/waylay-sdk-rules-types/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-rules-types" -version = "6.5.0rc1" +version = "6.5.0" description = "Waylay rules engine Types " authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,7 +12,8 @@ authors = [ keywords = ["Waylay rules engine" , "Types"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk ~= 0.0.4rc5", + "waylay-sdk-core ~= 0.2.0", + "waylay-sdk-rules == 6.5.0", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", @@ -22,8 +23,9 @@ license={file = "LICENSE.txt"} [project.urls] Homepage = "https://www.waylay.io/" -Documentation = "https://docs.waylay.io/#/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" Repository = "https://github.com/waylayio/waylay-sdk-rules-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/rules.html" [project.optional-dependencies] dev = [ diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/__init__.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/__init__.py index cd1d6b2..61a882e 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/__init__.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "6.5.0rc1" +__version__ = "6.5.0" # import models into model package from .a_tasks_batch_operation_specification import ATasksBatchOperationSpecification @@ -70,6 +70,7 @@ from .relation_node import RelationNode from .replace_template200_response import ReplaceTemplate200Response from .resource_data_injection import ResourceDataInjection +from .retry_config import RetryConfig from .run_template_log_level_parameter import RunTemplateLogLevelParameter from .scheduled_task_setting import ScheduledTaskSetting from .scheduled_task_setting_all_of_type import ScheduledTaskSettingAllOfType @@ -174,6 +175,7 @@ "RelationNode", "ReplaceTemplate200Response", "ResourceDataInjection", + "RetryConfig", "RunTemplateLogLevelParameter", "ScheduledTaskSetting", "ScheduledTaskSettingAllOfType", diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/periodic_task_setting.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/periodic_task_setting.py index 6430265..b14c59d 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/periodic_task_setting.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/periodic_task_setting.py @@ -25,9 +25,7 @@ class PeriodicTaskSetting(WaylayBaseModel): """PeriodicTaskSetting.""" type: PeriodicTaskSettingType - frequency: StrictInt | None = Field( - default=None, description="polling frequency in milliseconds" - ) + frequency: StrictInt = Field(description="polling frequency in milliseconds") model_config = ConfigDict( populate_by_name=True, diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/retry_config.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/retry_config.py new file mode 100644 index 0000000..3fd3b10 --- /dev/null +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/retry_config.py @@ -0,0 +1,42 @@ +# coding: utf-8 +"""Waylay rules engine models. + +This code was generated from the OpenAPI documentation of 'Waylay rules engine' + +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. + +""" + +from __future__ import annotations + +from pydantic import ( + ConfigDict, + Field, + StrictStr, +) +from typing_extensions import ( + Annotated, # >=3.11 +) +from waylay.sdk.api._models import BaseModel as WaylayBaseModel + + +class RetryConfig(WaylayBaseModel): + """Configuration for retrying a template node. The node execution will be retried `maxRetries` times. The delay between retries will be exponentially increased starting from `minBackoff` to `maxBackoff`. If the node execution fails after `maxRetries` retries, the node state will be set to `errorState` if it that property is provided. Otherwise node execution will fail. Error state should be one of the possible states defined by the sensor node..""" + + max_retries: Annotated[int, Field(strict=True, ge=0)] = Field(alias="maxRetries") + min_backoff: StrictStr = Field(alias="minBackoff") + max_backoff: StrictStr = Field(alias="maxBackoff") + error_state: StrictStr | None = Field( + default=None, + description="Optional sensor state which will be used to set the state of the node when the maxRetries is reached.", + alias="errorState", + ) + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="ignore", + ) diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/sensor_node.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/sensor_node.py index bd1af29..fc3766d 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/sensor_node.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/sensor_node.py @@ -27,6 +27,8 @@ ) from waylay.sdk.api._models import BaseModel as WaylayBaseModel +from ..models.retry_config import RetryConfig + class SensorNode(WaylayBaseModel): """Representation of a sensor in a Rule Template..""" @@ -61,6 +63,7 @@ class SensorNode(WaylayBaseModel): description="A loop definition is a string that defines items over which node will be iterated multiple times. The string is an JSON array of JSON objects.During template execution the sensor node with such a defined loop definition will be invoked for every JSON Object in the JSON array. Parameter is optional. Node will be executed only once if loop definition is not defined.", alias="loopDef", ) + retry_config: RetryConfig | None = Field(default=None, alias="retryConfig") @field_validator("version") @classmethod diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_from_template.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_from_template.py index 75c3e4e..7e88bf9 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_from_template.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_from_template.py @@ -53,9 +53,7 @@ class TaskFromTemplate(WaylayBaseModel): description="Optional identifier of the time zone in which the schedule expression is to be interpreted", alias="timeZone", ) - frequency: StrictInt | None = Field( - default=None, description="polling frequency in milliseconds" - ) + frequency: StrictInt = Field(description="polling frequency in milliseconds") start: StrictBool | None = True template: StrictStr = Field(description="Unique template identifier") diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_settings.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_settings.py index 6f1837e..085254b 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_settings.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_settings.py @@ -53,9 +53,7 @@ class TaskSettings(WaylayBaseModel): description="Optional identifier of the time zone in which the schedule expression is to be interpreted", alias="timeZone", ) - frequency: StrictInt | None = Field( - default=None, description="polling frequency in milliseconds" - ) + frequency: StrictInt = Field(description="polling frequency in milliseconds") model_config = ConfigDict( populate_by_name=True, diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_with_rule_all_of_task.py b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_with_rule_all_of_task.py index 9ff69ab..d67151a 100644 --- a/waylay-sdk-rules-types/src/waylay/services/rules/models/task_with_rule_all_of_task.py +++ b/waylay-sdk-rules-types/src/waylay/services/rules/models/task_with_rule_all_of_task.py @@ -53,9 +53,7 @@ class TaskWithRuleAllOfTask(WaylayBaseModel): description="Optional identifier of the time zone in which the schedule expression is to be interpreted", alias="timeZone", ) - frequency: StrictInt | None = Field( - default=None, description="polling frequency in milliseconds" - ) + frequency: StrictInt = Field(description="polling frequency in milliseconds") start: StrictBool | None = True model_config = ConfigDict( diff --git a/waylay-sdk-rules-types/src/waylay/services/rules/queries/version_api.py b/waylay-sdk-rules-types/src/waylay/services/rules/queries/about_api.py similarity index 100% rename from waylay-sdk-rules-types/src/waylay/services/rules/queries/version_api.py rename to waylay-sdk-rules-types/src/waylay/services/rules/queries/about_api.py diff --git a/waylay-sdk-rules/.openapi-generator/FILES b/waylay-sdk-rules/.openapi-generator/FILES index b866545..3214749 100644 --- a/waylay-sdk-rules/.openapi-generator/FILES +++ b/waylay-sdk-rules/.openapi-generator/FILES @@ -1,7 +1,7 @@ LICENSE.txt -README.md pyproject.toml src/waylay/services/rules/api/__init__.py +src/waylay/services/rules/api/about_api.py src/waylay/services/rules/api/plugs_execution_api.py src/waylay/services/rules/api/push_data_api.py src/waylay/services/rules/api/py.typed @@ -10,7 +10,6 @@ src/waylay/services/rules/api/tasks_api.py src/waylay/services/rules/api/tasks_batch_operations_api.py src/waylay/services/rules/api/template_runs_api.py src/waylay/services/rules/api/templates_api.py -src/waylay/services/rules/api/version_api.py src/waylay/services/rules/service/__init__.py src/waylay/services/rules/service/py.typed src/waylay/services/rules/service/service.py diff --git a/waylay-sdk-rules/README.md b/waylay-sdk-rules/README.md index 29700f4..3e08cfa 100644 --- a/waylay-sdk-rules/README.md +++ b/waylay-sdk-rules/README.md @@ -3,29 +3,29 @@ The REST api to manage rule tasks and rule templates in the Waylay platform. This Python package is automatically generated based on the Waylay Rules OpenAPI specification (API version: 6.5.0) +For more information, please visit [the openapi specification](https://docs.waylay.io/openapi/public/redocly/rules.html). -It consists of a plugin for the waylay-sdk package, and contains the Rules api methods. +It consists of a plugin for the waylay-sdk-core package, and contains the Rules api methods. Note that the typed model classes for all path params, query params, body params and responses for each of the api methods are contained in a separate package called waylay-sdk-rules-types. ## Requirements. This package requires Python 3.9+. ## Installation -Typically this package is installed when installing the [waylay-sdk](https://github.com/waylayio/waylay-sdk-py) package to enable the service's functionality. +Typically this package is installed when installing the [waylay-sdk-core](https://pypi.org/project/waylay-sdk/) package to enable the service's functionality. When the service api methods are required, waylay-sdk-rules is included in: -- ```pip install waylay-sdk[rules]``` to install `waylay-sdk` along with only this service, or -- ```pip install waylay-sdk[services]``` to install `waylay-sdk` along with all services. +- ```pip install waylay-sdk-core[rules]``` to install `waylay-sdk-core` along with only this service, or +- ```pip install waylay-sdk-core[services]``` to install `waylay-sdk-core` along with all services. When the typed models are required, both waylay-sdk-rules and waylay-sdk-rules-types are included in: -- ```pip install waylay-sdk[rules,rules-types]``` to install `waylay-sdk` along with only this service including the typed models, or -- ```pip install waylay-sdk[services,services-types]``` to install `waylay-sdk` along with all services along with the typed models. +- ```pip install waylay-sdk-core[rules,rules-types]``` to install `waylay-sdk-core` along with only this service including the typed models, or +- ```pip install waylay-sdk-core[services,services-types]``` to install `waylay-sdk-core` along with all services along with the typed models. ## Usage - ```python from pprint import pprint -# Import the waylay-client from the waylay-sdk package +# Import the waylay-client from the waylay-sdk-core package from waylay.sdk.client import WaylayClient from waylay.sdk.api.api_exceptions import ApiError @@ -33,19 +33,17 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-rules-types` is installed -from rules.models.execute_plugs_specification import ExecutePlugsSpecification -from rules.models.transformer_execution_result import TransformerExecutionResult +from waylay.services.rules.models.version_response import VersionResponse try: - # Execute Specified Transformer Version - # calls `POST /rules/v1/transformers/{name}/versions/{version}` - api_response = await waylay_client.rules.plugs_execution.execute_transformer_version( - 'name_example', # name | path param "name" - 'version_example', # version | path param "version" + # Get Service Information + # calls `GET /rules/v1` + api_response = await waylay_client.rules.about.get( ) - print("The response of rules.plugs_execution.execute_transformer_version:\n") + print("The response of rules.about.get:\n") pprint(api_response) except ApiError as e: - print("Exception when calling rules.plugs_execution.execute_transformer_version: %s\n" % e) + print("Exception when calling rules.about.get: %s\n" % e) ``` +For more information, please visit the [Waylay API documentation](https://docs.waylay.io/#/api/?id=software-development-kits). \ No newline at end of file diff --git a/waylay-sdk-rules/pyproject.toml b/waylay-sdk-rules/pyproject.toml index 9aa9df7..8522407 100644 --- a/waylay-sdk-rules/pyproject.toml +++ b/waylay-sdk-rules/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-rules" -version = "6.5.0rc1" +version = "6.5.0" description = "Waylay rules engine" authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,8 +12,7 @@ authors = [ keywords = ["Waylay rules engine"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk ~= 0.0.4rc5", - "waylay-sdk-rules == 6.5.0rc1", + "waylay-sdk-core ~= 0.2.0", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", @@ -23,8 +22,9 @@ license={file = "LICENSE.txt"} [project.urls] Homepage = "https://www.waylay.io/" -Documentation = "https://docs.waylay.io/#/" +Documentation = "https://docs.waylay.io/#/api/?id=software-development-kits" Repository = "https://github.com/waylayio/waylay-sdk-rules-py.git" +"Openapi Specification" = "https://docs.waylay.io/openapi/public/redocly/rules.html" [project.optional-dependencies] dev = [ diff --git a/waylay-sdk-rules/src/waylay/services/rules/api/__init__.py b/waylay-sdk-rules/src/waylay/services/rules/api/__init__.py index 654f892..8541d98 100644 --- a/waylay-sdk-rules/src/waylay/services/rules/api/__init__.py +++ b/waylay-sdk-rules/src/waylay/services/rules/api/__init__.py @@ -1,6 +1,7 @@ """Waylay rules engine: apis.""" # import apis into api package +from .about_api import AboutApi from .plugs_execution_api import PlugsExecutionApi from .push_data_api import PushDataApi from .task_nodes_api import TaskNodesApi @@ -8,9 +9,9 @@ from .tasks_batch_operations_api import TasksBatchOperationsApi from .template_runs_api import TemplateRunsApi from .templates_api import TemplatesApi -from .version_api import VersionApi __all__ = [ + "AboutApi", "PlugsExecutionApi", "PushDataApi", "TaskNodesApi", @@ -18,5 +19,4 @@ "TasksBatchOperationsApi", "TemplateRunsApi", "TemplatesApi", - "VersionApi", ] diff --git a/waylay-sdk-rules/src/waylay/services/rules/api/version_api.py b/waylay-sdk-rules/src/waylay/services/rules/api/about_api.py similarity index 95% rename from waylay-sdk-rules/src/waylay/services/rules/api/version_api.py rename to waylay-sdk-rules/src/waylay/services/rules/api/about_api.py index 89f0d85..556a9e6 100644 --- a/waylay-sdk-rules/src/waylay/services/rules/api/version_api.py +++ b/waylay-sdk-rules/src/waylay/services/rules/api/about_api.py @@ -33,12 +33,12 @@ if TYPE_CHECKING: from waylay.services.rules.models import VersionResponse - from waylay.services.rules.queries.version_api import GetQuery + from waylay.services.rules.queries.about_api import GetQuery try: from waylay.services.rules.models import VersionResponse - from waylay.services.rules.queries.version_api import GetQuery + from waylay.services.rules.queries.about_api import GetQuery MODELS_AVAILABLE = True except ImportError: @@ -52,8 +52,8 @@ T = TypeVar("T") -class VersionApi(WithApiClient): - """VersionApi service methods. +class AboutApi(WithApiClient): + """AboutApi service methods. NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -131,9 +131,9 @@ async def get( headers: HeaderTypes | None = None, **kwargs, ) -> VersionResponse | T | Response | Model: - """Get Version. + """Get Service Information. - Get the status and version of the service. + Get the name and version of the service. :param query: URL Query parameters. :type query: GetQuery | QueryParamTypes, optional :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. diff --git a/waylay-sdk-rules/src/waylay/services/rules/api/template_runs_api.py b/waylay-sdk-rules/src/waylay/services/rules/api/template_runs_api.py index 7e7c08f..38b2d4e 100644 --- a/waylay-sdk-rules/src/waylay/services/rules/api/template_runs_api.py +++ b/waylay-sdk-rules/src/waylay/services/rules/api/template_runs_api.py @@ -13,6 +13,7 @@ from typing import ( TYPE_CHECKING, Any, + AsyncIterator, Dict, Literal, TypeVar, @@ -34,6 +35,7 @@ Response, ) from waylay.sdk.api._models import Model +from waylay.sdk.api.constants import STREAM_TIMEOUTS from waylay.sdk.plugin import WithApiClient if TYPE_CHECKING: @@ -100,8 +102,10 @@ async def run_graph( select_path: Literal[""] = "", response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> TemplateRunInvocation: ... + ) -> AsyncIterator[TemplateRunInvocation]: ... @overload async def run_graph( @@ -112,8 +116,10 @@ async def run_graph( select_path: Literal[""] = "", response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... @overload async def run_graph( @@ -124,6 +130,8 @@ async def run_graph( select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, ) -> Response: ... @@ -136,8 +144,10 @@ async def run_graph( select_path: str, response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> Model: ... + ) -> AsyncIterator[Model]: ... @overload async def run_graph( @@ -148,8 +158,10 @@ async def run_graph( select_path: str, response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... async def run_graph( self, @@ -159,8 +171,15 @@ async def run_graph( select_path: str = "", response_type: T | None = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> TemplateRunInvocation | T | Response | Model: + ) -> ( + AsyncIterator[TemplateRunInvocation] + | AsyncIterator[T] + | Response + | AsyncIterator[Model] + ): """Run Graph Or Bayesian Network. Run a graph or Bayesian Network. If `data` is specified, template will be run as reactive template. If `data` is not specified, template will be run as a one-time template (1 tick) @@ -226,6 +245,8 @@ async def run_graph( params=query, **body_args, headers=headers, + stream=stream, + timeout=timeout, **kwargs, response_type=response_types_map, select_path=select_path, @@ -242,8 +263,10 @@ async def run( select_path: Literal[""] = "", response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> TemplateRunInvocation: ... + ) -> AsyncIterator[TemplateRunInvocation]: ... @overload async def run( @@ -255,8 +278,10 @@ async def run( select_path: Literal[""] = "", response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... @overload async def run( @@ -268,6 +293,8 @@ async def run( select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, ) -> Response: ... @@ -281,8 +308,10 @@ async def run( select_path: str, response_type: Literal[None] = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> Model: ... + ) -> AsyncIterator[Model]: ... @overload async def run( @@ -294,8 +323,10 @@ async def run( select_path: str, response_type: T, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> T: ... + ) -> AsyncIterator[T]: ... async def run( self, @@ -306,8 +337,15 @@ async def run( select_path: str = "", response_type: T | None = None, headers: HeaderTypes | None = None, + stream: bool = True, + timeout=STREAM_TIMEOUTS, **kwargs, - ) -> TemplateRunInvocation | T | Response | Model: + ) -> ( + AsyncIterator[TemplateRunInvocation] + | AsyncIterator[T] + | Response + | AsyncIterator[Model] + ): """Run Template. Run a template. If `data` is specified, template will be run as reactive template. If `data` is not specified, template will be run as a one-time template (1 tick) @@ -378,6 +416,8 @@ async def run( params=query, **body_args, headers=headers, + stream=stream, + timeout=timeout, **kwargs, response_type=response_types_map, select_path=select_path, diff --git a/waylay-sdk-rules/src/waylay/services/rules/service/__init__.py b/waylay-sdk-rules/src/waylay/services/rules/service/__init__.py index 40a4185..9d9caf3 100644 --- a/waylay-sdk-rules/src/waylay/services/rules/service/__init__.py +++ b/waylay-sdk-rules/src/waylay/services/rules/service/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "6.5.0rc1" +__version__ = "6.5.0" from .service import RulesService diff --git a/waylay-sdk-rules/src/waylay/services/rules/service/service.py b/waylay-sdk-rules/src/waylay/services/rules/service/service.py index ae77509..ed875f9 100644 --- a/waylay-sdk-rules/src/waylay/services/rules/service/service.py +++ b/waylay-sdk-rules/src/waylay/services/rules/service/service.py @@ -2,6 +2,7 @@ from waylay.sdk import ApiClient, WaylayService +from ..api.about_api import AboutApi from ..api.plugs_execution_api import PlugsExecutionApi from ..api.push_data_api import PushDataApi from ..api.task_nodes_api import TaskNodesApi @@ -9,7 +10,6 @@ from ..api.tasks_batch_operations_api import TasksBatchOperationsApi from ..api.template_runs_api import TemplateRunsApi from ..api.templates_api import TemplatesApi -from ..api.version_api import VersionApi class RulesService(WaylayService): @@ -18,6 +18,7 @@ class RulesService(WaylayService): name = "rules" title = "Rules Service" + about: AboutApi plugs_execution: PlugsExecutionApi push_data: PushDataApi task_nodes: TaskNodesApi @@ -25,12 +26,12 @@ class RulesService(WaylayService): tasks_batch_operations: TasksBatchOperationsApi template_runs: TemplateRunsApi templates: TemplatesApi - version: VersionApi def __init__(self, api_client: ApiClient): """Create the rules service.""" super().__init__(api_client) + self.about = AboutApi(api_client) self.plugs_execution = PlugsExecutionApi(api_client) self.push_data = PushDataApi(api_client) self.task_nodes = TaskNodesApi(api_client) @@ -38,4 +39,3 @@ def __init__(self, api_client: ApiClient): self.tasks_batch_operations = TasksBatchOperationsApi(api_client) self.template_runs = TemplateRunsApi(api_client) self.templates = TemplatesApi(api_client) - self.version = VersionApi(api_client)