Alibaba Cloud Content Delivery Network (CDN) is seamlessly integrated with Function Compute. You can write a function to perform custom processing on CDN events. Then, you can configure a CDN event trigger to trigger the execution of the function when the CDN system receives an event that is of the specified type and meets the filtering criteria.
A CDN event trigger can integrate the Function Compute service and the CDN service in the following scenarios:
- When user data is preloaded and refreshed in the CDN system, CachedObjectsPushed and CachedObjectsRefreshed events occur, respectively. The CDN event trigger automatically triggers the execution of the specified function. In this way, you can learn about the preload and refresh statuses of resources in a timely manner before proceeding to the next step, avoiding constantly polling the list for the latest status.
- When the CDN system detects prohibited content, a CachedObjectsBlocked event occurs. The CDN event trigger automatically triggers the execution of the specified function to directly delete the resource from the origin. In this way, you can delete resources from the origin in a timely manner without waiting for a response from the CDN team.
- When a log file is generated, a LogFileCreated event occurs. The CDN event trigger automatically triggers the execution of the specified function to process the log. In this way, you can dump or process logs in a timely manner without waiting for logs.
- When a domain name for CDN is enabled or disabled, a CdnDomainStarted or CdnDomainStopped event occurs, respectively. The CDN event trigger automatically triggers the execution of the specified function to process data in a timely manner.
When the CDN system detects a related event, the CDN system encodes the information about the event into a JSON string and passes the JSON string to the corresponding function for processing. The following table lists the events and versions that are currently supported by CDN event triggers.