Template Repository
Introduction
The Template Repository is responsible for storing, retrieving and updating the integration flow templates. Additionally, it can be used to generate integration flows.
Technologies used
MongoDB: MongoDB is used as the Template Repository’s storage solution.
How it works
Templates
A Flow Template is described by a JSON document, describing information required to generate and produce an integration flow. The purpose of templates is to allow the secure re-use and sharing of integration flows. The template includes the entire flow graph, as well as placeholders for information which must be provided to execute a flow. The template can be modified and distributed separate from flow objects.
{
"status": "draft",
"name": "Example Template",
"description": "Basic Template passing data between two components",
"graph": {
"nodes": [
{
"id": "step_1",
"componentId": "1234",
"function": "getData",
"description": "Obtain data from an origin"
},
{
"id": "step_2",
"componentId": "5678",
"function": "postData",
"description": "Send data to target system"
}
],
"edges": [
{
"source": "step_1",
"target": "step_2"
}
]
},
"owners": [
{
"id": "5abf822aa994a100000426ca",
"type": "user"
}
],
"createdAt": "2021-01-18T08:34:45.800Z",
"updatedAt": "2021-01-18T08:34:45.800Z",
"id": "60054800000c03001f3ead80"
}
Note that in practice, nodes will have additional fields, such as what component they use or secrets/arguments to be used by that component.
Template Repository API
The Template Repository offers a REST API through which flows can be stored, retrieved, updated, started, and stopped. To interact with this API, the user must supply a valid bearer token generated by the Identity Management.
List of supported Methods and Routes
endpoint | method | description | comments |
---|---|---|---|
/templates | GET | Returns a list of all templates the user owns | See the section “Ownership and Permissions” for further details |
/templates | POST | Stores a new template | The supplied data is validated for completeness and errors |
/templates/{id} | GET | Returns one particular template by ID | |
/templates/{id} | DELETE | Deletes a template by ID | |
/templates/{id} | PATCH | Updates a template with new data | |
/templates/{id}/generate | POST | Creates an integration flow based on the template and provided data | Data provided in the request body will be merged with the template to create the flow |
For further details and examples, please refer to the API Reference
Ownership and Permissions
Each template contains an arbitrarily long array of owners. A template can only be accessed if the current user (as identified by their bearer token) is among those owners.
Additionally, manipulation of templates is further limited by the permissions of the current user. There are separate permissions for viewing, posting/updating, and generating integration flows. For further information about permissions, please refer to the documentation of the Identity Management.
Interaction with other Services
The Template Repository interacts with these Services:
-
Identity Management: The Template Repository relies on a bearer token supplied by the Identity Management to determine which templates the current user may see, and which actions they may take.
-
Flow Repository: The Template Repository API can generate flows in the Flow Repository for users which have sufficient permissions. These flows will contain a reference to the template which was used in their generation.
-
Component Repository: Components used in a flow template are specified as references to documents in the Component Repository.
-
Secret Service: If an integration flow uses sensitive data (such as login credentials), this data can be securely and opaquely stored in the Secret Service and then referenced.