Help Center/ FunctionGraph/ User Guide/ Creating Triggers/ Using an EG Trigger/ Creating an EG Trigger (OBS Application Service)
Updated on 2024-12-18 GMT+08:00

Creating an EG Trigger (OBS Application Service)

Prerequisites

You have created an OBS bucket, for example, eventbucket. For details, see Creating a Bucket.

Currently, EG triggers are available only in AP-Bangkok, AP-Singapore, AF-Johannesburg, LA-Mexico City2, and LA-Santiago.

Creating an EG Trigger

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. Choose Configuration > Triggers and click Create Trigger.

    Figure 1 Creating a trigger

  4. Set the following parameters:

    • Trigger Type: Select Object Storage Service (OBS).
    • Trigger Name: Enter a trigger name.
    • Bucket Name: Select an OBS bucket.
    • Events: Select the required event type.
    • Prefix: Enter a keyword for limiting notifications to those about objects whose names start with the matching characters. This limit can be used to filter the names of OBS objects.
    • Suffix: Enter a keyword for limiting notifications to those about objects whose names end with the matching characters. This limit can be used to filter the names of OBS objects.
    • Object Name Encoding: Indicates whether to encode an object.

      If you select Delete objects without specifying version for Event Type, enable versioning. For details, see Deleting Objects from a Bucket with Versioning Enabled.

  5. Click OK.

Configuring an EG Event to Trigger the Function

  1. Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. On the function details page, select a version.
  4. On the Code tab page, click Test. The Configure Test Event dialog box is displayed.
  5. Set the parameters described in Table 1 and click Save.

    Table 1 Test parameters

    Parameter

    Description

    Configure Test Event

    You can choose to create a test event or edit an existing one.

    Use the default option Create new test event.

    Event Template

    Select Blank Template. For details about the code, see "OBS Application Service" in Supported Event Sources.

    Event Name

    The event name can contain 1 to 25 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. For example, myobs-123test.

    Event data

    Use the newly created test event.