amazon-web-services - 在 AWS API 网关中移动资源

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

我想将一些资源移动上一级,例如:

\v1\test1 -> \test1
\v2\test2 -> \test2

文档 here说这是可能的。但是当我运行以下命令时:
aws apigateway  update-resource \
--rest-api-id xvxi2smff9 \
--resource-id 2r0epq \
--cli-input-json "{\"patchOperations\" : [ 
      {
        \"op\" : \"move\",
        \"path\" : \"eysorw\",
        \"value\" : \"2r0epq\",
        \"from\" : \"xvxi2smff9\"
      } 
]}"

我收到错误提示,这是一个无效的补丁操作。
A client error (BadRequestException) occurred when calling the UpdateResource operation: Invalid patch operation specified. Must be 'add'|'remove'|'replace'

最佳答案

您可以通过发出 replace 来“重新设置”资​​源的父级。对 /parentId 的补丁操作具有新父级资源 ID 的路径:

aws apigateway update-resource \
   --rest-api-id xvxi2smff9 \
   --resource-id 2r0epq \
   --patch-operations op=replace,path=/parentId,value=eysorw

[编辑以用补丁操作替换补丁操作 - 评论以满足 6 个字符的最低编辑要求]

关于amazon-web-services - 在 AWS API 网关中移动资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36973234/

相关文章:

java - 父工作流程完成后,子工作流程会继续运行吗? ( child 政策.放弃)

java - 无法在本地 Java 上调用 Lambda AWS

amazon-web-services - 如何查看给定 CloudFormation 资源上的 DeletionPolicy?

typescript - 我将哪种类型的TypeTypeScript的AWS Lambda响应返回给AWS API API网关方法响应套件?

lambda - 如何通过cloudformation模板(serverless.yml)启用api网关日志?

amazon-web-services - 运行错误 `pip install aws cli` : "could not find a version that satisfies the requirement cli"

amazon-web-services - 在 env 中找到部分凭据,缺少 : AWS_SECRET_ACCESS_KEY

amazon-web-services - 如何使用 AWS CLI 从 EBS 快照创建 AMI

amazon-web-services - 如何通过 CLI 加密 Lambda 的环境变量?

amazon-web-services - 如何保护 AWS API 网关端点免受 DDos 攻击?