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:
Interaction diagram
Request structure
Name |
Value type |
Description |
---|---|---|
|
array of object |
A list of workloads to be reported. |
|
string |
The identifier of the workload type. |
|
string |
A name of the workload. |
|
object |
A key-value map of workload attributes. Allowed values are defined by the attributes schema specified in the Vendor Portal. |
|
string |
An identifier of the API client that created the workload. Must be the client ID of your application. |
|
array of string |
A list of workload action identifiers that are allowed for this workload. |
|
string |
The identifier of the tenant where the workload was created. |
|
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
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...'}
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'
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' ... ]
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 ... }
Convert the
workload_data
object to a JSON text:>>> workload_data = json.dumps(workload_data, indent=4)
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, ... )
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.