Data Model
The data-model of Cloudomation Engine helps understand the relationships between objects in Engine. It also helps understand how access objects through the flow_api
.
Colour coding
Boxes
The boxes display records in the data-model. Each box lists their respective fields e.g. a webhook
has the field flow_id
.
Colour | Meaning | Explanation |
---|---|---|
Dark Orange | Meta Type | A record that serves as a base class for other records e.g. identity . Usually, you don't directly interact with them with the flow_api . |
Blue | Specific Type | A record that derives from a meta type e.g. flow . Most of the cases these are the types you interact with via the flow_api . |
Orange | Subrecord | A record that does not derive from a meta type. They can serve as N-to-N mappings between other types e.g. mapping static wrappers to flows. |
Arrows
The arrows show the relationships between types.
Types that derive from another type inherit their fields and foreign key references e.g. an activity
inherits all fields of a record
.
Colour | Meaning | Explanation |
---|---|---|
Orange | Point to the Meta Type | If a box points to a meta type with an orange arrow, it means that it's derived from that meta type e.g. activity is derived from record . |
Black | Foreign Key | If a box points to another box with a black arrow, it signalizes a reference to that object (subrecord or type) e.g. webhook points to flow , meaning that the webhook has a reference to a flow in the form of the flow_id field. |
Flow Api Classes
The classes of the flow_api
are automatically derived from the data-model.
The class name is the "camel-case" version of the type name. For example:
the class for plugin_action
is flow_api.plugin_action.PluginAction
.
While you can instanciate the classes directly, you should instead rely on the methods of flow_api.System
to do so.
So instead of this:
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
plugin_action = flow_api.plugin_action.PluginAction(...)
return this.success('all done')
you should do this:
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
plugin_action = system.plugin_action(...)
return this.success('all done')
Object References
Methods for navigating between objects in the flow_api
are automatically derived from the data-model.
Outbound Reference
You can access an object that is referenced by another object through a foreign key.
For example if a webhook
references a flow
, a flow
method exists so you can access the referenced flow
.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
flow = system.webhook(...).flow()
return this.success('all done')
Inbound Reference
If an object can be referenced by other objects through a foreign key, you can list those objects.
For example if a flow
is referenced by one or more webhook
(s), a flow_list
method exists so you can access the webhook
(s) that reference the flow
.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
webhook_list = system.flow(...).webhook_list()
return this.success('all done')
Creating References
If an object can reference another object through a foreign key, you can create and reference the object.
For example if a webhook
can reference a resource_wrapper
, an add_resource_wrapper
method exists so you can and a reference to a wrapper
.
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
resource_wrapper = system.webhook(...).add_resource_wrapper()
return this.success('all done')
Graphical Data Model
Below is a drawing of Cloudomation Engine's data-model.
Right-click the image and select "Open image in new tab".