文档首页/ 数据治理中心 DataArts Studio/ API参考/ 数据开发API(V2)/ 通知管理/ 查询通知规则列表 - ListFactoryAlarmRules
更新时间:2025-11-28 GMT+08:00

查询通知规则列表 - ListFactoryAlarmRules

功能介绍

查询通知规则列表。

调用方法

请参见如何调用API

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

GET /v2/{project_id}/factory/alarm/rules

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参见项目ID和账号ID

表2 Query参数

参数

是否必选

参数类型

描述

name

String

作业/规则名称。

remind_type

Integer

通知类型:

  • 0:运行成功。

  • 1:运行异常/失败。

  • 3:未完成。

  • 4:资源繁忙。

  • 5:基线任务异常。

  • 6:基线预警。

  • 7:基线破线。

  • 8:基线加剧。

  • 9:保障作业预警时间未完成。

  • 10:保障作业承诺时间未完成。

  • 11:保障作业失败。

  • 12:周期未完成。

  • 13:运行取消。

  • 14:失败作业重跑成功。

  • 15:作业改动。

默认查询所有状态。

ding_name

String

钉钉机器人名称。

offset

Integer

分页列表的页数,默认值为0。取值范围大于等于0。

limit

Integer

分页返回结果,指定每页最大记录数。范围[1,100],默认为10。

默认值:10

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

workspace

String

工作空间ID,获取方法请参见实例ID和工作空间ID

X-Auth-Token

String

IAM Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值),使用Token认证时必选,最小长度:0,最大长度:4096。

X-Project-Id

String

project_id,项目编号。获取方法请参见项目ID和账号ID

多project场景采用AK/SK认证的接口请求,则该字段必选。

Content-Type

String

默认值:application/json;charset=UTF-8

可选,有Body体的情况下必选,没有Body体则无需填写和校验。

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

alarm_rules_items_details

Array of AlarmRulesItemsDetails objects

通知规则明细。

assurance_mission_commitment_time_not_completed_count

Integer

保障作业承诺时间未完成数量。

assurance_mission_failed_count

Integer

保障作业失败数量。

assurance_mission_warning_time_not_completed_count

Integer

保障作业预警时间未完成数量。

baseline_error_count

Integer

基线作业失败数量。

cancel_jobs_count

Integer

作业取消数量。

exception_count

Integer

作业异常数量。

modify_count

Integer

修改作业数量。

multi_period_unfinished_count

Integer

多周期未完成数量。

overload_count

Integer

资源繁忙作业数量。

recover_jobs_count

Integer

失败作业恢复数量。

success_count

Integer

作业成功数量。

total

Integer

作业总数量。

total_all

Integer

通知规则数量。

unfinished_count

Integer

未完成作业数量。

表5 AlarmRulesItemsDetails

参数

参数类型

描述

name

String

作业名称。

id

Long

ID,与业务无关。

node_id

Long

作业ID/节点任务ID。

remind_type

Integer

通知类型,0:完成;1:运行异常;3:未完成; 4:资源繁忙; 5-11基线相关的告警。

topic_name

String

租户创建的smn服务的topic名称。

urn

String

topic对应URN。

notify_type

Integer

节点类型,1:作业; 2: 节点任务; 3: 基线任务。

display_number

String

责任人电话。

callee_number

String

被叫方的电话。

complete_time

String

完成时间。

create_time

Long

创建时间。

use_flag

Integer

开关。

create_user

String

创建人。

rule_name

String

规则名称。

alarm_periods

Array of AlarmPeriod objects

任务告警信息。

job_directory

Array of DirectoryDTO objects

作业目录信息。

node_id_list

Array of longs

作业ID/节点任务ID。

node_name_list

Array of strings

作业名称/作业名称.节点任务名称。

add_mode

String

添加类型。

subject_type

String

告警对象类型。

notify_method

String

告警方式。

protocol

String

终端协议。

other_persons

String

抄送人。

max_send_times

Integer

最大通知次数。

send_interval

Integer

最小通知间隔,单位分钟。

duty_schedule_id

Long

值班表id。

smn_config_id

String

smn配置id。

表6 AlarmPeriod

参数

参数类型

描述

complete_time

String

任务完成时间。

period

Integer

周期。

表7 DirectoryDTO

参数

参数类型

描述

directory_id

String

目录ID。

directory_name

String

目录名称。

状态码:400

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

GET /v2/62099355b894428e8916573ae635f1f9/factory/alarm/rules

响应示例

状态码:200

响应成功的消息体。

{
  "alarm_rules_items_details" : [ {
    "add_mode" : "SINGLE_ADD",
    "create_time" : 1760691272215,
    "create_user" : "ei_dlf_l00341563",
    "id" : 241,
    "name" : "job_7135",
    "node_id" : 935258,
    "notify_method" : "SUBJECT",
    "notify_type" : 0,
    "remind_type" : 14,
    "topic_name" : "HEHAO",
    "urn" : "urn:smn:cn-north-7:62099355b894428e8916573ae635f1f9:HEHAO",
    "use_flag" : 1
  }, {
    "create_time" : 1760690794536,
    "create_user" : "ei_dlf_l00341563",
    "duty_schedule_id" : 1,
    "id" : 239,
    "max_send_times" : 1,
    "name" : "job_7135",
    "node_id" : 935259,
    "notify_method" : "DUTY_SCHEDULE",
    "notify_type" : 0,
    "protocol" : "[\"sms\",\"email\",\"callnotify\"]",
    "remind_type" : 1,
    "send_interval" : 60,
    "use_flag" : 1
  }, {
    "create_time" : 1760690765236,
    "create_user" : "ei_dlf_l00341563",
    "id" : 237,
    "max_send_times" : 1,
    "name" : "job_7135",
    "node_id" : 935252,
    "notify_method" : "DINGDING",
    "notify_type" : 0,
    "remind_type" : 1,
    "send_interval" : 60,
    "smn_config_id" : "455d4dea49502f1d2042c5c726896e23",
    "use_flag" : 1
  }, {
    "alarm_periods" : [ {
      "complete_time" : "00:00",
      "period" : 1
    }, {
      "complete_time" : "01:00",
      "period" : 2
    } ],
    "create_time" : 1760689768593,
    "create_user" : "ei_dlf_l00341563",
    "id" : 231,
    "node_id" : -2,
    "node_id_list" : [ 935252 ],
    "node_name_list" : [ "job_7135" ],
    "notify_method" : "OWNER",
    "notify_type" : 0,
    "other_persons" : "[\"admin_01\",\"arongtest002\"]",
    "protocol" : "[\"sms\",\"callnotify\",\"email\"]",
    "remind_type" : 12,
    "rule_name" : "ttttt",
    "use_flag" : 1
  } ],
  "assurance_mission_commitment_time_not_completed_count" : 0,
  "assurance_mission_failed_count" : 0,
  "assurance_mission_warning_time_not_completed_count" : 0,
  "baseline_error_count" : 0,
  "cancel_jobs_count" : 1,
  "exception_count" : 4,
  "modify_count" : 0,
  "multi_period_unfinished_count" : 1,
  "overload_count" : 0,
  "recover_jobs_count" : 3,
  "success_count" : 1,
  "total" : 4,
  "total_all" : 4,
  "unfinished_count" : 1
}

状态码:400

失败,返回的错误信息。

{
  "error_code" : "DLF.5013",
  "error_msg" : "The request param is invalid."
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.dataartsstudio.v1.region.DataArtsStudioRegion;
import com.huaweicloud.sdk.dataartsstudio.v1.*;
import com.huaweicloud.sdk.dataartsstudio.v1.model.*;


public class ListFactoryAlarmRulesSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        DataArtsStudioClient client = DataArtsStudioClient.newBuilder()
                .withCredential(auth)
                .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>"))
                .build();
        ListFactoryAlarmRulesRequest request = new ListFactoryAlarmRulesRequest();
        try {
            ListFactoryAlarmRulesResponse response = client.listFactoryAlarmRules(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdataartsstudio.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = DataArtsStudioClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListFactoryAlarmRulesRequest()
        response = client.list_factory_alarm_rules(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dataartsstudio.NewDataArtsStudioClient(
        dataartsstudio.DataArtsStudioClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListFactoryAlarmRulesRequest{}
	response, err := client.ListFactoryAlarmRules(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

响应成功的消息体。

400

失败,返回的错误信息。