File: tasks.inc

package info (click to toggle)
glance 2%3A30.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,416 kB
  • sloc: python: 74,906; sh: 175; makefile: 111
file content (198 lines) | stat: -rw-r--r-- 3,542 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
.. -*- rst -*-

Tasks
*****

Creates, lists, and shows details for tasks.

*(Since API v2.2)*


General Information
~~~~~~~~~~~~~~~~~~~

**API Status**

This API was made admin-only by default in the OpenStack Mitaka release.  Thus
the following calls may not be available to end users in your cloud.  Please
consult your cloud provider's documentation for more information.

**Conceptual Overview**

Please see the `Tasks <https://docs.openstack.org/glance/latest/admin/tasks.html>`_
section of the Glance Developers Documentation for a conceptual overview of
tasks.

**Task Status**

The possible status values for tasks are presented in the following table.

.. list-table::
    :header-rows: 1

    * - Status
      - Description
    * - pending
      - The task is waiting for execution.
    * - processing
      - Execution of the task is underway.
    * - success
      - The task completed successfully.  The ``result`` element should be
        populated.
    * - failure
      - The task failed to complete.  The ``message`` element should be a
        non-empty string.


Create task
~~~~~~~~~~~

.. rest_method::  POST /v2/tasks

Creates a task.

Normal response codes: 201

Error response codes: 401, 413, 415


Request
-------

.. rest_parameters:: tasks-parameters.yaml

   - type: type
   - input: input


Request Example
---------------

.. literalinclude:: samples/task-create-request.json
   :language: json


Response Parameters
-------------------

.. rest_parameters:: tasks-parameters.yaml

   - created_at: created_at
   - id: id
   - input: input
   - message: message
   - owner: owner
   - result: result
   - schema: schema-task
   - self: self
   - status: status
   - type: type
   - updated_at: updated_at

Response Example
----------------

.. literalinclude:: samples/task-create-response.json
   :language: json


List tasks
~~~~~~~~~~

.. rest_method::  GET /v2/tasks

Lists tasks.

Normal response codes: 200

Error response codes: 403, 404, 413


Request
-------

.. rest_parameters:: tasks-parameters.yaml

   - limit: limit
   - marker: marker
   - sort_dir: sort_dir
   - sort_key: sort_key
   - status: status-in-query
   - type: type-in-query


Response Parameters
-------------------

.. rest_parameters:: tasks-parameters.yaml

   - first: first
   - next: next
   - schema: schema-tasks
   - tasks: tasks


Response Example
----------------

.. literalinclude:: samples/tasks-list-response.json
   :language: json


Show task details
~~~~~~~~~~~~~~~~~

.. rest_method::  GET /v2/tasks/{task_id}

Shows details for a task.


Normal response codes: 200

Error response codes: 404


Request
-------

.. rest_parameters:: tasks-parameters.yaml

   - task_id: task_id


Response Parameters
-------------------

.. rest_parameters:: tasks-parameters.yaml

   - created_at: created_at
   - expires_at: expires_at
   - id: id
   - input: input
   - message: message
   - owner: owner
   - result: result
   - schema: schema-task
   - self: self
   - status: status
   - type: type
   - updated_at: updated_at


Response Example (task status: processing)
------------------------------------------

.. literalinclude:: samples/task-show-processing-response.json
   :language: json

Response Example (task status: success)
------------------------------------------

.. literalinclude:: samples/task-show-success-response.json
   :language: json

Response Example (task status: failure)
---------------------------------------

.. literalinclude:: samples/task-show-failure-response.json
   :language: json