

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# AWS Marketplace EventBridge 协议
<a name="agreement-eventbridge"></a>

AWS Marketplace EventBridge 当您的协议生命周期中发生某些事件（即您已购买的商品）时，会向 Amazon 发送通知。您可以使用这些事件来自动化工作流程并跟踪您的商城购买情况。

下表列出了 AWS Marketplace 发送至 EventBridge：的买家事件：


| 事件 | 说明 | 
| --- | --- | 
| 已创建购买协议-接受者 | 在您的账户中创建、续订或替换新的购买协议时发送 | 
| 购买协议已修订-接受者 | 在修改现有购买协议时发送 | 
| 购买协议已终止-接受者 | 在购买协议被取消、到期、终止、续订或替换时发送 | 
| 购买协议终止-接受者 | 在购买协议到期前 30、60 和 90 天发送 | 

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

买家会收到有关以下购买协议生命周期事件的 EventBridge 通知：
+ 协议创建
+ 协议修正案
+ 协议结束（取消、到期或终止）
+ 协议终止

所有事件都将与 EventBridge 事件源一起发送到您`us-east-1`所在区域的默认事件总线`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>

所有买家活动都包含以下常用字段：


| 字段 | 说明 | 
| --- | --- | 
| 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 规则。有关创建规则的更多信息，请参阅[亚马逊* EventBridge 用户指南中的创建亚马逊 EventBridge *规则](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html)。