使用AWS Api-Gateway服务时,我想添加一个“父”资源而不删除并重建资源结构。具体来说,我想更改此设置:
resource/name
resource/name
并向其中添加一个“父级”资源(v1),而无需删除和重新创建两个“资源/名称”资源,如下所示:
/v1
/resource/name
/resource/name
如果需要使用CLI,示例命令将是什么样?
更新:
感谢您的精彩回答Ka Hou Ieong。以下是有关实施的一些说明:
rest-api-id : Put the api id here. You can look it up with this command: aws apigateway get-rest-apis
resource-id : Put the id of the resource you'd like to move here. You can look it up with this command: aws apigateway get-resources --rest-api-id API-ID-HERE
replace : Leave this; it's the operation.
/parentId : Leave this. It refers to the "key" of the value that you'll replace.
<new parent resourceId> : Replace this with the ID of the parent you'd like.
您可以创建路径部分为“ / v1”的资源,然后使用CLI工具或SDK重新创建父资源。
示例cli命令来重载资源
aws apigateway update-resource \
--rest-api-id rest-api-id \
--resource-id resource-id \
--cli-input-json "{\"patchOperations\" : [
{
\"op\" : \"replace\",
\"path\" : \"/parentId\",
\"value\" : \"<new parent resourceId>\"
}
]}"
这是cli工具的文档:http : //docs.aws.amazon.com/cli/latest/reference/apigateway/update-resource.html
这是API参考:http : //docs.aws.amazon.com/apigateway/api-reference/link-relation/resource-update/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句