Invoke Oracle Cloud Infrastructure Functions Directly from an Integration with an OCI Function Action
Oracle Integration provides native support for invoking Oracle Cloud Infrastructure functions. This support enables you to invoke Oracle Cloud Infrastructure functions with an OCI Function action in an integration.
Oracle Cloud Infrastructure functions are part of a fully managed, multi-tenant, highly scalable, on-demand, Functions-as-a-Service platform. Use Oracle Cloud Infrastructure functions to focus on writing code to meet business needs. See Overview of Functions and Functions QuickStart Guides.
Note:
Ensure that your cloud tenancy uses identity domains. The OCI Function action in the integration canvas does not work in cloud tenancies that are not enabled for identity domains.Want to see a video demo of the OCI Function action?
Capabilities
- Creating a digital signature based on a key against a specific payload.
- Supporting a custom ZIP format such as GZIP or TAR.
- Taking and parsing a PDF file for data fields that can then participate in an integration.
Oracle Integration supports whatever functions you create using Oracle Cloud Infrastructure functions. Oracle Cloud Infrastructure also provides a catalog of prebuilt functions. See Creating Functions Using Pre-Built Functions.
Prerequisites
Note:
When making cross-region calls (the function is in a different region than that of the Oracle Integration service instance), ensure you do the following:- The tenancy is subscribed to both regions. See Subscribing to an Infrastructure Region.
- The identity domain in which the Oracle Integration service instance resides is replicated to both regions. See Replicating an Identity Domain to Multiple Regions.
An authentication issue was encountered when invoking Function. Please
check if the prerequisites for calling OCI services have been properly setup for
this service instance. OCI service integration requires dynamic groups and policies
granting access to be created in OCI Console. Please consult the documentation for
more information.
- Ensure that your cloud tenancy uses identity domains. Invoking Oracle Cloud Infrastructure functions from an integration does not work in cloud tenancies that are not enabled for identity domains. If you are unsure, ask your administrator for details.
- Set up your environment to invoke Oracle Cloud
Infrastructure functions from an integration. See Functions QuickStart on Cloud
Shell. This section describes how to set up the following:
- Set up your tenancy:
- Create groups and users (if not already done so).
- Create a compartment in which to create functions. You specify this compartment when configuring the OCI Function action in the integration canvas.
- Create a virtual cloud network (VCN) and subnets.
For example:
- Create a policy for groups and services. This policy
enables you to create functions. For example:
- Create an application in which to create the functions to
invoke. You specify this application when configuring the OCI
Function action in the integration canvas. For
example:
- Set up your Cloud Shell development environment.
- Create, deploy, and invoke your function. For example:
Note:
You must create your own functions in your tenancy. Oracle Cloud Infrastructure doesn't deploy or create any functions for you by default. Oracle Cloud Infrastructure does provide prebuilt functions that you can deploy to your own instance.
- Set up your tenancy:
- Create a dynamic group.
- Obtain the client ID of the OAuth application for the Oracle Integration instance.
- In the navigation pane, select Identity & Security.
- Under Identity, select Domains.
- In the upper right corner, select Profile, then click the identity domain.
- In the menu bar, click Oracle cloud
services.
The Oracle Cloud Services page for your domain appears.
- In the Name column, click your service instance.
- Click OAuth configuration.
- Scroll down to the General Information section and copy the client ID value to use to create your dynamic group.
- Scroll to the breadcrumbs at the top and click Oracle
cloud services to return to the main page for the identity
domain.
- In the menu bar, click Dynamic
groups.
- Click Create dynamic group.
- Enter the following details:
- In the Name and Description fields, enter values. These fields are required.
- In the Matching Rules section, enter
the required rule. The resource ID you specify must match the client ID
of the OAuth application of your Oracle Integration instance. Ensure
that you enclose the value in single quotes. For
example:
resource.id = 'client_ID'
- In the left navigation pane, click Policies to assign a policy to the dynamic group to enable you to invoke Oracle Cloud Infrastructure functions from an integration.
- Click Create Policy.
- Enter the following details:
- In the Name and Description fields, enter values. These fields are required.
- In the Policy Builder section, click
Show manual editor to build the required
policy for the dynamic group. The following example allows the dynamic
group to use the entire functions family, but you can set more granular
policies, as needed. See Controlling Access to
Invoke and Manage Functions and Policy Statements to
Give OCI Functions Users Access to Function-Related
Resources.
Allow dynamic-group group_name to use functions-family in compartment compartment_name
Where:group_name
: Is the dynamic group name you created.compartment_name
: Is the compartment where the functions to invoke are hosted.
Note:
If you are not creating the policy in the default domain, then specify your domain name in front of the group name. For example:Allow dynamic-group identity_domain/group_name to use functions-family in compartment compartment_name
This enables the Oracle Integration instance associated with the dynamic group to invoke Oracle Cloud Infrastructure functions with the OCI Function action in an integration.
Invoke Oracle Cloud Infrastructure Functions
This section provides an overview of how to configure an OCI Function action in the integration canvas to invoke the Oracle Cloud Infrastructure functions available in your application.
- Add an OCI Function action to an integration
in either of the following ways:
- On the side of the canvas, click
Actions
and drag the OCI Function action to the appropriate location.
- Click
at the location where you want to add the parallel action, then select OCI Function.
Note:
If your cloud tenancy is not using identity domains, an error message appears and the page is blank.The OCI Functions wizard appears.
- On the side of the canvas, click
Actions
- On the Basic Info page, enter the following information to identify
the function to invoke, then click >. When you enter
details in a field, the page refreshes to show more fields.
Element Description Region Select the region where the functions are deployed. Compartment Select the compartment where the functions to invoke are hosted. Application Select the application. Oracle Cloud Infrastructure functions are organized in sets called applications. An application can contain multiple functions. Function Select the Oracle Cloud Infrastructure function to invoke. The functions you are entitled to invoke by your application are displayed for selection.
- On the Request page, select the payload type and specify the
content, then click >.
- JSON Sample: Drag and drop or select a file, or manually enter the payload.
- XML Schema: Drag and drop or select a file.
- XML Sample (Single or No NameSpace): Drag and drop or select a file.
- Binary:
- For files, simply select Binary and map the content.
- For plain/text request/response payloads, select
Binary and perform the following
encoding:
- To provide text as input, you must first
encode the text as
Base64
, then decode thatBase64
to a stream reference.decodeBase64ToReference(encodeBase64(Name))
- To receive the text output, you need to
encode the output stream reference to
Base64
, then decode thatBase64
to text.decodeBase64(encodeReferenceToBase64(Stream Reference))
- To provide text as input, you must first
encode the text as
- On the Response page, select the response payload type and specify the content, then click >. The available response payload types are the same as the request payload types.
- Review your selections on the Summary page. For this example, the
hello-python-json function is invoked. The request
and response media is in JSON format.
- Click Done.