

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

# Amazon EventBridge 結構描述的資源型政策
<a name="eb-resource-based-schemas"></a>

EventBridge [結構登錄檔](eb-schema-registry.md)支援[資源型政策](eb-use-resource-based.md)。*資源型政策*是連接到資源而非 IAM 身份的政策。例如，在 Amazon Simple Storage Service (Amazon S3) 中，資源政策會連接到 Amazon S3 儲存貯體。

如需 EventBridge 結構描述和資源型政策的詳細資訊，請參閱下列內容。
+ [Amazon EventBridge 結構描述 REST API 參考](https://docs.aws.amazon.com/eventbridge/latest/schema-reference/what-is-eventbridge-schemas.html)
+ 《IAM 使用者指南》中的[身份型政策和資源型政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html)

## 適用於資源型政策的支援的 API
<a name="eb-resource-supported-apis"></a>

您可以將下列 API 與資源型政策搭配用於 EventBridge 結構登錄檔。
+ `DescribeRegistry`
+ `UpdateRegistry`
+ `DeleteRegistry`
+ `ListSchemas`
+ `SearchSchemas`
+ `DescribeSchema`
+ `CreateSchema`
+ `DeleteSchema`
+ `UpdateSchema`
+ `ListSchemaVersions`
+ `DeleteSchemaVersion`
+ `DescribeCodeBinding`
+ `GetCodeBindingSource`
+ `PutCodeBinding`

## 將所有支援的動作授予 AWS 帳戶的範例政策
<a name="eb-resource-policy-account-all"></a>

針對 EventBridge 結構登錄檔，您必須始終將資源型政策附加到註冊表。若要授予對結構的存取權，請在政策中指定結構 ARN 和登錄 ARN。

若要授予使用者存取 EventBridge 結構的所有可用 API，請使用類似下列內容的政策，將 `"Principal"` 取代為您要授予存取權之帳戶的帳戶 ID。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "Test",
            "Effect": "Allow",
            "Action": [
                "schemas:*"
            ],
            "Principal": {
                "AWS": [
                    "109876543210" 
                ]
            },
            "Resource": [
                "arn:aws:schemas:us-east-1:012345678901:registry/default",
                "arn:aws:schemas:us-east-1:012345678901:schema/default*"
            ]
        }
    ]
}
```

------

## 將唯讀動作授予 AWS 帳戶的範例政策
<a name="eb-resource-policy-account-read"></a>

下列範例僅會針對 EventBridge 結構的唯讀 API 授予帳戶的存取權。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "Test",
            "Effect": "Allow",
            "Action": [
                "schemas:DescribeRegistry",
                "schemas:ListSchemas",
                "schemas:SearchSchemas",
                "schemas:DescribeSchema",
                "schemas:ListSchemaVersions",
                "schemas:DescribeCodeBinding",
                "schemas:GetCodeBindingSource"
            ],
            "Principal": {
                "AWS": [
                    "109876543210"
                ]
            },
            "Resource": [
                "arn:aws:schemas:us-east-1:012345678901:registry/default",
                "arn:aws:schemas:us-east-1:012345678901:schema/default*"
            ]
        }
    ]
}
```

------

## 將所有動作授予組織的範例政策
<a name="eb-resource-policy-org"></a>

您可以將資源型政策與 EventBridge 結構登錄檔搭配使用，以授予組織的存取權。如需詳細資訊，請參閱[「AWS Organizations 使用者指南」](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_introduction.html)。下列範例會授予具有結構登錄檔之 `o-a1b2c3d4e5` 存取權 ID 的組織。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "Test",
            "Effect": "Allow",
            "Action": [
                "schemas:*"
            ],
            "Principal": "*",
            "Resource": [
                "arn:aws:schemas:us-east-1:012345678901:registry/default",
                "arn:aws:schemas:us-east-1:012345678901:schema/default*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:PrincipalOrgID": [
                        "o-a1b2c3d4e5"
                    ]
                }
            }
        }
    ]
}
```

------