ironic-inspector/api-ref/source/introspection-api-v1-rules.inc
Zygimantas Matonis e2c8f9fd7b Added scope to introspection rules.
Added 'scope' property to IntrospectionRule and logic to check if a node
falls in the same scope.This allows introspection rules to be applied on
selected nodes instead of every one of them.

Story: 2006995
Task: 37763

Change-Id: I77034f032ea0ec16886afdd928546eb801f7a90a
2020-03-26 21:40:43 +01:00

160 lines
2.8 KiB
ReStructuredText

.. -*- rst -*-
===================
Introspection Rules
===================
Simple JSON-based DSL to define rules, which run during introspection.
See `<https://docs.openstack.org/ironic-inspector/latest/user/usage.html#introspection-rules>`_
for more information on rules.
Create Introspection Rule
=========================
.. rest_method:: POST /v1/rules
Create a new introspection rule.
Normal response codes:
* 200 - OK for API version < 1.6
* 201 - OK for API version 1.6 and higher
Error codes:
* 400 - wrong rule format
Request
-------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- conditions: conditions
- actions: actions
- description: description
- scope: scope
**Example creating rule request:**
.. literalinclude:: samples/api-v1-create-rule-request.json
:language: javascript
Response
--------
The response will contain full rule object, also ``condition``
section may contain additional default fields, like ``invert``,
``multiple`` and ``field``, see ` Conditions https://docs.openstack.org/ironic-inspector/latest/user/usage.html#conditions>`_
.. rest_parameters:: parameters.yaml
- uuid: uuid
- conditions: conditions
- actions: actions
- description: description
- scope: scope
**Example JSON representation:**
.. literalinclude:: samples/api-v1-create-rule-response.json
:language: javascript
Get Introspection Rules
=======================
.. rest_method:: GET /v1/rules
List all introspection rules
Normal response codes: 200
Response
--------
.. rest_parameters:: parameters.yaml
- uuid: uuid
- description: description
- scope: scope
- links: links
**Example JSON representation:**
.. literalinclude:: samples/api-v1-get-rules-response.json
:language: javascript
Get Introspection Rule
======================
.. rest_method:: GET /v1/rules/{uuid}
Get one introspection rule by its ``uuid``
Normal response codes: 200
Error codes:
* 404 - rule not found
Request
-------
.. rest_parameters:: parameters.yaml
- uuid: uuid
Response
--------
The response will contain full rule object:
.. rest_parameters:: parameters.yaml
- uuid: uuid
- conditions: conditions
- actions: actions
- description: description
- scope: scope
**Example JSON representation:**
.. literalinclude:: samples/api-v1-get-rule-response.json
:language: javascript
Delete Introspection Rules
==========================
.. rest_method:: DELETE /v1/rules
Delete all introspection rules
Normal response codes: 204
Delete Introspection Rule
=========================
.. rest_method:: DELETE /v1/rules/{uuid}
Delete introspection rule by ``uuid``.
Normal response codes: 204
Error codes:
* 404 - rule not found
Request
-------
.. rest_parameters:: parameters.yaml
- uuid: uuid