ironic-inspector/api-ref/source/introspection-api-v1-rules.inc
Anton Arefiev 05a86b3d57 Add API reference
Add initial API reference, which covers all inspector endpoits.

The conf.py and the tox environment are stolen from ironic.

Co-Authored-By: Kaifeng Wang <kaifeng.w@gmail.com>
Change-Id: I5009e8708dcad8ab25380f7bf574125d6e758ef5
2018-10-16 16:50:01 +08:00

156 lines
2.6 KiB
ReStructuredText

.. -*- rst -*-
===================
Introspection Rules
===================
Simple JSON-based DSL to define rules, which run during introspection.
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
**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
**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
- links: links
**Example JSON representation:**
.. literalinclude:: samples/api-v1-get-rules-response.json
:language: javascript
Delete Introspection Rules
==========================
.. rest_method:: DELETE /v1/rules
Delete all introspection rules
Normal response codes: 204
Get Introspection Rule
======================
.. rest_method:: GET /v1/rules/{uuid}
Get one introspection rule by its ``uuid``
Normal response codes: 202
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
**Example JSON representation:**
.. literalinclude:: samples/api-v1-get-rule-response.json
:language: javascript
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