Skip to content

Add Aliyun OSS EventBridge integration from aliyun branch#9

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/add-aliyun-events-code
Closed

Add Aliyun OSS EventBridge integration from aliyun branch#9
Copilot wants to merge 3 commits intomainfrom
copilot/add-aliyun-events-code

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

Merges Aliyun OSS EventBridge webhook handler from the aliyun branch. Enables automatic CDN cache invalidation when objects change in OSS buckets.

Core Components

Aliyun API Client (src/aliyun/)

  • V3 signature algorithm (HMAC-SHA256 with RFC 3986 encoding)
  • CDN client with RefreshObjectCaches API for internal use
  • Reusable signer for extensibility to other Aliyun services

API Endpoint (src/routes/aliyun_handlers.rs)

  • POST /api/aliyun/events - OSS EventBridge webhook (custom token via x-eventbridge-signature-token header)

Configuration (src/config.rs, example.toml)

[aliyun]
access_key_id = "LTAI5t..."
access_key_secret = "xxxxx"

[aliyun.bucket_url_map]
"my-oss-bucket" = "https://cdn.example.com/{object_key}"

Notable Changes

  • Made Claims.sub optional to support EventBridge JWT tokens without subject claims
  • Updated tracing whitelist from my_axum_template to janus module prefix
  • Added dependencies: sha2, hmac, base64, urlencoding, uuid

EventBridge Webhook Flow

  1. OSS fires event (ObjectCreated/ObjectRemoved) → EventBridge
  2. EventBridge POSTs to /api/aliyun/events with JWT token in custom header
  3. Handler maps bucket name to CDN URL via bucket_url_map
  4. URL template {object_key} replaced with percent-encoded object key
  5. Automatic CDN cache refresh triggered via RefreshObjectCaches API

Example event processing:

// Event: bucket "static-assets", object "images/logo.png"
// Config: "static-assets" → "https://cdn.example.com/{object_key}"
// Result: Refreshes https://cdn.example.com/images%2Flogo.png
Original prompt

比较main和aliyun分支 创建一个pr把aliyun分支里面有关/aliyun/events的代码提交的main分支


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add aliyun module with CDN API client and V3 signature
- Add OSS EventBridge webhook handler for automatic CDN refresh
- Add CDN API endpoints: describeRefreshTasks, refreshObjectCaches
- Update configuration, state, auth, and routing for aliyun support
- Add demo.jsonl with sample OSS events
- Add .vscode/launch.json for debugging
- All builds and clippy checks pass

Co-authored-by: daflyinbed <21363956+daflyinbed@users.noreply.github.com>
Copilot AI changed the title [WIP] Add code related to /aliyun/events from aliyun branch Add Aliyun CDN and OSS EventBridge integration from aliyun branch Jan 17, 2026
Copilot AI requested a review from daflyinbed January 17, 2026 07:47
@daflyinbed
Copy link
Copy Markdown
Collaborator

@copilot 去掉/api/aliyun/events以外的两个接口

- Remove /api/aliyun/describeRefreshTasks endpoint
- Remove /api/aliyun/refreshObjectCaches endpoint
- Remove unused CDN request/response structures
- Remove describe_refresh_tasks method from AliyunCdnClient
- Update OpenAPI schemas to only include OSS event structures
- Keep only the EventBridge webhook handler for OSS events

Co-authored-by: daflyinbed <21363956+daflyinbed@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot 去掉/api/aliyun/events以外的两个接口

已完成。移除了 /api/aliyun/describeRefreshTasks/api/aliyun/refreshObjectCaches 两个接口,现在只保留 /api/aliyun/events 接口用于处理 OSS EventBridge 事件。

Commit: 847cfce

Copilot AI changed the title Add Aliyun CDN and OSS EventBridge integration from aliyun branch Add Aliyun OSS EventBridge integration from aliyun branch Jan 17, 2026
@daflyinbed daflyinbed closed this Jan 17, 2026
@daflyinbed daflyinbed deleted the copilot/add-aliyun-events-code branch January 19, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants