Python 使用无服务器框架向使用计划添加API
我的Python 使用无服务器框架向使用计划添加API,python,amazon-web-services,aws-api-gateway,serverless-framework,Python,Amazon Web Services,Aws Api Gateway,Serverless Framework,我的serverless.yaml文件如下: service: aws-python provider: name: aws runtime: python2.7 stage: beta region: us-east-1 package: include: - deps - functions - lib functions: hello: handler: functions/handler.function_handler
serverless.yaml
文件如下:
service: aws-python
provider:
name: aws
runtime: python2.7
stage: beta
region: us-east-1
package:
include:
- deps
- functions
- lib
functions:
hello:
handler: functions/handler.function_handler
events:
- http:
path: ta
method: GET
- http:
path: ta
method: POST
我想将此API添加到使用计划中。如何做到这一点?如评论中所述,默认情况下,Serverless不支持此功能。您应该将适当的资源作为自定义资源添加到CloudFormation模板中,或者使用AWS CLI或其他SDK创建它。使用AWS CLI和以下命令
aws apigateway update-usage-plan --usage-plan-id <PLAN_ID> --patch-operations op=add,path=/apiStages,value=<API_ID>:<API_STAGE>
aws apigateway更新使用计划--使用计划id--修补程序操作op=add,路径=/APITAGES,值=:
如果你要否决一篇文章,你需要解释自己。默认情况下,Serverless不支持这一点,但你应该能够在你的Serverless CloudFormation模板中创建UsagePlan资源,或者使用AWS CLI脚本创建UsagePlan