Updated on 2025-10-22 GMT+08:00

Modifying an Event Notification Rule

Function

Modify an event notification rule.

URI

PUT /v1/{project_id}/cae/notice-rules/{rule_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

rule_id

Yes

String

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

  • Obtain the token. For details, see "Obtaining a User Token" in Identity and Access Management API Reference (https://support.huaweicloud.com/intl/en-us/api-iam/iam_30_0001.html).

  • The value of X-Subject-Token in the response header is the token value.

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.

  • Enter 0 or up to 36 characters in UUID format with hyphens (-).

  • If this parameter is not specified or set to 0, resources in the default enterprise project are queried.

NOTE:
For details about how to obtain enterprise project IDs and enterprise project features, see Enterprise Management User Guide.
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

kind

Yes

String

API type. Fixed value: NoticeRule.

spec

Yes

UpdateNoticeRuleItem object

Request data.

Table 4 UpdateNoticeRuleItem

Parameter

Mandatory

Type

Description

event_name

No

String

Name of the trigger event. Values: Instance scheduling successful, Instance scheduling failed, Health checked, Health check failed, Image pulled, Pull image failed, Container started up, Container startup failed, Volume mounted, Attach volume failed.

scope

Yes

NoticeRuleScope object

Scope of the notification rule that takes effect.

trigger_policy

Yes

TriggerPolicy object

Trigger policy.

enable

No

Boolean

Enable or not.

Table 5 NoticeRuleScope

Parameter

Mandatory

Type

Description

type

Yes

String

Type of the effective scope. including environments (for all components in a specified environment), applications (for all components of a specified application), and components (for specified components).

environments

No

Array of strings

List of valid environment IDs.

applications

No

Array of strings

List of valid application IDs.

components

No

Array of strings

List of valid component IDs.

Table 6 TriggerPolicy

Parameter

Mandatory

Type

Description

trigger_type

Yes

String

Trigger type. Options: accumulative or immediately.

period

No

Integer

Trigger period. This parameter needs to be set when accumulative is selected. The default unit is second. The value can be 5 minutes, 20 minutes, 1 hour, 4 hours, or 24 hours.

operator

No

String

Comparison operator. The value can be > or >=.

count

No

Integer

Number of trigger times. This parameter needs to be set when accumulative is selected.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

api_version

String

API version. Fixed value: v1.

kind

String

API type. Fixed value: NoticeRule.

spec

CreateNoticeRuleRespItem object

Request data.

Table 8 CreateNoticeRuleRespItem

Parameter

Type

Description

id

String

Unique ID of a notification rule.

name

String

Notification name.

event_name

String

Name of the triggered event.

scope

NoticeRuleScope object

Scope of the notification rule that takes effect.

trigger_policy

TriggerPolicy object

Trigger policy.

notification

NoticeRuleNotification object

Notification mechanism.

enable

Boolean

Enable or not.

Table 9 NoticeRuleScope

Parameter

Type

Description

type

String

Type of the effective scope. including environments (for all components in a specified environment), applications (for all components of a specified application), and components (for specified components).

environments

Array of strings

List of valid environment IDs.

applications

Array of strings

List of valid application IDs.

components

Array of strings

List of valid component IDs.

Table 10 TriggerPolicy

Parameter

Type

Description

trigger_type

String

Trigger type. Options: accumulative or immediately.

period

Integer

Trigger period. This parameter needs to be set when accumulative is selected. The default unit is second. The value can be 5 minutes, 20 minutes, 1 hour, 4 hours, or 24 hours.

operator

String

Comparison operator. The value can be > or >=.

count

Integer

Number of trigger times. This parameter needs to be set when accumulative is selected.

Table 11 NoticeRuleNotification

Parameter

Type

Description

protocol

String

Definition

Notification protocol type.

Constraints

N/A.

Range

  • email

  • sms

  • wechat

  • dingding

Default Value

N/A.

extension

extension object

endpoint

String

Notification endpoint address.

For an email protocol, the endpoint must be an email address.

For an SMS protocol, the endpoint must be a phone number.

For the WeChat protocol and DingTalk chatbot, see Obtaining Subscription Endpoints.

WeCom and DingTalk chatbot are in OBT of SMN. Submit a service ticket to enable them.

template

String

Notification template language. Options:

ZH

EN

Table 12 extension

Parameter

Type

Description

sign_secret

String

In the DingTalk scenario, you can enter the key field.

Example Requests

Modify an event notification rule.

PUT https://{endpoint}/v1/{project_id}/cae/notice-rules/{rule_id}

{
  "api_version" : "v1",
  "kind" : "NoticeRule",
  "spec" : {
    "event_name" : "Started",
    "scope" : {
      "type" : "environments",
      "environments" : [ "f3c12180-b34a-42d8-bb5a-12ba0a6b579e" ]
    },
    "trigger_policy" : {
      "trigger_type" : "immediately"
    },
    "enable" : true
  }
}

Example Responses

Status code: 200

OK

{
  "api_version" : "v1",
  "kind" : "NoticeRule",
  "spec" : {
    "name" : "test",
    "event_name" : "Started",
    "scope" : {
      "type" : "environments",
      "environments" : [ "f3c12180-b34a-42d8-bb5a-12ba0a6b579e" ]
    },
    "trigger_policy" : {
      "trigger_type" : "immediately"
    },
    "enable" : true
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.