task_start

Code

BIGIQ.task_start(path: str, data: dict) → bigrest.common.restobject.RESTObject

Starts a task on the device.

Sends an HTTP POST request to the iControl REST API.

Parameters:
  • path – HTTP path used in the HTTP request sent to the device.
  • data – Payload that will be sent to the device.
Exceptions:
RESTAPIError: Raised when iControl REST API returns an error.

Example

path = (
    f"/mgmt/shared/resolver/device-groups/cm-adccore-allbigipDevices/devices"
    f"?$filter=hostname eq 'LABBIGIP1.lab.local'"
)
device_link = device.link(path)
path = (
    f"/mgmt/shared/resolver/device-groups/cm-adccore-allbigipDevices/devices"
    f"?$filter=hostname eq 'LABBIGIP2.lab.local'"
)
device_link2 = device.link(path)
data = {
    "name": "BIGREST Add config to device",
    "deviceReferences": [
            {
                "link": device_link
            },
            {
                "link": device_link2
            }
    ],
    "disableUnusedObjectRemoval": True
}
device.task_start(
    "/mgmt/cm/adc-core/tasks/deploy-configuration", data)

Explanation

Some HTTP requests sent to the iControl REST API will take some time to be completed.
In these cases, they are defined as tasks.
First, we create the properties of the task, and then we start the task.
In this example, we are pushing the BIG-IQ configuration to the BIG-IP devices.