【问题标题】:aws api gateway cli update integration request failing with $ parametersaws api gateway cli 更新集成请求失败并带有 $ 参数
【发布时间】:2018-10-29 05:41:39
【问题描述】:

我正在尝试运行以下命令以从 cli 创建自定义集成请求正文映射模板,但正如 JSON 输出所示,它正在删除前面带有 $ 的值。我该如何解决这个问题?

命令:

aws apigateway update-integration --rest-api-id aoi84daah3 --resource-id jh5tps --http-method POST --patch-operations "op='add',path='/requestTemplates/application~1json',value='{"api_name" : "$context.resourcePath","http-method" :"$context.httpMethod"}'"

输出:

"requestTemplates": {
    "application/json": "{api_name : .resourcePath,http-method :.httpMethod}"

【问题讨论】:

标签: linux bash amazon-web-services aws-api-gateway aws-cli


【解决方案1】:

它还会删除您的引号。在 shell 中,$" 在也用" 引用的字符串中必须用\ 转义。

 "op='add',path='/requestTemplates/application~1json',value='{\"api_name\" : \"\$context.resourcePath\",\"http-method\" :\"\$context.httpMethod\"}'"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-18
    • 2022-08-16
    • 2017-02-08
    • 2018-01-20
    • 2016-01-21
    • 2017-10-14
    • 1970-01-01
    相关资源
    最近更新 更多