Reporting workloads

Workloads are reported to Acronis Cyber Protect Cloud by sending a POST request to the /api/workload_management/v5/workloads endpoint.

Reported workloads will appear in the Cyber Protection console. The following example shows how they may appear:

../../../_images/workload_example.png

Interaction diagram

autonumber

participant "Acronis Cyber Protect Cloud" as ACC
participant "Connector - Sync Algorithm" As ConnSync
participant "Connector - ISV's System Abstraction" As ConnExt
participant "ISV's system" As Ext

group Detecting and sending workloads
    activate ConnSync
    ConnSync -> ConnExt: Poll workloads updated since <last_workloads_update_timestamp>
    deactivate ConnSync

    activate ConnExt
    loop Until the last workloads page is reached
        ConnExt -> Ext: Fetch a workloads page
        activate Ext
        Ext -> ConnExt: n-th workloads page
        deactivate Ext
    end
    ConnExt -> ConnSync: A list of workloads to push
    deactivate ConnExt

    activate ConnSync
    ConnSync -> ConnSync: Set <last_workloads_update_timestamp> to\n'timestamp' field
    ConnSync -> ConnSync: Map ISV's workload data structure\nto the platform workload data structure
    ConnSync -> ConnSync: Map ISV's tenant IDs\nto the platform tenant IDs

    loop For each workload in the list
        ConnSync -> ACC: POST /api/workload_management/v5/workloads with workload data
        deactivate ConnSync
    end
end

Request structure

Name

Value type

Description

items

array of object

A list of workloads to be reported.

items[*].type

string

The identifier of the workload type.

items[*].name

string

A name of the workload.

items[*].attributes

object

A key-value map of workload attributes. Allowed values are defined by the attributes schema specified in the Vendor Portal.

items[*].client_id

string

An identifier of the API client that created the workload. Must be the client ID of your application.

items[*].allowed_actions

array of string

A list of workload action identifiers that are allowed for this workload.

items[*].tenant_id

string

The identifier of the tenant where the workload was created.

items[*].enabled

boolean

Status of the workload. True if enabled, false otherwise.

Example of the workload:

{
    "items": [
        {
            "type": "cti.a.p.wm.workload.v1.0~a.p.wm.aspect.v1.0~vendor.application.virtual_machine.v1.0",
            "name": "MongoDB Server",
            "attributes": {
                "hostname": "DESKTOP-12ABC3D",
                "mac_address": "0a:df:7e:25:36:7e"
            },
            "client_id": "696fcfe0-1272-454c-99cc-24ec2e037613",
            "allowed_actions": [
                "cti.a.ui.item.v1.0~a.ui.ext_p.workload_actions.action.v1.0~vendor.application.open_console.v1.0"
            ],
            "tenant_id": "f234baa2-e404-4d78-93de-4f3a77448d02",
            "enabled": true
        }
    ]
}

Response structure

If the workloads were created successfully, the response returns status 204 without payload.

Step-by-step procedure

  1. Authenticate to the cloud platform via the Python shell.

    The following variables should be available now:

    >>> base_url  # the base URL
    'https://eu8-cloud.acronis.com'
    >>> auth  # the 'Authorization' header value with the access token
    {'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6ImMwMD...'}
    
  2. Define a variable named workload_type, and then assign ID of the workload type registered in the Vendor Portal to this variable:

    >>> workload_type = 'cti.a.p.wm.workload.v1.0~a.p.wm.aspect.v1.0~vendor.application.virtual_machine.v1.0'
    
  3. Define a variable named allowed_actions, and then assign IDs of the allowed workload actions registered in the Vendor Portal to this variable:

    >>> allowed_actions = [
    ...     'cti.a.ui.item.v1.0~a.ui.ext_p.workload_actions.action.v1.0~vendor.application.open_console.v1.0'
    ... ]
    
  4. Define a variable named workload_data, and then assign the information about the workload to this variable:

    >>> workload_data = {
    ...     "type": workload_type,
    ...     "name": "My Custom Virtual Machine",
    ...     "attributes": {
    ...         "hostname": "DESKTOP-12ABC3D",
    ...         "mac_address": "0a:df:7e:25:36:7e"
    ...     },
    ...     "client_id": client_id,
    ...     "allowed_actions": allowed_actions,
    ...     "tenant_id": tenant_id,
    ...     "enabled": True
    ... }
    
  5. Convert the workload_data object to a JSON text:

    >>> workload_data = json.dumps(workload_data, indent=4)
    
  6. Send a POST request with the JSON text to the /api/workload_management/v5/workloads endpoint:

    >>> response = requests.post(
    ...     f'{base_url}/api/workload_management/v5/workloads',
    ...     headers={'Content-Type': 'application/json', **auth},
    ...     data=workload_data,
    ... )
    
  7. Check the status code of the response:

    >>> response.status_code
    204
    

    Status code 204 means that the workload was reported successfully and it should appear in the Cyber Protection console.