HTTP task type¶
The global controller can execute http(s) requests as part of a workflow or other types of extensions. This is done via the ExtensionTaskWebhook
task type:
Task object schema¶
{
"label": "testInitial",
"taskType": "ExtensionTaskWebhook",
"options": {
"endpoint":"www.google.com",
"method":"GET",
"requestTemplate":"{\"server_vendor\": {{ server.serverVendor }}, \"property2\": \"value2\"}\""
}
}
Options¶
endpoint
- The endpoint to call. Must be a valid URL.method
- The method to use, one of GET, POST, PATCH, DELETEheaders
- An array of headers to send such as:headers: {"Content-type": "application/json", "header2": "value2"}
expectedResponseStatuses
- This is an array of codes such as[200,201]
requestTemplate
- This is the payload of the request. It can be a Nunjucks (a subset of Jinja2) template. The available objects that can be referenced in therequestTemplate
objectFor
serverRegistered
,serverDecommissioned
,switchRegistered
: TheServer
andNetwork
objects are available. The user can refer to the Server and NetworkDevice objects’ parameters depending on the asset that is being changed. Refer to your environment’s [API documentation].For
serverInstanceGroupCreateDNS
,serverInstanceGroupUpdateDNS
,serverInstanceGroupDeleteDN
,serverInstanceUpdateDNS
,serverInstanceDeleteDNS
refer to theRecordSet
object: A server DNS record set object similar to this:
"serverInstanceGroupDNSRecordSet": { "zone": { "zoneName": "eveng-qa02.metalcloud.io", "soaEmail": "admin.eveng-qa02.metalcloud.io", "nameServers": [ "ns1.evenq-qa02.metalcloud.io" ], "ttl": 3600, "isDefault": true }, "infrastructureId": 3870, "serverInstanceGroup": { "label": "instance-array-3386" }, "hostname": "lambda", "fqdn": "lambda.eveng-qa02.metalcloud.io", "ips": [ { "status": "allocated", "ip": "10.20.50.36" } ] }
For
serverCreateDNS
,serverDeleteDNS
an object similar to is provided invariables.json
:
"serverDNSRecordSet": { "zone": { "zoneName": "us08.metalsoft.io", "soaEmail": "admin.us08.metalsoft.io", "nameServers": ["n1.metalsoft.io"], "ttl": 3600, "isDefault": true }, "serverId": 10, "serialNumber": "serial-number", "managementAddress": "192.168.100.100", "hostname": "server-10", "fqdn": "server-10.us08.metalsoft.io", "ip": { "status": "allocated", "ip": "192.168.100.100" }, "operation": "create" }
For
switchCreateDNS
,switchDeleteDNS
the following payload is provided:
"switchDNSRecordSet": { "zone": { "zoneName": "us08.metalsoft.io", "soaEmail": "admin.us08.metalsoft.io", "nameServers": ["n1.metalsoft.io"], "ttl": 3600, "isDefault": true }, "switchId": 10, "managementAddress": "192.168.100.100", "hostname": "switch-10", "fqdn": "switch-10.us08.metalsoft.io", "ip": { "status": "allocated", "ip": "192.168.100.100" }, "operation": "create" }