更新 RecordingRule 规则文件。
说明
Id
和 WorkspaceId + Name
不能同时配置,但至少需要选择一种:
Id
直接指定需要更新的规则文件。WorkspaceId + Name
在工作区内,通过名称指定需要更新的规则文件。参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | UpdateRuleFile | 接口名称。当前 API 的名称为 UpdateRuleFile 。 |
Version | String | 是 | 2021-03-03 | 接口版本。当前 API 的版本为 2021-03-03 。 |
Id | String | 否 | e28ae750-bbb8-4ff4-abf4-1e0e0f88808c | 规则文件 ID。 |
WorkspaceId | String | 否 | e28ae750-bbb8-4ff4-abf4-1e0e0f88808c | 工作区 ID,必须Name 同时配置。 |
Name | String | 否 | test | 规则文件名称,必须和WorkspaceId 同时配置。 |
Description | String | 否 | 这是一段描述 | 规则文件描述信息。 |
Content | String | 否 | {"groups": [{"name": "my_first_recording_rule", "rules": [{"expr": "up", "record": "up"}], "interval": "30s"}]} | 规则文件内容。 |
POST https://open.volcengineapi.com/?Action=UpdateRuleFile&Version=2021-03-03
Content-Type: application/json
{
"Id": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c",
"WorkspaceId": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c",
"Name": "test",
"Description": "这是一段描述",
"Content": "{\"groups\": [{\"name\": \"my_first_recording_rule\", \"rules\": [{\"expr\": \"up\", \"record\": \"up\"}], \"interval\": \"30s\"}]}"
}
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
Id | String | e28ae750-bbb8-4ff4-abf4-1e0e0f88808c | 规则文件 ID。 |
HTTP/1.1: 200 OK
Content-Type: application/json
{
"ResponseMetadata": {
"RequestId": "20230604110420****100232280022D31",
"Action": "UpdateRuleFile",
"Version": "2021-03-03",
"Service": "vmp",
"Region": "cn-north-1"
},
"Result": {
"Id": "e28ae750-bbb8-4ff4-abf4-1e0e0f88808c"
}
}
本接口错误码如下表所示,公共错误码请参见 公共错误码。
HTTP 状态码 | 错误码 | 错误信息 | 说明 |
---|---|---|---|
400 | QuotaExceeded.RuleGroupCount | Rule Group count has exceeded the quota. | 创建 rulefile 个数达到上限。 |
400 | InvalidParameter.{{parameter}} | The specified parameter {{parameter}} is invalid. | 指定的参数无效。 |
400 | MissingParameter.{{parameter}} | The required parameter {{parameter}} is missing. | 缺少必要的参数。 |
403 | ProductUnsubscribed | You are not subscribed to the Volcengine Managed Service for Prometheus (VMP). Please go to the VMP console web page to subscribe to the service | 当前账号未订阅 VMP 服务。 |
403 | OperationDenied.Create | Operation is denied because RuleFile cannot be created in Workspace`s current status. | 当前工作区状态下无法创建 rulefile。 | | |
404 | NotFound.Workspace | The specified Workspace {{id}} is not found. | 未找到相应 ID 的工作区。 |
404 | NotFound.Name | The specified RuleFile {{name}} is not found in Workspace {{workspaceID}}. | 指定工作区下未找到规则文件。 |