| copyright |
|
||
|---|---|---|---|
| lastupdated | 2024-02-29 | ||
| keywords | event-notifications, event notifications, about event notifications, destinations, code engine | ||
| subcollection | event-notifications |
{{site.data.keyword.attribute-definition-list}}
{: #en-destinations-codeengine}
{{site.data.keyword.codeenginefull_notm}} is a fully managed, serverless platform that runs your containerized workloads, including web apps, micro-services, event-driven functions, or batch jobs. {{site.data.keyword.codeengineshort}} represents a service destination, where an incoming notification can be consumed programmatically. For example, an incoming notification about an event can trigger a {{site.data.keyword.codeengineshort}} destination to a backend microservice to act based on the content of the incoming notification. {: shortdesc}
{: #en-codeengine-configure}
Before you configure {{site.data.keyword.codeengineshort}} as a destination for run type Job, make sure that you have a {{site.data.keyword.codeengineshort}} project created and job configured in the same account as your {{site.data.keyword.en_short}} instance.
{: note}
If there is run type Job, if you are using {{site.data.keyword.en_short}} CLI or API to configure {{site.data.keyword.codeengineshort}} job as a destination, help ensure that you have enabled authorization to grant access between services. For more information, see Using authorizations to grant access between services.
{: important}
To configure a {{site.data.keyword.codeengineshort}} destination, do the following steps:
-
From your {{site.data.keyword.en_short}} instance dashboard, click Destinations.
-
Click Add + to add a new destination.
-
In the Add a destination side panel, provide the following details.
- Name - Enter a name for your destination.
- Description - Optionally, enter a description for your destination.
- Type - Under Destination, for the Type, select {{site.data.keyword.codeengineshort}} from the list as your destination type.
- Run Type - Select one of the run type {{site.data.keyword.codeengineshort}} jobs or {{site.data.keyword.codeengineshort}} application.
If selected run type is job, then provide the following details:
-
Project name - Select the {{site.data.keyword.codeengineshort}} project name from the list, if you already have a {{site.data.keyword.codeengineshort}} project. Otherwise, click the Create new project link to create an {{site.data.keyword.codeengineshort}} project.
When you select a {{site.data.keyword.codeengineshort}} project, the authorization between the services will be created internally between the two service instances, if the authorization between the services doesn't exist. {: note}
-
Job name - Select the job name from the list.
If selected run type is application, then provide the following details:
- URL - Enter {{site.data.keyword.codeengineshort}} application secured URL (only HTTPS).
- Verb - Select the Verb to be called (GET or POST).
- Headers - Optionally, enter a list of headers to be passed to {{site.data.keyword.codeengineshort}} application.
-
Click Add.
{{site.data.keyword.en_short}} now supports Code Engine Functions. {: note}
{: #en-using-s2s-auth1-ce}
Use {{site.data.keyword.cloud}} Identity and Access Management (IAM) to create or remove an authorization that grants one service access to another service.
{: #en-using-s2s-console-ce}
-
In the {{site.data.keyword.cloud_notm}} console, click Manage > Access (IAM), and select Authorizations.
-
Click Create.
-
Select a source account.
- If the source service that needs access to the target service is in this account, select This account.
-
Select a Source service such as Event Notifications.
-
Specify whether you want the authorization to be for all resources or Resources based on selected attributes. If you have chosen Resources based on selected attributes, then specify the Add attributes: only source resource group or only source service instance.
-
Select a Target service as {{site.data.keyword.codeengineshort}}.
-
For the target service, specify whether you want the authorization to be for all projects, only to a specific project in the account, or projects only in a certain resource group.
-
Select both the roles (Viewer and Writer) to assign access to the source service that accesses the target service.
If you have selected only one of these two roles (Reader or Writer) during the service to service authorization, you cannot trigger a job or configure destination. You get an error for service to service authorization failure in these cases. Make sure that you recreate an authorization between the services with both the roles selected. {: important}
-
Click Authorize.
{: #en-create-auth-cli1-ce}
To authorize a source service to access a target service, run the ibmcloud iam authorization-policy-create command.
For more information about all of the parameters that are available for this command, see ibmcloud iam authorization-policy-create.
{: #en-codeengine-access-event-payload}
The event payload has been transmitted to {{site.data.keyword.codeengineshort}} job by using an environment variable, which can be retrieved by using the ibmendata environment variable.
{: #en-codeengine-test-destination}
You can test a {{site.data.keyword.codeengineshort}} destination in the options menu that is provided against the destination. You can effortlessly test a destination, whether the provided configuration is correct or not with a single click.
For more information on testing a destination, see Testing Destinations.
{: #en-codengine-retry}
When sending notifications to {{site.data.keyword.codeengineshort}}, issues such as network errors and application glitches can cause the requests to fail. {{site.data.keyword.en_short}} automatically retries failed requests to provide resiliency.
For detailed information about retry behavior, including retry attempts, delays, and timeout values, see Retry policy for destinations.