调用UpdateHookConfiguration来为应用或分组设置挂载脚本。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求头

该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。

请求语法

POST /pop/app/config_app_hook_json HTTPS|HTTP

请求参数

名称 类型 位置 是否必选 示例值 描述
AppId String Query d498****-1dd8ec229862

应用ID

Hooks String Query [{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"}]

挂载脚本配置,为一段JSON格式文本,如:

[{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"},{"ignoreFail":true,"name":"postdeleteInstanceDataOnScaleIn","script":""},{"ignoreFail":true,"name":"prestartInstance","script":""},{"ignoreFail":true,"name":"poststartInstance","script":""},{"ignoreFail":true,"name":"prestopInstance","script":""},{"ignoreFail":true,"name":"poststopInstance","script":""}]
GroupId String Query d498****-1dd8ec229862

分组ID

返回数据

名称 类型 示例值 描述
Code Integer 200

响应码

HooksConfiguration Array of Configuration

挂载脚本配置

IgnoreFail Boolean true

是否忽略失败,取值如下:

  • true:忽略失败
  • false:不忽略失败
Name String postprepareInstanceEnvironmentOnScaleOut

挂载脚本名

Script String ls

挂载脚本内容

Message String success

信息

RequestId String d498****-1dd8ec229862

请求ID

示例

请求示例

POST /pop/app/config_app_hook_json HTTP/1.1
公共请求头
{
"AppId": "d498****-1dd8ec229862",
"Hooks": "[{"ignoreFail":false,"name":"postprepareInstanceEnvironmentOnScaleOut","script":"ls"}]"
}

正常返回示例

XML 格式

<HooksConfiguration>
    <Script>ls</Script>
    <IgnoreFail>true</IgnoreFail>
    <Name>postprepareInstanceEnvironmentOnScaleOut</Name>
</HooksConfiguration>
<Message>success</Message>
<RequestId>d498****-1dd8ec229862</RequestId>
<Code>200</Code>

JSON 格式

{
    "HooksConfiguration": {
        "Script": "ls",
        "IgnoreFail": true,
        "Name": "postprepareInstanceEnvironmentOnScaleOut"
    },
    "Message": "success",
    "RequestId": "d498****-1dd8ec229862",
    "Code": 200
}