Modifying a Key Event Notification

Function

This API is used to modify a key event notification. The notification ID carried in the request must be valid.

URI

PUT /v3/{project_id}/notifications

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

notification_name

Yes

String

Notification name.

operation_type

Yes

String

Operation type. Possible options include complete and customized. If you choose complete, notifications will be sent when any supported operation occurs on any of the connected cloud services. If you choose customized, notifications will be sent when operations defined in operations occur.

Enumerated values:

  • customized

  • complete

operations

No

Array of Operations objects

Operation list.

notify_user_list

No

Array of NotificationUsers objects

List of users whose operations will trigger notifications. Currently, up to 50 users in 10 user groups can be configured.

status

Yes

String

Notification status. Possible options include enabled and disabled.

Enumerated values:

  • enabled

  • disabled

topic_id

No

String

Topic URN. This parameter is mandatory when status is set to enabled.

  • To obtain the topic_urn, call the SMN API for querying topics. Example URN: urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2

notification_id

Yes

String

Notification ID.

Table 3 Operations

Parameter

Mandatory

Type

Description

service_type

Yes

String

Cloud service. The value must be the acronym of a cloud service that has been connected with CTS. It is a word composed of uppercase letters. For cloud services that can be connected with CTS, see section "Supported Services and Operations" in the Cloud Trace Service User Guide.

resource_type

Yes

String

Resource type.

trace_names

Yes

Array of strings

Trace name.

Table 4 NotificationUsers

Parameter

Mandatory

Type

Description

user_group

Yes

String

IAM user group.

user_list

Yes

Array of strings

IAM user.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

notification_name

String

Notification name.

operation_type

String

Operation type. Possible options include complete and customized. If you choose complete, notifications will be sent when any supported operation occurs on any of the connected cloud services. If you choose customized, notifications will be sent when operations defined in operations occur.

Enumerated values:

  • customized

  • complete

operations

Array of Operations objects

Operation list.

notify_user_list

Array of NotificationUsers objects

List of users whose operations will trigger notifications. Currently, up to 50 users in 10 user groups can be configured.

status

String

Notification status. Possible options include enabled and disabled.

Enumerated values:

  • enabled

  • disabled

topic_id

String

Topic URN.

  • To obtain the topic_urn, call the SMN API for querying topics. Example URN: urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2

notification_id

String

Unique notification ID.

notification_type

String

Notification type.

Enumerated value:

  • smn

project_id

String

Project ID.

create_time

Long

Timestamp when a notification was created.

Table 6 Operations

Parameter

Type

Description

service_type

String

Cloud service. The value must be the acronym of a cloud service that has been connected with CTS. It is a word composed of uppercase letters. For cloud services that can be connected with CTS, see section "Supported Services and Operations" in the Cloud Trace Service User Guide.

resource_type

String

Resource type.

trace_names

Array of strings

Trace name.

Table 7 NotificationUsers

Parameter

Type

Description

user_group

String

IAM user group.

user_list

Array of strings

IAM user.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code. Format: CTS.XXX.

error_msg

String

Error description.

Example Request

Modifying a key event notification

PUT https://{endpoint}/v3/{project_id}/notifications

{
  "notification_id" : "6d4a09bb-aa8e-40db-9e87-0d5e203823a8",
  "notification_name" : "keyOperate_info_cfwy",
  "operation_type" : "customized",
  "operations" : [ {
    "service_type" : "CTS",
    "resource_type" : "tracker",
    "trace_names" : [ "createTracker", "deleteTraceker" ]
  }, {
    "service_type" : "CTS",
    "resource_type" : "notification",
    "trace_names" : [ "deleteNotification", "updateNotification" ]
  }, {
    "service_type" : "AOM",
    "resource_type" : "pe",
    "trace_names" : [ "deletePolicyGroup", "updatePolicyGroup", "createPolicyGroup" ]
  } ],
  "notify_user_list" : [ {
    "user_group" : "admin",
    "user_list" : [ "test", "test1" ]
  }, {
    "user_group" : "CTS view",
    "user_list" : [ "test2", "test3" ]
  } ],
  "status" : "enabled",
  "topic_id" : "urn:smn:{regionid}:24edf66e79d04187acb99a463e610764:foo"
}

Example Response

Status code: 200

The notification is modified.

{
  "notification_id" : "6d4a09bb-aa8e-40db-9e87-0d5e203823a8",
  "notification_name" : "keyOperate_info_cfwy",
  "operation_type" : "customized",
  "operations" : [ {
    "service_type" : "CTS",
    "resource_type" : "tracker",
    "trace_names" : [ "createTracker", "deleteTraceker" ]
  }, {
    "service_type" : "CTS",
    "resource_type" : "notification",
    "trace_names" : [ "deleteNotification", "updateNotification" ]
  }, {
    "service_type" : "AOM",
    "resource_type" : "pe",
    "trace_names" : [ "deletePolicyGroup", "updatePolicyGroup", "createPolicyGroup" ]
  } ],
  "notify_user_list" : [ {
    "user_group" : "admin",
    "user_list" : [ "test", "test1" ]
  }, {
    "user_group" : "CTS view",
    "user_list" : [ "test2", "test3" ]
  } ],
  "status" : "enabled",
  "project_id" : "24edf66e79d04187acb99a463e610764",
  "notification_type" : "smn",
  "create_time" : 1634001495876,
  "topic_id" : "urn:smn:{regionid}:24edf66e79d04187acb99a463e610764:foo"
}

Status Codes

Status Code

Description

200

The notification is modified.

400

The server failed to process the request.

401

The request is rejected due to authentication failure.

403

The server understood the request but refused to authorize it.

404

The server failed to find the requested resource or some key event notifications failed to be deleted.

500

The request failed to be executed or some trackers failed to be deleted.

503

The requested service is unavailable. The client should not repeat the request without modifications.

Error Codes

See Error Codes.