Updated on 2026-06-09 GMT+08:00

Update an Event

Function

This API is used to update the metadata of a specified event. The following metadata can be updated: event enabling status, basic type list, and notification topic.

Constraints

This API can be used to modify only the metadata of secret event notifications.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    csms::updateEvent

    Write

    -

    -

    csms:event:update

    -

URI

PUT /v1/{project_id}/csms/events/{event_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Range

The value returned by the IAM API is used, which contains 32 characters.

Default Value

N/A

event_name

Yes

String

Definition

Event notification name.

Constraints

N/A

Range

The value must meet the regular expression ^[a-zA-Z0-9_-]{1,64}$.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. This parameter is optional if AK/SK authentication is used.

Constraints

N/A

Range

Obtain the value by calling the IAM API for obtaining the user token.

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

state

No

String

Definition

Whether the event takes effect. The contained basic event types are returned only when this function is enabled.

Constraints

  • ENABLED: enabled

  • DISABLED: disabled

Range

N/A

Default Value

N/A

event_types

No

Array of strings

Definition

Basic event list of the event notification

Constraints

Basic event type, which can be:

  • SECRET_VERSION_CREATED: Version created.

  • SECRET_VERSION_EXPIRED: Version expired.

  • SECRET_ROTATED: Secret rotated.

  • SECRET_DELETED: Secret deleted.

  • SECRET_ROTATED_FAILED: Secret rotation failed.

The basic event types in the list must be unique.

Range

N/A

Default Value

N/A

notification

No

Notification object

Notification topic object

Table 4 Notification

Parameter

Mandatory

Type

Description

target_type

Yes

String

Definition

Type of the object to which the event notification is sent

Constraints

SMN and EG messages are supported.

Range

N/A

Default Value

N/A

target_id

Yes

String

Definition

ID of the object to which the event notification is sent

Constraints

N/A

Range

N/A

Default Value

N/A

target_name

Yes

String

Definition

Name of the object to which the event notification is sent

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

event

Event object

Definition

Secret event notification information.

Range

N/A

Table 6 Event

Parameter

Type

Description

name

String

Definition

Event notification name

Range

N/A

event_id

String

Definition

Resource ID of the event notification

Range

N/A

event_types

Array of strings

Definition

Set the basic event type list.

Range

Array. The value ranges from 1 to 12.

state

String

Definition

Event notification status

Range

  • ENABLED

  • DISABLED

create_time

Long

Definition

Timestamp when an event notification was created, that is, the total number of seconds since January 1, 1970.

Range

N/A

update_time

Long

Definition

Timestamp when an event notification was last updated, that is, the total number of seconds since January 1, 1970.

Range

N/A

notification

Notification object

Definition

Notification.

Range

N/A

Table 7 Notification

Parameter

Type

Description

target_type

String

Definition

Type of the object to which the event notification is sent

Constraints

SMN and EG messages are supported.

Range

N/A

Default Value

N/A

target_id

String

Definition

ID of the object to which the event notification is sent

Constraints

N/A

Range

N/A

Default Value

N/A

target_name

String

Definition

Name of the object to which the event notification is sent

Constraints

N/A

Range

N/A

Default Value

N/A

Example Requests

Update a specified event.

{
  "notification" : {
    "target_type" : "SMN",
    "target_id" : "demo-smn-id",
    "target_name" : "demo-smn-name"
  }
}

Example Responses

Status code: 200

Request succeeded.

{
  "event" : {
    "name" : "event-test",
    "event_id" : "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e",
    "state" : "ENABLED",
    "event_types" : [ "SECRET_VERSION_EXPIRED" ],
    "create_time" : 1581507580000,
    "update_time" : 1581507580000,
    "notification" : {
      "target_type" : "SMN",
      "target_id" : "urn:smn:cn-north-4:SecretExpirationTest",
      "target_name" : "SecretExpirationNotificationTest"
    }
  }
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.