File: watcher-api-v1-actionplans.inc

package info (click to toggle)
watcher 14.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,764 kB
  • sloc: python: 48,904; xml: 312; sh: 265; makefile: 75
file content (258 lines) | stat: -rw-r--r-- 5,886 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
.. -*- rst -*-

============
Action Plans
============

An ``Action Plan`` specifies a flow of ``Actions`` that should be executed
in order to satisfy a given ``Goal``. It also contains an estimated
``global efficacy`` alongside a set of ``efficacy indicators``.

An ``Action Plan`` is generated by Watcher when an ``Audit`` is successful
which implies that the ``Strategy`` which was used has found a ``Solution``
to achieve the ``Goal`` of this ``Audit``.

In the default implementation of Watcher, an action plan is composed of
a graph of linked ``Actions``. Each action may have parent actions, which
should be executed prior to child action.

Start Action Plan
=================

.. rest_method::  POST /v1/action_plans/{actionplan_ident}/start

Starts a created Action Plan resource.

Normal response codes: 200

Error codes: 400,404

Request
-------

.. rest_parameters:: parameters.yaml

   - actionplan_ident: actionplan_ident

Response
--------

The list and example below are representative of the response as of API
version 1:

.. rest_parameters:: parameters.yaml

    - uuid: uuid
    - state: actionplan_state
    - audit_uuid: actionplan_audit_uuid
    - strategy_uuid: strategy_uuid
    - strategy_name: strategy_name
    - efficacy_indicators: actionplan_efficacy_indicators
    - global_efficacy: actionplan_global_efficacy
    - links: links
    - hostname: actionplan_hostname

**Example JSON representation of an Action Plan:**

.. literalinclude:: samples/actionplan-start-response.json
   :language: javascript

List Action Plan
================

.. rest_method::  GET /v1/action_plans

Returns a list of Action Plan resources.

Normal response codes: 200

Error codes: 400,401

Request
-------

.. rest_parameters:: parameters.yaml

   - audit_uuid: r_audit
   - strategy: r_strategy
   - limit: limit
   - marker: marker
   - sort_dir: sort_dir
   - sort_key: sort_key

Response
--------

.. rest_parameters:: parameters.yaml

    - uuid: uuid
    - state: actionplan_state
    - audit_uuid: actionplan_audit_uuid
    - strategy_uuid: strategy_uuid
    - strategy_name: strategy_name
    - efficacy_indicators: actionplan_efficacy_indicators
    - global_efficacy: actionplan_global_efficacy
    - links: links

**Example JSON representation of an Action Plan:**

.. literalinclude:: samples/actionplan-list-response.json
   :language: javascript

List Action Plan detailed
=========================

.. rest_method::  GET /v1/action_plans/detail

Returns a list of Action Plan resources with complete details.

Normal response codes: 200

Error codes: 400,401

Request
-------

.. rest_parameters:: parameters.yaml

   - audit_uuid: r_audit
   - strategy: r_strategy
   - limit: limit
   - marker: marker
   - sort_dir: sort_dir
   - sort_key: sort_key

Response
--------

.. rest_parameters:: parameters.yaml

    - deleted_at: deleted_at
    - updated_at: updated_at
    - created_at: created_at
    - uuid: uuid
    - state: actionplan_state
    - audit_uuid: actionplan_audit_uuid
    - strategy_uuid: strategy_uuid
    - strategy_name: strategy_name
    - efficacy_indicators: actionplan_efficacy_indicators
    - global_efficacy: actionplan_global_efficacy
    - links: links
    - hostname: actionplan_hostname

**Example JSON representation of an Action Plan:**

.. literalinclude:: samples/actionplan-list-detailed-response.json
   :language: javascript

Show Action Plan
================

.. rest_method::  GET /v1/action_plans/{actionplan_ident}

Shows details for an Action Plan.

Normal response codes: 200

Error codes: 404

Request
-------

.. rest_parameters:: parameters.yaml

   - actionplan_ident: actionplan_ident

Response
--------

.. rest_parameters:: parameters.yaml

    - uuid: uuid
    - state: actionplan_state
    - audit_uuid: actionplan_audit_uuid
    - strategy_uuid: strategy_uuid
    - strategy_name: strategy_name
    - efficacy_indicators: actionplan_efficacy_indicators
    - global_efficacy: actionplan_global_efficacy
    - links: links
    - hostname: actionplan_hostname

**Example JSON representation of an Audit:**

.. literalinclude:: samples/actionplan-show-response.json
   :language: javascript

Cancel Action Plan
==================

.. rest_method::  PATCH /v1/action_plans/{actionplan_ident}

Cancels a created Action Plan resource.

.. note:
    If Action Plan is in ONGOING state, then ``state`` attribute should be
    replaced with ``CANCELLING`` value. Otherwise, ``CANCELLED`` is to be
    used.

Normal response codes: 200

Error codes: 400,404

Request
-------

.. rest_parameters:: parameters.yaml

   - actionplan_ident: actionplan_ident

**Example Action Plan ONGOING cancelling request:**

.. literalinclude:: samples/actionplan-cancel-request-cancelling.json
   :language: javascript

**Example Action Plan PENDING cancelling request:**

.. literalinclude:: samples/actionplan-cancel-request-pending.json
   :language: javascript

Response
--------

The list and example below are representative of the response as of API
version 1:

.. rest_parameters:: parameters.yaml

    - uuid: uuid
    - state: actionplan_state
    - audit_uuid: actionplan_audit_uuid
    - strategy_uuid: strategy_uuid
    - strategy_name: strategy_name
    - efficacy_indicators: actionplan_efficacy_indicators
    - global_efficacy: actionplan_global_efficacy
    - links: links
    - hostname: actionplan_hostname

**Example JSON representation of an Action Plan:**

.. literalinclude:: samples/actionplan-start-response.json
   :language: javascript

Delete Action Plan
==================

.. rest_method::  DELETE /v1/action_plans/{actionplan_ident}

Deletes an Action Plan. Action Plan can be deleted only from SUCCEEDED, RECOMMENDED, FAILED, SUPERSEDED, CANCELLED states.

Normal response codes: 204

Error codes: 404

Request
-------

.. rest_parameters:: parameters.yaml

   - actionplan_ident: actionplan_ident