Updates a trigger.
Request headers
This operation uses only common request headers and does not have operation-specific request headers. For more information, see the documentation of common request parameters.
Parameter | Type | Required | Example | Description |
If-Match | String | No | e19d5cd5af0378da05f63f891c74**** | This parameter is used to ensure that the modified resource is consistent with the resource to be modified. You can obtain the parameter value from the responses of CreateTrigger, GetTrigger, and UpdateTrigger operations. |
Request syntax
PUT /services/{serviceName}/functions/{functionName}/triggers/{triggerName} HTTP/1.1
Request parameters
Parameter | Type | Position | Required | Example | Description |
serviceName | String | Path | Yes | service_name | The name of the service. |
functionName | String | Path | Yes | function_name | The name of the function. |
triggerName | String | Path | Yes | image_resize | The name of the trigger. |
Object | Body | Yes | The definition of the trigger. | ||
invocationRole | String | Body | No | acs:ram::1986114****4305:role/aliyunosseventnotificationrole | The role that is required when event sources such as Object Storage Service (OSS) invoke the function. For more information, see Overview. Note You do not need to specify this field to create an EventBridge trigger. |
qualifier | String | Body | No | null | The version of the service. For more information, see Overview. |
triggerConfig | String | Body | No | {\"payload\":\"Test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true} | The configurations of the trigger. The configurations vary with trigger types. For more information about the format, see the following data structures:
|
Response parameters
Parameter | Type | Example | Description |
ETag | String | 738136ea26b79cee660862cd7628**** | This parameter is used to ensure that the modified trigger is consistent with the trigger to be modified. |
createdTime | String | 2020-04-08T01:48:21Z | The time when the trigger was created. |
invocationRole | String | acs:ram::19861144305****:role/aliyunosseventnotificationrole | The role that is required when event sources such as OSS invoke the function. For more information, see Overview. |
lastModifiedTime | String | 2020-04-08T07:15:37Z | The time when the trigger was last updated. |
qualifier | String | null | The version of the service. For more information, see Overview. |
sourceArn | String | acs:oss:cn-shanghai:12345:mybucket | The Alibaba Cloud Resource Name (ARN) of the event source for the trigger. |
triggerConfig | String | {\"payload\":\"Test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true} | The configurations of the trigger. The configurations vary with trigger types. |
triggerName | String | trigger_name | The name of the trigger. |
triggerType | String | oss | The type of the trigger. Valid values:
|
Example
Sample requests
PUT /services/service_name/functions/function_name/triggers/image_resize HTTP/1.1
Host:fc-ram.aliyuncs.com
If-Match:e19d5cd5af0378da05f63f891c74****
Content-Type:application/json
{
"invocationRole" : "acs:ram::1986114****4305:role/aliyunosseventnotificationrole",
"qualifier" : "null",
"triggerConfig" : "{\"payload\":\"Test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}"
}
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateTriggerResponse>
<createdTime>2020-04-08T01:48:21Z</createdTime>
<invocationRole>acs:ram::19861144305****:role/aliyunosseventnotificationrole</invocationRole>
<lastModifiedTime>2020-04-08T07:15:37Z</lastModifiedTime>
<qualifier>null</qualifier>
<sourceArn>acs:oss:cn-shanghai:12345:mybucket</sourceArn>
<triggerConfig>{\"payload\":\"Test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}</triggerConfig>
<triggerName>trigger_name</triggerName>
<triggerType>oss</triggerType>
</UpdateTriggerResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"createdTime" : "2020-04-08T01:48:21Z",
"invocationRole" : "acs:ram::19861144305****:role/aliyunosseventnotificationrole",
"lastModifiedTime" : "2020-04-08T07:15:37Z",
"qualifier" : "null",
"sourceArn" : "acs:oss:cn-shanghai:12345:mybucket",
"triggerConfig" : "{\"payload\":\"Test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}",
"triggerName" : "trigger_name",
"triggerType" : "oss"
}