Plugins
Plugins extend the functionality of Cloudomation Engine.
Use Cases
Use a plugin to
- extend the Cloudomaton User Interface with action buttons which create executions when clicked.
Concept
Plugin actions are restricted to a resource type. For each plugin action an action button will appear when viewing resources of the specified type. Clicking on a plugin action button will start an execution of the referenced flow and pass the ID of the resource in the input_value.
We recomment to distribute plugins as part of a design self-contained project. The project should contain all resources (flows, settings, actions, etc.) which are needed for its purpose. If a plugin has dependencies, it should always check if they exist and provide meaningful errors when they are missing.
See Projects for more information about projects.
Configuration
Please see the table below for the different plugin fields and their meanings:
Field | Description |
---|---|
Enabled | If unset, Engine will not create action buttons of the plugin actions. |
Please see the table below for the different plugin_action fields and their meanings:
Field | Description |
---|---|
Parent action | When set, this action will be placed in a dropdown menu below the parent action. |
Resource type | an Engine resource type where the action should create a button. |
Color | The color of the button. Currently not used. |
Icon | An icon to display on the button. |
Enabled | If unset, the action does not create a button. |
Flow | The flow which should be started when the button is clicked. |
Type | One of LIST or RECORD . See Action types. |
Record filter | An additional filter to limit the rows for which the action button is created. See Record filter. |
Action Types
-
LIST
The action button is also shown in list views. When clicked the flow is started once and the execution gets all record IDs passed in the input_value.
-
RECORD
The action button is shown in the record header. When clicked the flow is started once for each record and each execution gets one record ID passed in the input_value.
Record filter
Additional filters can be specified in key-value pairs.
When using the record filter connector_type: SSH
the action button will only appear for connectors of type "SSH"
Action Handler Flow
The flow which is registered in a plugin action will be used to create an execution when the action button is pressed.
Flow to handle a "LIST" plugin action
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
# Type "LIST" actions pass "ids"
ids = inputs['ids']
# we iterate over the list of IDs
for id_ in ids:
# read the type of the resource and the name
this.log(system.resource(id, by='id').get('resource_type', 'name'))
return this.success('all done')
Flow to handle a "RECORD" plugin action
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
inputs = this.get('input_value')
# Type "RECORD" actions pass "id"
id_ = inputs['id']
this.log(f'I was called with the ID {id_}')
return this.success('all done')
Example
We provide an example plugin as part of the Connection Analysis & Test bundle.