python-3.x - 如何在使用 boto3 创建 api-gateway 时添加命令“使用 Lambda 代理集成”
问题描述
我正在使用 boto3 在 aws 中为我的 lambda 函数创建一个 api。那么如何在为该 api 创建资源时添加具有 lambda 代理集成的选项。
我正在使用 put_method 为我的 api 及其方法类型创建资源
api_client.put_method(restApiId=api_id,
resourceId=name_api_id,
httpMethod='ANY',
authorizationType='NONE')
解决方案
对于 aws lambda 集成,请改用 put_integration。
您应该在下面指定您的字符串,请记住,对于 lambda 代理集成,您应该指定
type='AWS_PROXY'
integrationHttpMethod='POST'
uri = lambda url
这是整个
response = client.put_integration(
restApiId='string',
resourceId='string',
httpMethod='string',
type='HTTP'|'AWS'|'MOCK'|'HTTP_PROXY'|'AWS_PROXY',
integrationHttpMethod='string',
uri='string',
connectionType='INTERNET'|'VPC_LINK',
connectionId='string',
credentials='string',
requestParameters={
'string': 'string'
},
requestTemplates={
'string': 'string'
},
passthroughBehavior='string',
cacheNamespace='string',
cacheKeyParameters=[
'string',
],
contentHandling='CONVERT_TO_BINARY'|'CONVERT_TO_TEXT',
timeoutInMillis=123
)
推荐阅读
- javascript - Ajax 请求失败:JSON 意外结束
- c# - 在 WPF 中将可点击的超链接实现到数据网格中
- c++ - 如何调试使用循环和排序的程序?
- java - 单线程执行期间事务失败
- ubuntu - 负载测试:不稳定的错误“连接被拒绝”
- python-3.x - 计算给定时间范围内的最大 CPU Python
- arrays - 如何在 Microsoft Access VBA 中将字符串转换为实际的表单标签标题?
- java - Cassandra 服务失败
- docker - docker-compose 中的环境变量被替换为空字符串
- regex - 当替换器具有特殊字符时,Perl 中的文字字符串替换