在 AWS API 网关中移动资源
Move resource in 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'
您可以 "reparent" 通过向 /parentId
路径发出 replace
补丁操作来使用新父级的 resourceId 来 "reparent" 资源:
aws apigateway update-resource \
--rest-api-id xvxi2smff9 \
--resource-id 2r0epq \
--patch-operations op=replace,path=/parentId,value=eysorw
[编辑以用补丁操作替换 patchOperations - 评论以满足最少 6 个字符的编辑]
我想将一些资源移到上一级,例如:
\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'
您可以 "reparent" 通过向 /parentId
路径发出 replace
补丁操作来使用新父级的 resourceId 来 "reparent" 资源:
aws apigateway update-resource \
--rest-api-id xvxi2smff9 \
--resource-id 2r0epq \
--patch-operations op=replace,path=/parentId,value=eysorw
[编辑以用补丁操作替换 patchOperations - 评论以满足最少 6 个字符的编辑]