Querying the Notification Rule List
Function
This API is used to query the notification rule list.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/factory/alarm/rules
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Project ID and Account ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
No |
String |
Job or rule name |
|
remind_type |
No |
Integer |
Notification type
By default, jobs in all statuses are queried. |
|
ding_name |
No |
String |
DingTalk chatbot name |
|
offset |
No |
Integer |
Number of pages in the list. The default value is 0. The value must be greater than or equal to 0. |
|
limit |
No |
Integer |
Maximum number of records on each page. Value range: [1,100]. The default value is 10. Default value: 10 |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
workspace |
Yes |
String |
Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
|
X-Auth-Token |
No |
String |
IAM token, which is obtained by calling the IAM API for obtaining a user token (value of X-Subject-Token in the response header). This parameter is mandatory when token authentication is used. The value contains 0 to 4096 characters. |
|
X-Project-Id |
No |
String |
project_id: project ID. For details about how to obtain the project ID and account ID, see Project ID and Account ID. This field is mandatory for API requests that use AK/SK authentication in multi-project scenarios. |
|
Content-Type |
Yes |
String |
Default value: application/json;charset=UTF-8 Optional. This parameter is mandatory if a body is available. If no body is available, you do not need to set or verify this parameter. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
alarm_rules_items_details |
Array of AlarmRulesItemsDetails objects |
Notification rule details |
|
assurance_mission_commitment_time_not_completed_count |
Integer |
Number of assurance jobs that are not completed within the committed time |
|
assurance_mission_failed_count |
Integer |
Number of failed assurance jobs |
|
assurance_mission_warning_time_not_completed_count |
Integer |
Number of assurance jobs that are not completed within the warning time |
|
baseline_error_count |
Integer |
Number of failed baseline jobs |
|
cancel_jobs_count |
Integer |
Number of canceled jobs |
|
exception_count |
Integer |
Number of abnormal jobs |
|
modify_count |
Integer |
Number of modified jobs |
|
multi_period_unfinished_count |
Integer |
Number of jobs that are not completed in multiple periods |
|
overload_count |
Integer |
Number of jobs with busy resources |
|
recover_jobs_count |
Integer |
Number of failed jobs that can be restored |
|
success_count |
Integer |
Number of successful jobs |
|
total |
Integer |
Total number of jobs |
|
total_all |
Integer |
Number of notification rules |
|
unfinished_count |
Integer |
Number of uncompleted jobs |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Job name |
|
id |
Long |
ID, which is irrelevant to services |
|
node_id |
Long |
Job ID or node task ID |
|
remind_type |
Integer |
Notification type. 0: completed; 1: abnormal; 3: uncompleted; 4: busy resources; 5 to 11: baseline-related alarms |
|
topic_name |
String |
Topic name of the SMN service created by the tenant. |
|
urn |
String |
URN of a topic |
|
notify_type |
Integer |
Node type. 1: job; 2: node task; 3: baseline task |
|
display_number |
String |
Phone number of the owner |
|
callee_number |
String |
Phone number of the called party |
|
complete_time |
String |
Completion time. |
|
create_time |
Long |
Creation time |
|
use_flag |
Integer |
Whether to enable the function |
|
create_user |
String |
Creator |
|
rule_name |
String |
Rule name |
|
alarm_periods |
Array of AlarmPeriod objects |
Task alarm information |
|
job_directory |
Array of DirectoryDTO objects |
Job directory information |
|
node_id_list |
Array of longs |
Job ID or node task ID |
|
node_name_list |
Array of strings |
Job name/Job name.Node task name |
|
add_mode |
String |
Adding mode |
|
subject_type |
String |
Subject type |
|
notify_method |
String |
Alarm notification method |
|
protocol |
String |
Terminal protocol |
|
other_persons |
String |
CC recipient |
|
max_send_times |
Integer |
Maximum number of notifications |
|
send_interval |
Integer |
Minimum notification interval, in minutes |
|
duty_schedule_id |
Long |
Duty schedule ID |
|
smn_config_id |
String |
SMN configuration ID |
|
Parameter |
Type |
Description |
|---|---|---|
|
complete_time |
String |
Task completion time |
|
period |
Integer |
Period |
|
Parameter |
Type |
Description |
|---|---|---|
|
directory_id |
String |
Directory ID |
|
directory_name |
String |
Directory name |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Example Requests
GET /v2/62099355b894428e8916573ae635f1f9/factory/alarm/rules
Example Responses
Status code: 200
Message body of a successful response
{
"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
}
Status code: 400
Failure. Error information is returned.
{
"error_code" : "DLF.5013",
"error_msg" : "The request param is invalid."
}
SDK Sample Code
The SDK sample code is as follows.
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) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Message body of a successful response |
|
400 |
Failure. Error information is returned. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot