调用put_integration方法时,方法标识符指定的错误无效



我正在尝试创建一个资源,并使用python在aws-apigateway中进行集成。我正在使用boto3软件包。这是我尝试过的代码

import boto3
import config
session = boto3.session.Session(config.AWS_ACCESS_KEY_ID, config.AWS_SECRET_ACCESS_KEY)
client = session.client('apigateway', region_name=config.AWS_REGION)
api_endpoint = input("ntEnter the API endpoint: n")
response = client.create_resource(
restApiId=config.REST_API_ID,
parentId=config.PARENT_RESOURCE,
pathPart=api_endpoint
)
resource_id = response["id"]
response2 = client.put_integration(
restApiId=config.REST_API_ID,
resourceId=resource_id,
httpMethod='ANY',
type='HTTP_PROXY',
uri=url,
integrationHttpMethod="ANY",
connectionType='VPC_LINK',
)

但我总是得到botocore.errorfactory.NotFoundException:调用PutIntegration操作时发生错误(NotFoundException(:指定的方法标识符无效

我尝试过http方法GET、POST、PUT。资源创建成功。put_integration方法无法正常工作

我遇到了同样的问题。

我通过使用put_method(httpMethod='ANY'(在调用put_integration(httpMethod='ANY'(之前在同一资源中创建'ANY'方法来修复它。

如果在调用put_integration((时资源不存在对应的方法,则会引发该错误。

最新更新