Page tree
Skip to end of metadata
Go to start of metadata

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 eventtriggerTypePRE triggersPOST triggers
Creation of a resourceCREATEYesYes
Modification of a resourceMODIFYYesYes
Deletion of a resourceDELETEYesYes
Making an API callUSER_API_CALL or ADMIN_API_CALLYesYes

Jade exception

Exceptions thrown by triggers cannot initiate other triggers.

EXCEPTIONNoYes
Scheduled based on elapsed time intervalSCHEDULEDNoYes
Making a paymentPAYMENTYesYes
Purchasing unitsPURCHASEYesYes
Adding units to a customer's accountUNIT_TRANSACTIONNo Yes
Job state changeJOB_STATE_CHANGEYesYes
Authorisation of a customer accountAUTHYesYes
Server state changeSERVER_STATE_CHANGEYesYes
Server initialisation before metadata is passed to the booting serverSERVER_METADATA_UPDATEYesNo
Iteration of billing cycle (automatic)BILLINGNo Yes
Iteration of invoice collection cycle (automatic)COLLECTIONNo 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

CREATE

Any FDL ResourceType, for example {“DISK”, “SERVER”}.

MODIFY

Any FDL ResourceType, for example {“DISK”, “SERVER”}.

DELETE

Any FDL ResourceType, for example {“DISK”, “SERVER”}.

PRE_PAYMENT

Always {“ANY”}.

POST_PAYMENT
"SUCCESS","FAILURE", or "CANCELLED"

PURCHASE

Always {“ANY”}.

PRE_AUTH

  • "VERIFY" - used when the trigger is invoked using the admin API call verifyUserPassword.
  • "TOKEN" - used when authentication is via an API authentication token.
  • "AUTH" - used when authentication is via the API username and password.
POST_AUTH
"SUCCESS" or "FAILURE".

UNIT_TRANSACTION

Always {“ANY”}.

BILLING

Always {“ANY”}.

COLLECTION

Always {“ANY”}.

SCHEDULED

Always {“ANY”}.

SERVER_METADATA_UPDATE

Always {“ANY”}.

SERVER_STATE_CHANGE

Any FDL ServerStatus, for example {“STOPPED”, “ERROR”}.

USER_API_CALL

Any user API call, for example createServer.

ADMIN_API_CALL

Any admin API call, for example doUnitTransaction.

JOB_STATE_CHANGE

Any FDL JobStatus, for example {“FAILED”}.

EXCEPTION

Any FDL ErrorInternal, FDL ErrorInvalidInput,
FDL ErrorOperationNotPermitted
, or FDL ErrorResourceNotFound.

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.
  • No labels