

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

# 使用 管理 AWS Supply Chain 事件 Amazon EventBridge
<a name="eventbridge-integration"></a>

使用 EventBridge，您可以將其他 服務自動化，以回應 Step Functions 標準工作流程的執行狀態變更。

Amazon EventBridge 是一種無伺服器服務，使用事件將應用程式元件連接在一起，讓您更輕鬆地建置可擴展的事件驅動型應用程式。事件驅動架構是一種建置鬆耦合軟體系統的方式，透過發出和回應事件來協作。事件代表資源或環境中的變更。

以下是其運作方式：

如同許多 AWS 服務， AWS Supply Chain 會產生事件並將其傳送至 EventBridge 預設事件匯流排。（預設事件匯流排會自動在每個 AWS 帳戶中佈建。) 事件匯流排是接收事件，並將事件傳遞至零個或多個目的地或*目標*的路由器。為事件匯流排指定的規則會在事件到達時評估事件。每項規則都會檢查事件是否與規則的*事件模式*相符。如果事件不相符，事件匯流排會將事件傳送至指定的目標。

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


**Topics**
+ [AWS Supply Chain 事件](#supported-events)
+ [使用 EventBridge 規則交付 AWS Supply Chain 事件](#eventbridge-using-events-rules)
+ [AWS Supply Chain 事件詳細資訊參考](events-detail-reference.md)

## AWS Supply Chain 事件
<a name="supported-events"></a>

AWS Supply Chain 會自動將下列事件傳送至預設 EventBridge 事件匯流排。符合規則事件模式的事件會根據[基準](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html#eb-service-event-delivery-level)交付至指定的目標。事件可能無法按順序交付。

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


| 事件詳細資訊類型 | Description | 
| --- | --- | 
|  [AWS 供應鏈資料整合狀態變更](events-detail-reference.md#event-detail-event-name-1-no-caps-or-spaces)  |  顯示每個擷取檔案的狀態 AWS Supply Chain。 | 

## 使用 EventBridge 規則交付 AWS Supply Chain 事件
<a name="eventbridge-using-events-rules"></a>

若要讓 EventBridge 預設事件匯流排將 AWS Supply Chain 事件傳送至目標，您必須建立規則。每個規則都包含一個事件模式，與事件匯流排上收到的每個事件 EventBridge 相符。如果事件資料符合指定的事件模式， 會將該事件 EventBridge 傳遞至規則的目標 (s)。

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

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

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

例如，下列事件模式會比對來自 的所有`AWS Supply Chain Data Integration Status Change`事件 AWS Supply Chain：

```
{
  "source": ["aws.supplychain"],
  "detail-type": ["AWS Supply Chain Data Integration Status Change"]
}
```

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

# AWS Supply Chain 事件詳細資訊參考
<a name="events-detail-reference"></a>

 AWS 服務中的所有事件都有一組通用的欄位，其中包含事件的中繼資料，例如事件來源 AWS 的服務、事件產生的時間、事件發生的帳戶和區域，以及其他。如需這些一般欄位的定義，請參閱*Amazon EventBridge 《 使用者指南*》中的[事件結構參考](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events-structure.html)。

此外，每個事件都有一個 `detail` 欄位，其中包含該特定事件的特定資料。以下參考定義了各種 AWS Supply Chain 事件的詳細資訊欄位。

使用 EventBridge 來選取和管理 AWS Supply Chain 事件時，請謹記下列事項：
+ 來自 的所有事件的 `source` 欄位 AWS Supply Chain 都設定為 `aws.supplychain`。
+ `detail-type` 欄位指定事件類型。

  例如 `AWS Supply Chain Data Integration Status Change`。
+ `detail` 欄位包含該特定事件的特定資料。

如需建構事件模式以讓規則符合 AWS Supply Chain 事件的資訊，請參閱*Amazon EventBridge 《 使用者指南*》中的[事件模式](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html)。

如需事件及其 EventBridge 處理方式的詳細資訊，請參閱*Amazon EventBridge 《 使用者指南*》中的[Amazon EventBridge 事件](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html)。

## AWS 供應鏈資料整合狀態變更
<a name="event-detail-event-name-1-no-caps-or-spaces"></a>

以下是`AWS Supply Chain Data Integration Status Change event`事件的範例。

```
                  
{
    "version": "0",
    "id": "instanceID",
    "detail-type": "AWS Supply Chain Data Integration Status Change",
    "source": "aws.supplychain",
    "account": "acccountID",
    "time": "2024-03-30T12:26:13Z",
    "region": "us-east-1",
    "resources": [],
    "detail": {
        "version": "1.0",
        "instanceId": "instanceID",
        "flowArn": "arn:aws:scn:region:acccountID:instance/instanceID/data-integration-flows/flowname",
        "flowExecutionId": "flowExecutionId",
        "status": "IN_PROGRESS",
        "startTime": "2024-03-30T12:26:13Z",
        "endTime": "",
        "message": "",
        "sourceType": "S3",
        "sourceInfo": {
            "s3Source": {
                "bucketName": "aws-supply-chain-data-instanceID",
                "key": "flowname"
            }
        }
    }
}
```

`endTime` 只有在*狀態*為失敗或成功時才可用。