Creating a Trigger
Function
This API is used to create a trigger. Tiggers that can be created include timer, APIG, CTS, DDS, DMS, DIS, LTS, OBS, SMN, and Kafka. By default, DDS and Kafka triggers are in the DISABLE state, and other triggers are in the ACTIVE state. Only timer, DDS, DMS, Kafka, and LTS triggers can be disabled.
URI
POST /v2/{project_id}/fgs/triggers/{function_urn}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Tenant's project ID. |
|
function_urn |
Yes |
String |
Function URN. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
trigger_type_code |
Yes |
String |
Trigger type. Enumeration values:
|
|
trigger_status |
No |
String |
Trigger status. Options: ACTIVE and DISABLED. Enumeration values:
|
|
event_type_code |
Yes |
String |
Message code. |
|
event_data |
Yes |
Object |
Event struct. |
Response Parameters
Status code: 201
|
Parameter |
Type |
Description |
|---|---|---|
|
trigger_id |
String |
Trigger ID. |
|
trigger_type_code |
String |
Trigger type. Enumeration values:
|
|
trigger_status |
String |
Trigger status. ACTIVE: The trigger is enabled. DISABLE: The trigger is disabled. Enumeration values:
|
|
event_data |
Object |
Trigger source event. |
|
last_updated_time |
String |
Latest update time. |
|
created_time |
String |
Time when the trigger is created. |
Example Requests
POST https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/triggers/urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest
{
"trigger_type_code" : "TIMER",
"trigger_status" : "ACTIVE",
"event_type_code" : "MessageCreated",
"event_data" : {
"name" : "Timer-fbb4",
"schedule" : "3m",
"schedule_type" : "Rate",
"user_event" : ""
}
}
Example Responses
Status code: 201
Created
{
"trigger_id" : "9a14fae1-78cf-4185-ac7a-429eb6dc41fb",
"trigger_type_code" : "TIMER",
"trigger_status" : "ACTIVE",
"event_data" : {
"name" : "Timer-fbb4",
"schedule" : "3m",
"schedule_type" : "Rate"
},
"last_updated_time" : "2019-10-29T17:15:53+08:00",
"created_time" : "2019-10-29T17:15:53+08:00"
}
Status code: 404
Not Found
{
"error_code" : "FSS.1051",
"error_msg" : "Error getting associated function"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
201 |
Created |
|
404 |
Not Found |
Error Codes
See Error Codes.
Last Article: Querying the Triggers of a Function
Next Article: Deleting a Trigger
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.