如何使用 boto3 附加或更新 API 网关资源策略

How to attach or update an API gateway resource policy using boto3

boto3 中是否有任何方法可以附加或更新 api -gateway 中的资源策略?

我在boto3文档中搜索过,没有找到任何方法。

您想使用 CLI/API 的 create_rest_api method for attaching, and the update_rest_api method for updating. The Create and Attach an API Gateway Resource Policy to an API 文档应该有助于描述您应该用来更新现有策略的 patchOperations 值。

务必按照文档所述重新部署:

Important

If you attach a resource policy to a deployed API, or if you update an existing resource policy, you'll need to redeploy the API for the changes to take effect.