简体   繁体   English

如何使用 CDK python 将请求参数传递给 Api 网关的 httpintegration

[英]How to pass request parameter to httpintegration for Api Gateway using CDK python

I have an issues while passing我在通过时遇到问题

request_parameters = {"method.request.header.User":"context.authorizer.User"}

Into HttpIntegation:进入 HttpIntegration:

 httpintegration = _apigw.HttpIntegration(url_auth + '/logout', proxy=True, options=request_parameters({"integration.request.header.User":"$context.authorizer.User"}))

I got:我有:

TypeError: 'dict' object is not callable Subprocess exited with error 1 Using: cdk python. TypeError: 'dict' object is not callable Subprocess exited with error 1 using: cdk python.

Please refer to the Python example below.请参考下面的 Python 示例。 I suppose the IntegrationOptions class needs to be used.我想需要使用IntegrationOptions class。

CDK and its documentation are not reliable and there are practically no usable examples with so many defects. CDK 及其文档不可靠,几乎没有可用的示例有这么多缺陷。 I am afraid CDK is not the level for general use.恐怕CDK不是通用的级别。

cdk_api_method: aws_apigateway.Method = cdk_api_resource.add_method(
    http_method=str.upper(verb),
    integration=aws_apigateway.HttpIntegration(
        url=url,
        http_method=str.upper(verb),
        proxy=True,
        options=aws_apigateway.IntegrationOptions(
            request_parameters=method_parameter_set['integration_request_parameters']
            if 'integration_request_parameters' in method_parameter_set else None
        )
    )
)
"integration_request_parameters": {
    "integration.request.header.{}".format(HTTP_HEADER_X_VALIDATION_CLIENT_NAME): "'{}'".format(HTTP_HEADER_X_VALIDATION_CLIENT_VALUE)
},

So what exactly is this method_parameter_set?那么这个method_parameter_set究竟是什么?

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 python cdk 向 api 网关添加属性 - add properties to api gateway using python cdk 如何使用 Python 中的 AWS CDK 创建具有动态 URI 的 API 网关端点? - How can I create an API Gateway end point with a dynamic URI using the AWS CDK in Python? 如何创建在 Python CDK 中引用自身的 API 网关资源策略? - How to create API Gateway Resource Policy that references itself in the Python CDK? 使用 Python CDK 在 API 网关上启用 CORS - Enable CORS on API Gateway with Python CDK API 网关CDK代理请求分段查询参数 - API Gateway CDK proxy request query parameters in segments 如何在 python 中将参数传递给 POST 请求 - How to pass parameter to POST request in python 如何在 URL 请求中将参数传递给有效载荷(python) - How to pass a parameter to the payload in a URL request (python) 如何使用 python lambda function 通过 Z8A5DA52ED1206747D8AAZGatewayA70 传递和读取授权不记名令牌? - How to pass and read authorization bearer-token using python lambda function through api gateway? CDK python:如何指定 nat_gateway_subnets - CDK python: how to specify nat_gateway_subnets 如何使用 aws_cdk 将资源参数从一个堆栈传递到另一个堆栈 - How to pass resource parameter from one stack to another using aws_cdk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM