linux - aws api gateway cli 更新集成请求因 $ 参数而失败

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

我尝试运行以下命令来从 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}"

最佳答案

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

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

关于linux - aws api gateway cli 更新集成请求因 $ 参数而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50417116/

相关文章:

linux - 在带分隔符的文件中将一列复制到另一列

amazon-web-services - 如何在 AWS EC2 中重新下载 pem 文件?

ios - Swift 2 ios 9 提示 http 即使我使用 https 连接到 amazon s3

ios - 存在哪些 WiFi-Direct 库?

linux - 如何让 GNU screen 读取 .bash_profile/.bash_rc 更改?

python - bash 或 python 脚本从 STDIN 读取二进制数据并保存到文件

linux - 用于检查日志文件中特定计数是否超出的 bash 脚本

amazon-web-services - 从 lambda 函数触发 Appsync 突变

linux - int 0x80 是否覆盖寄存器值?

linux - awk中的键值对