Question:
I would like to move a few resources one level above such as:
1 2 3 |
\v1\test1 -> \test1 \v2\test2 -> \test2 |
The documentation here say that it is possible. But when I run the following command:
1 2 3 4 5 6 7 8 9 10 11 12 |
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.
1 2 |
A client error (BadRequestException) occurred when calling the UpdateResource operation: Invalid patch operation specified. Must be 'add'|'remove'|'replace' |
Answer:
You can “reparent” a resource by issuing a replace
patch operation to the /parentId
path with the resourceId of the new parent:
1 2 3 4 5 |
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]