- Using the Rapid Adapter Builder with Oracle Integration 3
- Work with the Adapter Definition Document
- Update Flow Definitions
- Work with Flow Definitions
- Fetch Design Time Configuration Values Using a Flow
Fetch Design Time Configuration Values Using a Flow
This procedure provides an overview of how to use a flow to retrieve design time configuration values.
- Open the adapter definition document in Visual Studio Code Editor.
- In the
flows
code section of the document, write the code for the required flows. For example, the following code sample containscompartmentIdFlow
,applicationIdFlow
, andfunctionIdFlow
flows.Note:
In this code sample, the flows return array outputs that work as input for another flow."flows": { "compartmentIdFlow":{ "id": "compartmentIdFlow", "description": "compartmentIdFlow", "specVersion": "0.8", "version": "0.1", "start": "startState", "functions": [ { "name": "generalRestFunc", "type": "custom", "operation": "connectivity::rest" }, { "name": "getTenantId", "type": "expression", "operation": "if .configuration.tenantId then .configuration.tenantId else .connectionProperties.TenancyOCID end" }, { "name": "mergeTenantsList", "type": "expression", "operation": "[.rootCompartment] + .childCompartments" } ], "states":[ { "name":"startState", "type":"operation", "actions":[ { "functionRef": "getTenantId", "actionDataFilter": { "toStateData": "${ .configuration.tenantId }" } }, { "functionRef": { "refName": "generalRestFunc", "arguments": { "uri": "${ \"https://identity.\" + .connectionProperties.region + \".oraclecloud.com/20160918/compartments/\" + .configuration.tenantId }", "method": "GET" } }, "actionDataFilter": { "results": "${ {keyName:.body.id, displayName:.body.name} }", "toStateData": "${ .rootCompartment }" } }, { "functionRef": { "refName": "generalRestFunc", "arguments": { "uri": "${ \"https://identity.\" + .connectionProperties.region + \".oraclecloud.com/20160918/compartments\" }", "method": "GET", "parameters": { "compartmentId": "${ .configuration.tenantId }", "lifecycleState": "ACTIVE", "compartmentIdInSubtree": true } } }, "actionDataFilter": { "results": "${ .body | map({keyName:.id, displayName:.name}) }", "toStateData": "${ .childCompartments }" } }, { "functionRef": "mergeTenantsList", "actionDataFilter": { "toStateData": "${ .output }" } } ], "end": true } ] }, "applicationIdFlow": { "id": "applicationIdFlow", "description": "applicationIdFlow", "specVersion": "0.8", "version": "0.1", "start": "startState", "functions": [ { "name": "generalRestFunc", "type": "custom", "operation": "connectivity::rest" } ], "states":[ { "name":"startState", "type":"operation", "actions":[ { "functionRef": { "refName": "generalRestFunc", "arguments": { "uri": "${ \"https://functions.\" + .connectionProperties.region + \".oraclecloud.com/20181201/applications\" }", "method": "GET", "parameters": { "compartmentId": "${ .configuration.compartmentId }" } } }, "actionDataFilter": { "results": "${ .body | map({keyName:.id, displayName:.displayName}) }", "toStateData": "${ .output }" } } ], "end": true } ] }, "functionIdFlow": { "id": "functionIdFlow", "description": "functionIdFlow", "specVersion": "0.8", "version": "0.1", "start": "startState", "functions": [ { "name": "generalRestFunc", "type": "custom", "operation": "connectivity::rest" } ], "states":[ { "name":"startState", "type":"operation", "actions":[ { "functionRef": { "refName": "generalRestFunc", "arguments": { "uri": "${ \"https://functions.\" + .connectionProperties.region + \".oraclecloud.com/20181201/functions\" }", "method": "GET", "parameters": { "applicationId": "${ .configuration.applicationId }" } } }, "actionDataFilter": { "results": "${ .body | map({keyName:.id, displayName:.displayName}) }", "toStateData": "${ .output }" } } ], "end": true } ] } }
- In the
actions
code section of the document, define an action with a flow that retrieves configuration values from design time.Sample code:
{ "actions":{ "invokeFunctionAction": { "description": "Invoke Function", "summary": "Invoke Function.", "group": "function", "urn": "flow:invokeFunctionFlow", "input": { "userDefined": true }, "output": { "userDefined": true }, "configuration": [ { "name": "tenantId", "displayName": "Override Tenant OCID", "description": "", "type": "TEXT_BOX", "required": false }, { "name": "compartmentId", "displayName": "Compartment Name", "description": "", "type": "COMBO_BOX", "urn": "flow:compartmentIdFlow", "required": true }, { "name": "applicationId", "displayName": "Application Name", "description": "", "type": "COMBO_BOX", "urn": "flow:applicationIdFlow", "required": true, "dependencies": { "compartmentId": { "values": [] } } }, { "name": "functionId", "displayName": "Function Name", "description": "", "type": "COMBO_BOX", "urn": "flow:functionIdFlow", "required": true, "dependencies": { "applicationId": { "values": [] } } } ] } } }