api.task - Task results and task log

/task

api.task.views.task_list(*args, **kwargs)

Show a list (GET) of pending user tasks.

GET /task
DC-bound?:
Permissions:
Asynchronous?:
Status Codes:

es example:

es get /task
{
    "url": "https://my.erigones.com/api/task/",
    "status": 200,
    "method": "GET",
    "text": [
            "0-fdc277df-84d6-4102-a6d5",
            "0-4b48594c-2d77-4b72-a1e1"
   ]
}

/task/(task_id)

api.task.views.task_details(*args, **kwargs)

Show (GET) task details of a pending task or delete (DELETE) a started task.

GET /task/(task_id)
DC-bound?:
Permissions:
Asynchronous?:
Status Codes:
DELETE /task/(task_id)
DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • data.force (boolean) – Force task deletion. EXPERIMENTAL feature. USE WITH CAUTION! (default: false)
Status Codes:

es example:

es get /task/0-4b48594c-2d77-4b72-a1e1
{
    "url": "https://my.erigones.com/api/task/0-4b48594c-2d77-4b72-a1e1",
    "status": 200,
    "method": "GET",
    "text": {
        "method": "PUT",
        "hostname": "example.cust.erigones.com",
        "action": "start",
        "view": "vm_status",
        "task_id": "0-4b48594c-2d77-4b72-a1e1"
    }
}

/task/(task_id)/status

api.task.views.task_status(*args, **kwargs)

Returns (GET) task status and task result.

GET /task/(task_id)/status
DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • task_id (string) – required - Task ID
Status Codes:

es example:

es get /task/0-4b48594c-2d77-4b72-a1e1/status
{
    "url": "https://my.erigones.com/api/task/0-4b48594c-2d77-4b72-a1e1/status/",
    "status": 201,
    "method": "GET",
    "text": {
        "status": "PENDING",
        "result": null,
        "task_id": "0-4b48594c-2d77-4b72-a1e1"
    }
}

/task/(task_id)/done

api.task.views.task_done(*args, **kwargs)

Returns (GET) task execution status (true or false). This is not really useful, because api.task.views.task_status() overrides and improves this functionality.

GET /task/(task_id)/done
DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • task_id (string) – required - Task ID
Status Codes:

es example:

es get /task/0-4b48594c-2d77-4b72-a1e1/done
{
    "url": "https://my.erigones.com/api/task/0-4b48594c-2d77-4b72-a1e1/done/",
    "status": 201,
    "method": "GET",
    "text": {
        "done": false,
        "task_id": "0-4b48594c-2d77-4b72-a1e1"
    }
}

/task/(task_id)/cancel

api.task.views.task_cancel(*args, **kwargs)

Revoke (PUT) a task and return task status from api.task.views.task_status() on success.

PUT /task/(task_id)/cancel
DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • task_id (string) – required - Task ID
Status Codes:

es example:

es set /task/0-4b48594c-2d77-4b72-a1e1/cancel
{
    "url": "https://my.erigones.com/api/task/0-4b48594c-2d77-4b72-a1e1/cancel/",
    "status": 410,
    "method": "PUT",
    "text": {
        "status": "REVOKED",
        "result": "terminated",
        "task_id": "0-4b48594c-2d77-4b72-a1e1"
    }
}

/task/log

api.task.views.task_log(*args, **kwargs)

Display (GET) the task log.

GET /task/log

Note

Task log filters below are available only when displaying task log entries from DB (using the page attribute).

DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • data.page (integer) – Page number to fetch. Each page has 100 log entries (default: null - last 10 log entries from cache)
  • data.status (string (one of: PENDING, SUCCESS, FAILURE, REVOKED)) – Filter task log entries by status (default: “”)
  • data.object_type (string (one of: dc, vm, node, nodestorage, subnet, image, vmtemplate, iso, domain, user, role)) – Filter task log entries by object type (default: “”)
  • data.object_name (string) – Filter by object name; object_type is required for this filter to work (default: “”)
  • data.show_running (boolean) – Show only running tasks (default: false)
  • data.hide_auto (boolean) – Hide automatic tasks (default: false)
  • data.date_from (string (date in ISO 8601 format)) – Show task log entries older than date (YYYY-MM-DD) specified (default: null)
  • data.date_to (string (date in ISO 8601 format)) – Show task log entries created before date (YYYY-MM-DD) specified (default: null)
  • data.order_by (string) – Available fields for sorting: time (default: -time)
Status Codes:
  • 200 OK – Object with “results” attribute - list of log lines
  • 400 Bad Request – Error object with “detail” attribute or with invalid filter attributes
  • 403 Forbidden – Forbidden

es example:

es get /task/log
{
    "url": "https://my.erigones.com/api/task/log/",
    "status": 200,
    "method": "GET",
    "text": {
        "results": [
            {
                "time": "2012-22-01T23:23:23.1337+00:00",
                "status": "PENDING",
                "task": "0-b6c8aa88-c7a2-4977-8738",
                "object_type": "vm",
                "object_name": "example.cust.erigones.com",
                "object_alias": "example",
                "username": "user@example.com",
                "msg": "Start server",
                "detail": ""
            },
            {
                "...": "..."
            }
        ]
    }
}

/task/log/stats

api.task.views.task_log_stats(*args, **kwargs)

Display (GET) task log statistics.

GET /task/log/stats
DC-bound?:
Permissions:
Asynchronous?:
Parameters:
  • data.last (integer) – Use task log entries which are n seconds old (default: 86400)
Status Codes:

es example:

es get /task/log/stats
{
    "url": "https://my.erigones.com/api/task/log/stats/",
    "status": 200,
    "method": "GET",
    "text": {
        "failed": 0,
        "pending": 7722,
        "succeeded": 7738,
        "revoked": 0,
        "_last": 86400
    }
}