Reputation: 5220
I would like to move a few resources one level above such as:
\v1\test1 -> \test1
\v2\test2 -> \test2
The documentation here say that it is possible. But when I run the following command:
aws apigateway update-resource \
--rest-api-id xvxi2smff9 \
--resource-id 2r0epq \
--cli-input-json "{\"patchOperations\" : [
{
\"op\" : \"move\",
\"path\" : \"eysorw\",
\"value\" : \"2r0epq\",
\"from\" : \"xvxi2smff9\"
}
]}"
I get the error that it is an invalid patch operation.
A client error (BadRequestException) occurred when calling the UpdateResource operation: Invalid patch operation specified. Must be 'add'|'remove'|'replace'
Upvotes: 6
Views: 2969
Reputation: 2066
You can "reparent" a resource by issuing a replace
patch operation to the /parentId
path with the resourceId of the new parent:
aws apigateway update-resource \
--rest-api-id xvxi2smff9 \
--resource-id 2r0epq \
--patch-operations op=replace,path=/parentId,value=eysorw
[edited to replace patchOperations with patch-operations - comment to meet 6 character minimum edit]
Upvotes: 12