

已重組 AWS Marketplace API 參考。如需支援的 API 操作的詳細資訊，請參閱 [AWS Marketplace API 參考](https://docs.aws.amazon.com/marketplace/latest/APIReference/Welcome.html)。

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

# AWS Marketplace 協議 API 的存取控制
<a name="agreement-api-access-control"></a>

若要 AWS Marketplace 使用 協議服務管理 中的協議，您必須確保已設定 AWS Identity and Access Management (IAM) 政策和角色。使用者必須擁有下列政策/許可，才能允許他們執行動作：
+ `CreateAgreementRequest` – 准許使用者開始新的請求，以建立新的協議或更新現有的協議。
+ `AcceptAgreementRequest` – 准許使用者接受先前建立的請求，以具體化為協議。注意：接受協議請求時，如果使用者提供採購訂單，他們也需要具有執行 動作的`UpdatePurchaseOrders`許可。
+ `GetAgreementEntitlements` – 授予使用者列出協議權利的許可。
+ `CancelAgreement` – 准許使用者取消他們參與的作用中協議。
+ `ListAgreementCharges` – 准許使用者列出協議的費用。
+ `UpdatePurchaseOrders` – 准許使用者更新協議費用的採購訂單。
+ `SendAgreementCancellationRequest` – 准許使用者傳送取消請求。
+ `AcceptAgreementCancellationRequest` – 准許使用者接受賣方針對以接受者身分參與的協議提出的取消請求。注意：使用者也需要`CancelAgreement`許可，因為核准取消請求會導致協議取消。
+ `RejectAgreementCancellationRequest` – 准許使用者拒絕賣方針對以接受者身分參與的協議提出的取消請求。
+ `SendAgreementPaymentRequest` – 准許使用者傳送付款請求。
+ `AcceptAgreementPaymentRequest` – 准許使用者接受賣方針對他們以接受者身分參與的協議提出的付款請求。
+ `RejectAgreementPaymentRequest` – 准許使用者拒絕賣方針對他們以接受者身分參與的協議提出的付款請求。
+ `GetAgreementCancellationRequest` – 准許使用者擷取他們以接受者身分參與之協議的特定取消請求的詳細資訊。
+ `ListAgreementCancellationRequests` – 准許使用者列出他們以接受者身分參與之協議的取消請求。
+ `GetAgreementPaymentRequest` – 准許使用者針對他們以接受者身分參與的協議，擷取特定付款請求的詳細資訊。
+ `ListAgreementPaymentRequests` – 准許使用者列出他們以接受者身分參與協議的付款請求。
+ `DescribeAgreement` – 准許使用者取得有關其任何協議的詳細中繼資料。
+ `GetAgreementTerms` – 准許使用者取得協議條款的詳細資訊。
+ `SearchAgreements` – 准許使用者搜尋其所有協議。

**注意**  
如需這些許可的詳細資訊，請參閱《 [賣方指南》中的 AWS Marketplace 賣方政策和許可](https://docs.aws.amazon.com/marketplace/latest/userguide/detailed-management-portal-permissions.html)，以及《 *AWS Marketplace 買方指南*》中的[控制對 AWS Marketplace 訂閱的存取](https://docs.aws.amazon.com/marketplace/latest/buyerguide/buyer-iam-users-groups-policies.html)。 *AWS Marketplace *

## 允許具有 AWS 受管政策的動作
<a name="agreement-aws-managed-policies"></a>

AWS Marketplace 定義角色特定的 受管政策。您可以針對 IAM 身分使用 受管政策，其預設會縮小指定角色的政策範圍。使用 受管政策可讓您遵循最佳實務，並在 Marketplace 中提供新功能時接收政策更新。

如需這些許可的詳細資訊，請參閱《 [賣方指南》中的 AWS Marketplace 賣方政策和許可](https://docs.aws.amazon.com/marketplace/latest/userguide/detailed-management-portal-permissions.html)，以及《 *AWS Marketplace 買方指南*》中的[控制對 AWS Marketplace 訂閱的存取](https://docs.aws.amazon.com/marketplace/latest/buyerguide/buyer-iam-users-groups-policies.html)。 *AWS Marketplace *

您不會受限於此處所述的 AWS 受管政策中的許可。您可以使用 IAM 建立具有自訂許可的政策，然後將這些政策新增至 IAM 角色。如需詳細資訊，請參閱《[IAM 使用者指南》中的管理 IAM 政策和](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage.html)**[新增 IAM 身分許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html)。

## 允許具有客戶受管政策的動作
<a name="agreement-customer-managed-policies"></a>

您也可以定義客戶受管政策，以控制對協議服務 APIs存取。您可以使用混合效果、動作和支援的條件來自訂政策。

若要存取用於管理產品訂閱的 AWS Marketplace 協議 API，您可以建立下列政策以允許存取。

```
{
  "Version": "2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "aws-marketplace:CreateAgreementRequest",
        "aws-marketplace:AcceptAgreementRequest"
      ],
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws-marketplace:AgreementType": ["PurchaseAgreement"]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "aws-marketplace:CancelAgreement",
        "aws-marketplace:GetAgreementEntitlements",
        "aws-marketplace:UpdatePurchaseOrders",
        "aws-marketplace:ListAgreementCharges"
      ],
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws-marketplace:AgreementType": ["PurchaseAgreement"]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "aws-marketplace:AcceptAgreementCancellationRequest",
        "aws-marketplace:RejectAgreementCancellationRequest",
        "aws-marketplace:GetAgreementCancellationRequest",
        "aws-marketplace:ListAgreementCancellationRequests",
        "aws-marketplace:CancelAgreement"
      ],
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws-marketplace:AgreementType": ["PurchaseAgreement"]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "aws-marketplace:AcceptAgreementPaymentRequest",
        "aws-marketplace:RejectAgreementPaymentRequest",
        "aws-marketplace:GetAgreementPaymentRequest",
        "aws-marketplace:ListAgreementPaymentRequests"
      ],
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws-marketplace:AgreementType": ["PurchaseAgreement"]
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "aws-marketplace:DescribeAgreement",
        "aws-marketplace:SearchAgreements",
        "aws-marketplace:GetAgreementTerms"
      ],
      "Resource": "*",
      "Condition": {
        "ForAllValues:StringEquals": {
          "aws-marketplace:AgreementType": ["PurchaseAgreement"]
        },
        "StringEquals": {
          "aws-marketplace:PartyType": "Acceptor"
        }
      }
    }
  ]
}
```

## 使用服務定義的條件索引鍵自訂政策
<a name="agreement-condition-keys"></a>

### 使用 AgreementType 條件索引鍵
<a name="agreement-condition-agreementtype"></a>

下列陳述式僅針對`PurchaseAgreement`協議類型限制對 `UpdatePurchaseOrders`操作的存取。

```
{
  "Effect": "Allow",
  "Action": [
    "aws-marketplace:UpdatePurchaseOrders"
  ],
  "Resource": "*",
  "Condition": {
    "ForAllValues:StringEquals": {
      "aws-marketplace:AgreementType": ["PurchaseAgreement"]
    }
  }
}
```

### 使用 ProductId 條件索引鍵
<a name="agreement-condition-productid"></a>

以下陳述式限制`AcceptAgreementRequest`只能存取指定的 AWS Marketplace 產品 ID `CreateAgreementRequest`和 。您可以包含此陳述式，只允許建立預先核准的產品 ID，例如限制為 Bedrock 基礎模型。

```
{
  "Effect": "Allow",
  "Action": [
    "aws-marketplace:CreateAgreementRequest",
    "aws-marketplace:AcceptAgreementRequest"
  ],
  "Resource": "*",
  "Condition": {
    "ForAnyValue:StringEquals": {
      "aws-marketplace:ProductId": [
        "model-product-id-1",
        "model-product-id-2"
      ]
    }
  }
}
```

### 使用 PartyType 條件索引鍵
<a name="agreement-condition-partytype"></a>

如果使用者是協議的提案者，以下陳述式會授予讀取任何協議詳細資訊的存取權。

```
{
  "Effect": "Allow",
  "Action": [
    "aws-marketplace:DescribeAgreement"
  ],
  "Resource": "*",
  "Condition": {
    "StringEquals": {
      "aws-marketplace:PartyType": "Proposer"
    }
  }
}
```