跳转至

修改



POST /api/v1/incidents/schedule/{schedule_uuid}/modify

概述

修改值班

路由参数

参数名 类型 必选 说明
schedule_uuid string Y 排班uuid
允许为空: False

Body 请求参数

参数名 类型 必选 说明
name string Y 名称
允许为空: False
最大长度: 256
允许为空字符串: False
timezone string 时区, 默认 Asia/Shanghai
例子: Asia/Shanghai
允许为空: False
最大长度: 48
start string Y 时间段 开始时间
例子: 00:00
允许为空: False
最大长度: 48
end string Y 时间段 结束时间
例子: 23:59
允许为空: False
最大长度: 48
tagFilter array 过滤标签对应的uuid列表
允许为空: False
例子: ['tag1', 'tag2']
dimensionFilter string 过滤维度
允许为空: False
例子: host:127.0.0.1
notifyTargets array Y 通知对象, 包含 账号 uuid, 通知对象 uuid, 邮箱
例子: ['acnt_xxx', 'notify_', 'xxx@guance.com']
允许为空: False
extend json 扩展信息, 包含 轮换通知对象配置
允许为空: False
extend.enableRotateNotification boolean 是否开启 轮换, 默认 关闭
例子: False
允许为空: False
extend.rotationCycle string 轮换周期, 天: day, 周: week, 月: month, 工作日: workDay, 周末: weekend
例子: day
允许为空: False
可选值: ['day', 'week', 'month', 'workDay', 'weekend']
extend.effectiveTime json 日程 有效期, 默认 该日程永久有效, 开启/结束时间为 11 位时间戳
例子: {'start': 1719990196, 'end': 1729990196}
允许为空: False
scheduleStrategy array 升级策略规则

参数补充说明

1. 请求参数说明

参数名 type 必选 说明
name String 必须 日程名称
start String 必须 时间段 开始时间
end String 必须 时间段 结束时间
timezone String 时区
tagFilter array 过滤标签对应的uuid列表
dimensionFilter array 维度过滤,目前支持等于和通配逻辑
notifyTargets array 必须 通知对象, 包含 账号 uuid, 通知对象 uuid, 邮箱
extend Json 扩展信息
scheduleStrategy Json 升级策略规则

2. dimensionFilter 参数说明 维度过滤,目前支持等于和通配逻辑,格式为 key:value,例如 host:127.0.0.1 表示只包含 host 为 127.0.0.1 的维度。 通配逻辑支持 * 通配符,例如 host:127.0.0.* 表示只包含 host 为 127.0.0. 开头的维度。 也支持多条件or\and,例如 host:127.0.0.1 AND service:mysql 目前支持的维度字段有如下这些: host、service、resource、pod_name、app_name、env、url


3. extend 中的参数说明

参数名 type 必选 说明
enableRotateNotification Boolean 是否开启 通知对象轮换, 默认 关闭
rotationCycle string 开启通知对象轮换后的, 轮换周期
effectiveTime json 日程 的有效时间配置, 默认 该日程永久有效, 开启/结束时间为 11 位时间戳

4. scheduleStrategy 中的参数说明

参数名 type 必选 说明
scheduleStrategy[].uuid string Y 唯一uuid
scheduleStrategy[].name string Y 策略名称
scheduleStrategy[].strategy array N 升级策略列表
scheduleStrategy[].strategy[].level integer Y 等级
scheduleStrategy[].strategy[].notifyConfig array Y 通知配置列表
scheduleStrategy[].strategy[].notifyConfig[].notifyType array Y 通知对象类型 member - 成员 object - 通知对象
scheduleStrategy[].strategy[].notifyConfig[].notifyObject array Y 通知对象列表,watchkeeper 代表当前值班人
scheduleStrategy[].strategy[].notifyConfig[].notifyMethod array N 通知方式,如果是通知对象则无需传递 mobile - 电话 message - 短信 email - 邮件
scheduleStrategy[].strategy[].ifRepeatNotify boolean Y 是否重复发送通知
scheduleStrategy[].strategy[].repeatNotifyInterval integer N 重复发送通知间隔,单位秒
scheduleStrategy[].strategy[].levelUpTime integer N 升级持续时间
scheduleStrategy[].strategy[].incidentsLevel array N 对应故障级别列表
scheduleStrategy[].strategy[].incidentsStatus array N 对应故障状态 open - 未分配 working - 处理中

scheduleStrategy 字段示例:

  [
    {
        "uuid": "",
        "name": "AAA",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["watchkeeper"]
                    }
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            },
            {
                "level": 1,
                "notifyConfig": [
                    {
                        "notifyObjectType": "member",
                        "notifyObject": ["uuid_xxx1"],
                        "notifyMethod": ["mobile", "message", "email"]
                    },
                    {
                        "notifyObjectType": "group",
                        "notifyObject": ["uuid_xxx2"],
                        "notifyMethod": ["mobile", "message", "email"]
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300,
                "levelUpTime": 1800,
                "incidentsLevel": ["uuid_xxxx"],
                "incidentsStatus": ["open"]
            }
        ]
    },
    {
        "uuid": "",
        "name": "BBB",
        "strategy": [
            {
                "level": 0,
                "notifyConfig": [
                    {
                        "notifyObject": "uuid_xxx"
                    }
                ],
                "ifRepeatNotify": true,
                "repeatNotifyInterval": 300
            }
        ]
    }
]

请求例子

curl 'https://openapi.guance.com/api/v1/incidents/schedule/incsch_xxx/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"test","timezone":"Asia/Shanghai","start":"00:00","end":"23:59","tagFilter":[],"dimensionFilter":"host:172.16.242.113","scheduleStrategy":[{"name":"test","uuid":"4c5851c0-f692-11f0-9ba3-87705656b525","strategy":[{"level":0,"notifyConfig":[{"notifyMethod":["email","message"],"notifyObject":["watchkeeper"],"notifyObjectType":"member"},{"notifyMethod":[],"notifyObject":["notify_xxx"],"notifyObjectType":"notify"}],"ifRepeatNotify":false,"repeatNotifyInterval":null},{"level":1,"levelUpTime":1800,"notifyConfig":[{"notifyMethod":["email"],"notifyObject":["acnt_xxxx"],"notifyObjectType":"member"}],"ifRepeatNotify":true,"incidentsLevel":["system_level_0"],"incidentsStatus":["open"],"repeatNotifyInterval":300}]}],"notifyTargets":["acnt_xxx"],"extend":{"enableRotateNotification":false,"rotationCycle":"day"}}' \
--compressed

响应

{
    "code": 200,
    "content": {
        "workspaceUUID": "wksp_xxx",
        "name": "test",
        "timezone": "Asia/Shanghai",
        "start": "00:00",
        "end": "23:59",
        "tagFilter": [],
        "dimensionFilter": "host:172.16.242.113",
        "notifyTargets": [
            "acnt_xxx"
        ],
        "strategyConfig": [
            {
                "name": "test",
                "uuid": "4c5851c0-f692-11f0-9ba3-87705656b525",
                "strategy": [
                    {
                        "level": 0,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email",
                                    "message"
                                ],
                                "notifyObject": [
                                    "watchkeeper"
                                ],
                                "notifyObjectType": "member"
                            },
                            {
                                "notifyMethod": [],
                                "notifyObject": [
                                    "notify_xxx"
                                ],
                                "notifyObjectType": "notify"
                            }
                        ],
                        "ifRepeatNotify": false,
                        "repeatNotifyInterval": null
                    },
                    {
                        "level": 1,
                        "levelUpTime": 1800,
                        "notifyConfig": [
                            {
                                "notifyMethod": [
                                    "email"
                                ],
                                "notifyObject": [
                                    "acnt_xxx"
                                ],
                                "notifyObjectType": "member"
                            }
                        ],
                        "ifRepeatNotify": true,
                        "incidentsLevel": [
                            "system_level_0"
                        ],
                        "incidentsStatus": [
                            "open"
                        ],
                        "repeatNotifyInterval": 300
                    }
                ]
            }
        ],
        "extend": {
            "enableRotateNotification": false,
            "rotationCycle": "day"
        },
        "isDefault": false,
        "rotationUpdateAt": 1768989775,
        "id": 9180,
        "uuid": "incsch_xxx",
        "status": 0,
        "creator": "acnt_xxx",
        "updator": "acnt_xxx",
        "createAt": 1768964659,
        "deleteAt": -1,
        "updateAt": 1768989775
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "xxx"
} 

文档评价

文档内容是否对您有帮助? ×