Triggers are functions that allow an action in Flexiant Cloud Orchestrator to initiate a second action, which can be external to Flexiant Cloud Orchestrator.
A trigger is written as a block of Flexiant Development Language (FDL) code that run either before an event occurs (a pre trigger) or after an event occurs (a post trigger). For more information about Flexiant Development Language, see Flexiant Development Language.
The event that initiates a trigger is defined by the triggerType
field in the trigger's entry point. For more information about entry points, see Writing an FDL trigger.
The following events can initiate a trigger:
Initiating event | triggerType | PRE triggers | POST triggers |
---|---|---|---|
Creation of a resource | CREATE | Yes | Yes |
Modification of a resource | MODIFY | Yes | Yes |
Deletion of a resource | DELETE | Yes | Yes |
Making an API call | USER_API_CALL or ADMIN_API_CALL | Yes | Yes |
Jade exception Exceptions thrown by triggers cannot initiate other triggers. | EXCEPTION | No | Yes |
Scheduled based on elapsed time interval | SCHEDULED | No | Yes |
Making a payment | PAYMENT | Yes | Yes |
Purchasing units | PURCHASE | Yes | Yes |
Adding units to a customer's account | UNIT_TRANSACTION | No | Yes |
Job state change | JOB_STATE_CHANGE | Yes | Yes |
Authorisation of a customer account | AUTH | Yes | Yes |
Server state change | SERVER_STATE_CHANGE | Yes | Yes |
Server initialisation before metadata is passed to the booting server | SERVER_METADATA_UPDATE | Yes | No |
Iteration of billing cycle (automatic) | BILLING | No | Yes |
Iteration of invoice collection cycle (automatic) | COLLECTION | No | Yes |
The initiating event can be filtered, for example a CREATE
trigger could be initiated only by the creation of a disk or server. This filtering is done using the triggerOption field in the trigger's entry point. For more information, see Writing an FDL trigger.
The available triggerOption depends on the triggerType in the entry point. The following triggerOptions are available:
triggerType | triggerOption |
| Any FDL ResourceType, for example {“DISK”, “SERVER”}. |
| Any FDL ResourceType, for example {“DISK”, “SERVER”}. |
| Any FDL ResourceType, for example {“DISK”, “SERVER”}. |
| Always {“ANY”}. |
POST_PAYMENT | "SUCCESS","FAILURE", or "CANCELLED" |
| Always {“ANY”}. |
|
|
POST_AUTH | "SUCCESS" or "FAILURE". |
| Always {“ANY”}. |
| Always {“ANY”}. |
| Always {“ANY”}. |
| Always {“ANY”}. |
| Always {“ANY”}. |
| Any FDL ServerStatus, for example {“STOPPED”, “ERROR”}. |
| Any user API call, for example createServer. |
| Any admin API call, for example doUnitTransaction. |
| Any FDL JobStatus, for example {“FAILED”}. |
| Any FDL ErrorInternal, FDL ErrorInvalidInput, |
After the trigger has been initiated, it can perform a second action using one of a number of helper modules. For more information about helper modules, see Writing an FDL trigger.
Triggers can be used to perform any of the following actions:
- Sending a text based email, either to a customer or billing entity based on their UUID or to an arbitrary email address.
- Making an HTTP call and processing the result.
Making a user API or admin API call
For all API calls apart from list calls, this action can only be initiated by post triggers. List calls can also be initiated by pre triggers.
- Writing an entry in the syslog.
- Running a local executable file.
- Reading or writing a file.
- Manipulating XML documents, objects, and nodes.