Files
doc-exports/docs/ces/api-ref/UpdateOneClickAlarmNotifications.html
qiujiandong1 e9265fb6b0 CES API Update -20250521 version
Reviewed-by: Ziuzko, Alevtina <alevtina.ziuzko@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2025-12-05 10:48:24 +00:00

48 KiB

Batch Modifying Alarm Notifications in Alarm Rules for One Service with One-Click Monitoring Enabled

Function

This API is used to batch modify alarm notifications in alarm rules for one service with one-click monitoring enabled.

URI

PUT /v2/{project_id}/one-click-alarms/{one_click_alarm_id}/notifications

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

Minimum: 1

Maximum: 64

Regular expression matching: ^[a-zA-Z0-9-]{1,64}$

one_click_alarm_id

Yes

String

One-click monitoring ID.

Minimum: 1

Maximum: 64

Regular expression matching: ^([a-z]|[A-Z]|[0-9]){1,64}$

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. The default value is application/json; charset=UTF-8.

Default: application/json; charset=UTF-8

Minimum: 1

Maximum: 64

X-Auth-Token

Yes

String

User token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. After a response is returned, the value of X-Subject-Token in the response header is the token.

Minimum: 1

Maximum: 16384

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

notification_enabled

Yes

Boolean

Whether to enable alarm notifications. The value can be true (enable) or false (disable).

alarm_notifications

No

Array of Notification objects

Action to be triggered by the alarm. Array length: 0 to 10

ok_notifications

No

Array of Notification objects

Action to be triggered after an alarm is cleared. Array length: 0 to 10

notification_begin_time

No

String

Time when the alarm notification was enabled. Example: 09:00

Regular expression matching: ^([01][0-9]|2[0-3]):([0-5][0-9])$

notification_end_time

No

String

Time when the alarm notification was disabled. Example: 12:00

Regular expression matching: ^([01][0-9]|2[0-3]):([0-5][0-9])$

Table 4 Notification

Parameter

Mandatory

Type

Description

type

Yes

String

Notification type.

The value can be:

notification: topic subscriptions. Notifications are sent using SMN topics.

contact: cloud account contacts. Notifications are sent using the mobile number and email address registered for your account.

notification_list

Yes

Array of strings

List of objects to be notified of alarm status changes. The value of topicUrn can be obtained from SMN. For details, see section Querying Topics. If type is set to notification, the value of notificationList cannot be empty. If type is set to autoscaling, the value of notificationList must be empty. If you set alarm_action_enabled to true, you must specify either alarm_actions or ok_actions. If alarm_actions and ok_actions coexist, their notificationList must be the same.

Array length: 0 to 20

Response Parameters

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Status code customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Status code customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Status code customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Status code customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Status code customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Request error message.

Minimum: 0

Maximum: 256

request_id

String

Request ID.

Minimum: 0

Maximum: 256

Example Requests

Batch modify alarm notifications in alarm rules for one service that has one-click monitoring enabled.

PUT /v2/{project_id}/one-click-alarms/{one_click_alarm_id}/notifications

Request body:

{
  "notification_enabled" : true,
  "alarm_notifications" : [ {
    "type" : "notification",
    "notification_list" : [ "urn:smn:123" ]
  } ],
  "ok_notifications" : [ {
    "type" : "notification",
    "notification_list" : [ "urn:smn:123" ]
  } ],
  "notification_begin_time" : "00:00",
  "notification_end_time" : "23:59"
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Parameter verification failed.

401

Authentication failed.

403

Authentication failed.

404

Resources not found.

500

Failed to complete the request because of an internal server error.

Error Codes

See Error Codes.