

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

# AWS Marketplace 協議 EventBridge 事件
<a name="agreement-eventbridge"></a>

AWS Marketplace 當您的協議生命週期內發生特定事件 （即您已購買的優惠） 時， 會傳送通知給 Amazon EventBridge。您可以使用這些事件來自動化工作流程並追蹤您的市集購買。

下表列出 AWS Marketplace 傳送至 EventBridge 的買方事件：


| 事件 | Description | 
| --- | --- | 
| 已建立購買協議 - 接受者 | 在您的帳戶中建立新的購買協議、續約或取代時傳送 | 
| 購買協議已修訂 - 接受者 | 對現有購買協議進行修改時傳送 | 
| 購買協議已結束 - 接受者 | 當購買協議取消、過期、終止、續約或取代時傳送 | 
| 購買協議結束 - 接受者 | 在購買協議到期前 30、60 和 90 天傳送 | 

## 概觀
<a name="agreement-events-overview"></a>

買方會收到下列購買協議生命週期事件的 EventBridge 通知：
+ 建立協議
+ 協議修訂
+ 協議結束 （取消、過期或終止）
+ 協議結束

所有事件都會傳送到 `us-east-1`區域中具有事件來源 的預設 EventBridge 事件匯流排`aws.agreement-marketplace`。

## 事件類型
<a name="agreement-event-types"></a>

### 已建立購買協議 - 接受者
<a name="agreement-created-event"></a>

AWS Marketplace 在您的帳戶中建立新的購買協議時， 會傳送此事件。

**觸發案例：**
+ `NEW` - 第一次建立協議
+ `REPLACE` - 新的私有優惠需要接受作為以協議為基礎的優惠 (ABO) 的一部分
+ `RENEW` - 協議會在到期時自動續約 （如果啟用）

**事件結構描述：**

```
{
  "version": "0",
  "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
  "detail-type": "Purchase Agreement Created - Acceptor",
  "source": "aws.agreement-marketplace",
  "account": "<Buyer Account ID>",
  "time": "2024-08-30T21:36:03Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:aws-marketplace::agreement:agmt-9xyz8wmklp67rt32nb1qv45ds"
  ],
  "detail": {
    "requestId": "7f3e2d1c-a9b8-4f5e-6d7c-1234567890ab",
    "catalog": "AWSMarketplace",
    "agreement": {
      "id": "agmt-9xyz8wmklp67rt32nb1qv45ds",
      "intent": "NEW|RENEW|REPLACE",
      "status": "ACTIVE",
      "acceptanceTime": "2024-06-26T21:36:03Z",
      "startTime": "2024-08-30T21:36:03Z",
      "endTime": "2025-05-30T21:36:03Z"
    },
    "acceptor": {
      "accountId": "<Buyer Account ID>"
    },
    "proposer": {
      "accountId": "<Proposer Account ID>"
    },
    "offer": {
      "id": "offer-abcdef123456"
    }
  }
}
```

### 購買協議已修訂 - 接受者
<a name="agreement-amended-event"></a>

AWS Marketplace 會在對現有購買協議進行修改時傳送此事件，例如條款、定價或其他協議參數的變更。

**事件結構描述：**

```
{
  "version": "0",
  "id": "12345678-1234-1234-1234-123456789012",
  "detail-type": "Purchase Agreement Amended Acceptor",
  "source": "aws.agreement-marketplace",
  "account": "<Buyer Account ID>",
  "time": "2024-08-30T21:36:03Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:aws-marketplace::aws:agreement:agmt-4mwg1nevbokzw95eca5797ixs"
  ],
  "detail": {
    "requestId": "3d4c9f9b-b809-4f5e-9fac-a9ae98b05cbb",
    "catalog": "AWSMarketplace",
    "agreement": {
      "id": "agmt-4mwg1nevbokzw95eca5797ixs",
      "intent": "AMEND",
      "status": "ACTIVE",
      "acceptanceTime": "2024-06-26T21:36:03Z",
      "startTime": "2024-08-30T21:36:03Z",
      "endTime": "2025-05-30T21:36:03Z"
    },
    "acceptor": {
      "accountId": "<Buyer Account ID>"
    },
    "proposer": {
      "accountId": "<Proposer Account ID>"
    },
    "offer": {
      "id": "offer-1234567890123"
    }
  }
}
```

### 購買協議已結束 - 接受者
<a name="agreement-ended-event"></a>

AWS Marketplace 會在購買協議結束時傳送此事件。

**觸發案例：**
+ `CANCELLED` - 您在定義的結束日期之前結束協議
+ `EXPIRED` - 協議已達到其定義的結束日期
+ `TERMINATED` AWS 終止協議 （例如，由於付款失敗）
+ `RENEWED` - 協議已續約為新的協議
+ `REPLACED` - 已使用協議替代優惠取代協議

**事件結構描述：**

```
{
  "version": "0",
  "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
  "detail-type": "Purchase Agreement Ended - Acceptor",
  "source": "aws.agreement-marketplace",
  "account": "987654321098",
  "time": "2024-08-30T21:36:03Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:aws-marketplace:aws:agreement:agmt-9xyz8wmklp67rt32nb1qv45ds"
  ],
  "detail": {
    "requestId": "7f3e2d1c-a9b8-4f5e-6d7c-1234567890ab",
    "catalog": "AWSMarketplace",
    "agreement": {
      "id": "agmt-9xyz8wmklp67rt32nb1qv45ds",
      "status": "CANCELLED|EXPIRED|RENEWED|REPLACED|TERMINATED"
    },
    "acceptor": {
      "accountId": "<Buyer Account ID>"
    },
    "proposer": {
      "accountId": "<Proposer Account ID>"
    },
    "offer": {
      "id": "offer-abcdef123456"
    }
  }
}
```

### 購買協議結束 - 接受者
<a name="agreement-ending-event"></a>

AWS Marketplace 會在購買協議到期前 30、60 和 90 天傳送此事件。

此事件包含其他買方事件中不存在的其他欄位：
+ `agreement.autoRenewalEnabled` - 指出協議是否已啟用自動續約
+ `product.id` 和 `product.title` - 協議的產品資訊
+ `proposer.name` 和 `offer.name` - 賣方和優惠的人類可讀名稱

**事件結構描述：**

```
{
  "version": "0",
  "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
  "detail-type": "Purchase Agreement Ending - Acceptor",
  "source": "aws.agreement-marketplace",
  "account": "<Buyer Account ID>",
  "time": "2025-03-31T21:36:03Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:aws-marketplace::aws:agreement:agmt-9xyz8wmklp67rt32nb1qv45ds"
  ],
  "detail": {
    "requestId": "7f3e2d1c-a9b8-4f5e-6d7c-1234567890ab",
    "catalog": "AWSMarketplace",
    "agreement": {
      "id": "agmt-9xyz8wmklp67rt32nb1qv45ds",
      "startTime": "2024-08-30T21:36:03Z",
      "endTime": "2025-05-30T21:36:03Z",
      "autoRenewalEnabled": true,
      "status": "ACTIVE"
    },
    "product": {
      "id": "prod-abc123xyz456",
      "title": "Example Product Title"
    },
    "acceptor": {
      "accountId": "<Buyer Account ID>"
    },
    "proposer": {
      "name": "Example Seller Name",
      "accountId": "<Proposer Account ID>"
    },
    "offer": {
      "id": "offer-abcdef123456",
      "name": "Example Offer Name"
    }
  }
}
```

## 常見事件欄位
<a name="agreement-common-fields"></a>

所有買方事件都包含以下常見欄位：


| 欄位 | Description | 
| --- | --- | 
| requestId | 用來刪除重複重複事件的 UUID | 
| catalog |  AWS Marketplace 目錄 （通常為「AWSMarketplace」) | 
| agreementId | 協議的唯一識別符 | 
| acceptor.accountId |  AWS 您的帳戶 ID | 
| proposer.accountId | 賣方 AWS 的帳戶 ID | 
| offer.id | 優惠識別符 | 

## 設定 EventBridge 規則
<a name="agreement-eventbridge-setup"></a>

若要接收這些通知，請建立符合買方事件事件模式的 EventBridge 規則。如需建立規則的詳細資訊，請參閱《[Amazon EventBridge 使用者指南》中的建立](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html) *Amazon EventBridge *規則。