

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Amazon EventBridge 整合 AWS Clean Rooms 到事件驅動型應用程式
<a name="eventbridge-integration-full"></a>

您可以將 AWS Clean Rooms 納入使用 中發生的事件的事件驅動應用程式 (EDAs)， AWS Clean Rooms 以在應用程式元件之間通訊並啟動下游程序。您可以使用 Amazon EventBridge 將事件從 路由 AWS Clean Rooms 到其他軟體元件來執行此操作。Amazon EventBridge 是一種無伺服器服務，使用事件將應用程式元件連接在一起，讓您更輕鬆地將 等 AWS AWS Clean Rooms 服務整合到事件驅動型架構中，而無需額外的程式碼和操作。

事件驅動架構是一種建置鬆耦合軟體系統的方式，透過發出和回應事件來協作。在此模型中，事件代表資源或環境中的變更。

以下是 EventBridge 的使用方式 AWS Clean Rooms：

如同許多 AWS 服務， AWS Clean Rooms 會產生事件並將其傳送至 EventBridge 預設*事件匯流排*。事件匯流排是接收事件並將其路由至您指定目的地或*目標*的路由器。目標可以包含其他服務 AWS 、自訂應用程式和 SaaS 合作夥伴應用程式。

EventBridge 會根據您在事件匯流排上建立的*規則*路由事件。對於每個規則，您可以指定篩選條件或*事件模式*，以僅選取您想要的事件。每當事件傳送到事件匯流排時，EventBridge 都會將其與每個規則進行比較。如果事件符合規則，EventBridge 會將事件路由到指定的目標 (s)。

![AWS 服務會將事件傳送至 EventBridge 預設事件匯流排。如果事件與規則的事件模式相符，則 EventBridge 會將事件傳送至該規則的指定目標。](http://docs.aws.amazon.com/zh_tw/clean-rooms/latest/userguide/images/eventbridge-integration-how-it-works.png)


例如，假設您每次在帳戶中建立新的 AWS Clean Rooms 協同合作時，都想知道 。您可以在預設事件匯流排上建立規則。在規則中，您會建立事件模式，從名為 的 AWS Clean Rooms 指定事件**Collaboration Created**。每次 EventBridge 收到符合這些屬性的事件時，都會將該事件路由到指定的工作流程。

## AWS Clean Rooms 事件
<a name="eventbridge-service-events-full"></a>

AWS 服務可以直接將事件傳送到 EventBridge 預設事件匯流排。此外， 也會 AWS CloudTrail 將來自許多 AWS 服務的事件傳送至 EventBridge。這些事件可能包括 API 呼叫、主控台登入和動作、服務事件和 CloudTrail Insights。如需詳細資訊，請參閱《*EventBridge 使用者指南*》中的[AWS 透過 傳遞的服務事件 AWS CloudTrail](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event-cloudtrail.html)。

如需傳送至 EventBridge 的完整 AWS Clean Rooms 事件清單，請參閱 [https://docs.aws.amazon.com/eventbridge/latest/ref/welcome.html](https://docs.aws.amazon.com/eventbridge/latest/ref/welcome.html) 中的 AWS Clean Rooms 主題。


| 事件詳細資訊類型 | Description | 
| --- | --- | 
| [已建立分析範本](events-detail-reference-full.md#event-detail-analysis-template-created) | 建立分析範本時，會通知分析範本擁有者和協同合作的所有作用中成員。 | 
| [已更新分析範本](events-detail-reference-full.md#event-detail-analysis-template-updated) | 更新分析範本時，會通知分析範本擁有者和所有可查看更新之協同合作的作用中成員。 | 
| [已刪除分析範本](events-detail-reference-full.md#event-detail-analysis-template-deleted) | 刪除分析範本時，會通知分析範本擁有者和協同合作的所有作用中成員。 | 
| [協同合作已建立](events-detail-reference-full.md#event-detail-collaboration-created) | 協同**合作****建立**時，協同**合作**擁有者會收到通知。 | 
| [協同合作已更新](events-detail-reference-full.md#event-detail-collaboration-updated) | 協同**合作**擁有者和具有更新可見性的所有協同合作作用中成員會在協同**合作****更新**時收到通知。 | 
| [協同合作變更請求已建立](events-detail-reference-full.md#event-detail-collaboration-change-request-created) | 建立協同合作變更請求時，協同合作擁有者和協同合作的所有作用中成員都會收到通知。 | 
| [協作變更請求已核准](events-detail-reference-full.md#event-detail-collaboration-change-request-approved) | 協同合作變更請求已核准時，協同合作擁有者和所有協同合作的作用中成員都會收到通知。  | 
| [協作變更請求已取消](events-detail-reference-full.md#event-detail-collaboration-change-request-cancelled) | 取消協同合作變更請求時，協同合作擁有者和協同合作的所有作用中成員都會收到通知。 | 
| [已遞交協同合作變更請求](events-detail-reference-full.md#event-detail-collaboration-change-request-committed) | 當遞交協同合作變更請求時，協同合作擁有者和協同合作的所有作用中成員都會收到通知。 | 
| [已建立設定的資料表關聯](events-detail-reference-full.md#event-detail-configured-table-association-created) | 建立已設定的資料表關聯時，系統會通知已設定的資料表關聯擁有者和協同合作的所有作用中成員。 | 
| [已更新設定的資料表關聯](events-detail-reference-full.md#event-detail-configured-table-association-updated) | 更新已設定資料表關聯時，系統會通知已設定資料表關聯擁有者和具有更新可見性的所有協同合作作用中成員。 | 
| [已刪除設定的資料表關聯](events-detail-reference-full.md#event-detail-configured-table-association-deleted) | 刪除已設定的資料表關聯時，系統會通知已設定的資料表關聯擁有者和協同合作的所有作用中成員。 | 
| [已建立設定的資料表關聯分析規則](events-detail-reference-full.md#event-detail-configured-table-association-analysis-rule-created) | 建立已設定的資料表關聯分析規則時，系統會通知已設定的資料表關聯分析規則擁有者和協同合作的所有作用中成員。 | 
| [已更新設定的資料表關聯分析規則](events-detail-reference-full.md#event-detail-configured-table-association-analysis-rule-updated) | 已設定資料表關聯分析規則擁有者和所有可查看更新之協同合作的作用中成員，會在已設定資料表關聯分析規則更新時收到通知。 | 
| [已刪除設定的資料表關聯分析規則](events-detail-reference-full.md#event-detail-configured-table-association-analysis-rule-deleted) | 刪除已設定的資料表關聯分析規則時，系統會通知已設定的資料表關聯分析規則擁有者和協同合作的所有作用中成員。 | 
| [已建立 ID 映射表](events-detail-reference-full.md#event-detail-id-mapping-table-created) | 建立 ID 映射表時，會通知 ID 映射表擁有者和協同合作的所有作用中成員。 | 
| [已更新 ID 映射表](events-detail-reference-full.md#event-detail-id-mapping-table-updated) | 更新 ID 映射表時，將會通知 ID 映射表擁有者和具有更新可見性的所有協同合作作用中成員。 | 
| [已刪除 ID 映射表](events-detail-reference-full.md#event-detail-id-mapping-table-deleted) | 刪除 ID 映射表時，會通知 ID 映射表擁有者和協同合作的所有作用中成員。 | 
| [已建立 ID 命名空間關聯](events-detail-reference-full.md#event-detail-id-namespace-association-created) | 建立 ID 命名空間關聯時，會通知 ID 命名空間關聯擁有者和協同合作的所有作用中成員。 | 
| [ID 命名空間關聯已更新](events-detail-reference-full.md#event-detail-id-namespace-association-updated) | 更新 ID 命名空間關聯時，將會通知 ID 命名空間關聯擁有者和具有更新可見性的所有協同合作作用中成員。 | 
| [ID 命名空間關聯已刪除](events-detail-reference-full.md#event-detail-id-namespace-association-deleted) | 刪除 ID 命名空間關聯時，會通知 ID 命名空間關聯擁有者和協同合作的所有作用中成員。 | 
| [邀請加入協同合作](events-detail-reference-full.md#event-detail-invited-to-collaboration) | 當受邀成員受邀參與協同合作時，會收到通知。 | 
| [成員資格已建立](events-detail-reference-full.md#event-detail-membership-created) | 建立成員資格時，會通知成員擁有者和協同合作的所有作用中成員。 | 
| [成員資格已更新](events-detail-reference-full.md#event-detail-membership-updated) | 成員資格更新時會通知成員，除非成員資格已從協同合作中移除，在這種情況下，協同合作的所有作用中成員都會收到通知。 | 
| [已刪除成員資格](events-detail-reference-full.md#event-detail-membership-deleted) | 刪除成員資格時，會通知成員擁有者和協同合作的所有作用中成員。 | 
| [已提交受保護的任務](events-detail-reference-full.md#event-detail-protected-job-submitted) | 受保護任務的任務執行器、任務付款人和結果接收者會在提交受保護任務時收到通知。 | 
| [受保護的任務已啟動](events-detail-reference-full.md#event-detail-protected-job-started) | 受保護任務的任務執行器、任務付款人和結果接收者會在受保護任務啟動時收到通知。 | 
| [受保護的任務取消](events-detail-reference-full.md#event-detail-protected-job-cancelling) | 當受保護任務取消時，系統會通知受保護任務的任務執行器、任務付款人和結果接收者。 | 
| [已取消受保護的任務](events-detail-reference-full.md#event-detail-protected-job-cancelled) | 受保護任務的任務執行器、任務付款人和結果接收者會在受保護任務取消時收到通知。 | 
| [受保護任務成功](events-detail-reference-full.md#event-detail-protected-job-succeeded) | 當受保護任務成功時，系統會通知受保護任務的任務執行器、任務付款人和結果接收者。 | 
| [受保護任務失敗](events-detail-reference-full.md#event-detail-protected-job-failed) | 受保護任務的任務執行器、任務付款人和結果接收者會在受保護任務失敗時收到通知。 | 
| [已提交受保護的查詢](events-detail-reference-full.md#event-detail-protected-query-submitted) | 提交受保護查詢時，會通知受保護查詢的查詢執行器、查詢付款人和結果接收者 （們）。 | 
| [已啟動受保護的查詢](events-detail-reference-full.md#event-detail-protected-query-started) | 受保護查詢的查詢執行器、查詢付款人和結果接收者 (Informed Query) 會在受保護查詢啟動時收到通知。 | 
| [受保護的查詢取消](events-detail-reference-full.md#event-detail-protected-query-cancelling) | 當受保護查詢取消時，會通知受保護查詢的查詢執行器、查詢付款人和結果接收者 （們）。  | 
| [已取消受保護的查詢](events-detail-reference-full.md#event-detail-protected-query-cancelled) | 受保護查詢的查詢執行器、查詢付款人和結果接收者 （含） 會在受保護查詢取消時收到通知。 | 
| [受保護查詢成功](events-detail-reference-full.md#event-detail-protected-query-succeeded) | 當受保護查詢成功時，會通知受保護查詢的查詢執行器、查詢付款人和結果接收者 （們）。  | 
| [受保護的查詢失敗](events-detail-reference-full.md#event-detail-protected-query-failed) | 當受保護查詢失敗時，會通知受保護查詢的查詢執行器、查詢付款人和結果接收者 （們）。  | 
| [受保護的查詢逾時](events-detail-reference-full.md#event-detail-protected-query-timed-out) | 當受保護查詢逾時時，會通知受保護查詢的查詢執行器、查詢付款人和結果接收者 （們）。  | 

## 使用 EventBridge 路由 AWS Clean Rooms 事件
<a name="eventbridge-using-events-rules-full"></a>

若要讓 EventBridge 將 AWS Clean Rooms 事件路由到目標，您必須建立規則。每個規則都包含事件模式，EventBridge 會比對事件匯流排上收到的每個事件。如果事件資料符合指定的事件模式，EventBridge 會將該事件路由到規則的目標 (s)。

如需建立事件匯流排規則的完整說明，請參閱*EventBridge 使用者指南*》中的[建立對事件做出反應的規則](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html)。

### 建立符合事件 AWS Clean Rooms 的事件模式
<a name="eventbridge-using-events-rules-patterns-full"></a>

每個事件模式都是 JSON 物件，它包含：
+ （選用）：識別服務傳送事件的`source`屬性。對於 AWS Clean Rooms 事件，來源為 `aws.cleanrooms`。
+ （選用）：包含要比對之事件名稱陣列的`detail-type`屬性。
+ (選擇性)：包含要比對的任何其他事件資料的 `detail` 屬性。

例如，下列事件模式符合所有 ID 命名空間關聯 已更新協同合作從中刪除的事件 AWS Clean Rooms：

```
{
  "source": ["aws.cleanrooms"],
  "detail-type": ["Id Namespace Association Updated"],
  "detail": {
    "status": ["COLLABORATION_DELETED"]
  }
}
```

如需撰寫事件模式的詳細資訊，請參閱《[EventBridge 使用者指南》中的事件模式](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html)。 *EventBridge *