Configures the event subscription settings for a database instance.
Operation description
Before you call this operation, take note of the following items:
- If you use an Alibaba Cloud SDK or Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.
- If you use an SDK to call the API operations of DAS, you must set the region ID to cn-shanghai.
- Make sure that the database instance that you want to manage is connected to DAS.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
hdm:SetEventSubscription | update |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The instance ID. | rm-2ze8g2am97624**** |
EventContext | string | No | The supported event scenarios. You can set the value to AllContext, which indicates that all scenarios are supported. | AllContext |
Lang | string | No | The language of event notifications. You can set the value to zh-CN, which indicates that event notifications are sent in Chinese. | zh-CN |
MinInterval | string | No | The minimum interval between consecutive event notifications. Unit: seconds. | 60 |
ContactName | string | No | The name of the contact who receives alert notifications. Separate multiple names with commas (,). | Default contact |
ChannelType | string | No | The notification method. Valid values:
| hdm_alarm_sms,dingtalk |
ContactGroupName | string | No | The name of the contact group that receives alert notifications. Separate multiple names with commas (,). | Default contact group |
Level | string | No | The risk level of the events. Valid values:
The following content describes the events at each level in detail:
| Optimization |
Active | string | No | Specifies whether to enable the event subscription feature. Valid values:
| 1 |
Severity | string | No | The alert severity based on the event type. Specify this parameter in the following format: Valid values of event types:
Valid values of alert severities:
| {"AutoScale":"critical","SQLThrottle":"info","TimeSeriesAbnormal":"warning"} |
DispatchRule | string | No | The notification rules based on the event type. If you leave this parameter empty, the values of MinInterval and ChannelType prevail. Specify this parameter in the following format:
| {"silenced": {"AutoScale":1, "SQLThrottle":0, "TimeSeriesAbnormal": 1}, "min_interval": {"AutoScale":300, "SQLThrottle":360, "TimeSeriesAbnormal": 120}, "alert_type": {"AutoScale":"hdm_alarm_sms", "SQLThrottle":"hdm_alarm_sms_and_email", "TimeSeriesAbnormal": "hdm_alarm_sms,dingtalk"}} |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "097F0C56-B252-515A-B602-FC56EF93EF8A",
"Message": "Successful",
"Data": {
"userId": "1088760496****",
"instanceId": "rm-2ze8g2am97624****",
"eventContext": "AllContext",
"lang": "zh_CN",
"active": 1,
"minInterval": 60,
"contactName": "Default contact",
"contactGroupName": "Default contact group",
"channelType": "hdm_alarm_sms,dingtalk",
"level": "Optimization"
},
"Code": "200",
"Success": "true"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | InvalidParams | The request parameters are invalid. |
403 | NoPermission | You are not authorized to do this action. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-04-25 | The request parameters of the API has changed | View Change Details |