Adds an FC trigger to Alibaba Cloud CDN, linking a CDN event to a Function Compute function so the function runs automatically when the event fires.
Debugging
Call this API operation directly in OpenAPI Explorer. OpenAPI Explorer calculates the signature automatically and generates SDK sample code.
Authorization information
The following table describes the Resource Access Management (RAM) authorization required for this operation. Use the Action element in a RAM policy to grant a RAM user or RAM role permission to call this operation.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| cdn:AddFCTrigger | create | *All Resources | none | none |
Column descriptions:
Operation: The value to use in the
Actionpolicy element.Access level:
read,write, orlist.Resource type: The resource on which you can authorize the RAM user or role. Required resource types are shown in bold. If permissions cannot be granted at the resource level, the column shows
All Resources.Condition key: The condition key defined by the cloud service.
Associated operation: Other operations the RAM user or role must be permitted to perform to complete this operation.
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| TriggerARN | string | Yes | The ARN of the Function Compute trigger. | acs:fc:cn-beijing:1234567890:services/FCTestService/functions/printEvent/triggers/testtrigger |
| EventMetaName | string | Yes | The name of the event. | LogFileCreated |
| EventMetaVersion | string | Yes | The version of the event. | 1.0.0 |
| SourceARN | string | Yes | The ARN identifying the CDN resources and filters for event listening. | acs:cdn:*:1234567890:domain/example.com |
| FunctionARN | string | No | The ARN of the Function Compute function. | acs:fc:1223455566666:123:services/myservice/functions/myfunction |
| RoleARN | string | Yes | The ARN of the RAM role to assume when invoking the function. | acs:ram::1234567890:role/aliyuncdneventnotificationrole |
| Notes | string | Yes | The remarks for the FC trigger. | test |
SourceARN format
SourceARN follows the format acs:cdn:{RegionID}:{AccountID}:{Filter}.
Filter format:
{FilterName}/{FilterValue}. To specify multiple values forFilterValue, separate them with commas (,) and enclose them in braces ({}).Example — single domain: Setting
Filtertodomain/example.comcauses onlyexample.comto trigger the function.Example — multiple domains: Setting
Filtertodomain/{example.com,aliyundoc.com}causes both domains to trigger the function. TheLogFileCreatedevent supportsdomainas theFilterName.Multiple filters: Separate filters with forward slashes (
/), which apply AND logic. Format:acs:cdn:{RegionID}:{AccountID}:{Filter1}/{Filter2}/{Filter3}...
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| RequestId | string | The request ID. | EC046C5D-8CB4-4B6B-B7F8-B335E51EF90 |
Examples
Sample success response in JSON format:
{
"RequestId": "EC046C5D-8CB4-4B6B-B7F8-B335E51EF90"
}Error codes
| HTTP status code | Error code | Error message |
|---|---|---|
| 400 | NotFound.EventMeta | EventMeta not found. |
| 400 | Duplicated.FCTrigger | FCTrigger has already existed. |
| 400 | InvalidParameter.TriggerARN | The specified parameter TriggerARN is not valid. |
| 400 | InvalidParameter.SourceARN | The specified parameter SourceARN is not valid. |
| 400 | InvalidParameter.FunctionARN | The specified parameter FunctionARN is not valid. |
| 400 | InvalidParameter.RoleARN | The specified parameter RoleARN is not valid. |
| 403 | PermissionDeny | No permission to operate this FCTrigger. |
For a full list of error codes, see Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2024-12-18 | API description update. The error code has changed. | View change details |