2016-05-01 74 views
3

我想移动一个水平之上,如一些资源:移动资源在AWS API网关

\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' 

回答

5

你可以在“重新设置父级”通过发布replace修补程序操作的/parentId路径与新的母公司的RESOURCEID资源:

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

[编辑以取代补丁的操作patchOperations - 评论满足6个字符的最低编辑]

+0

谢谢,那工作。 – jamborta

+0

谁跟我一样陷入这个猎物,它是'patch-operations',http://docs.aws.amazon.com/cli/latest/reference/apigateway/update-resource.html –