简体   繁体   中英

how to add the command 'Use Lambda Proxy integration' while creating api-gateway using boto3

I am creating an api for my lambda function in aws using boto3. SO how do i add the option of having lambda proxy integration while creating the resource for that api.

I am using put_method for creating the resource for my api and its method type

api_client.put_method(restApiId=api_id,
                              resourceId=name_api_id,
                              httpMethod='ANY',
                              authorizationType='NONE')

For aws lambda integration use put_integration instead.

below you should specify your strings, just keep in mind that for lambda proxy integration you should specify

type='AWS_PROXY'
integrationHttpMethod='POST'
uri = lambda url 

here is the whole

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
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM