UpdateSNSTextTemplate
API Request
URLs
PUT zstack/v1/zwatch/alarms/sns/text-templates/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateSNSTextTemplate": {
"name": "email template",
"template": "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"recoveryTemplate": "Alarm ${ALARM_NAME} Resource ${ALARM_RESOURCE_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"defaultTemplate": true
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSNSTextTemplate":{"name":"email template","template":"Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}","recoveryTemplate":"Alarm ${ALARM_NAME} Resource ${ALARM_RESOURCE_NAME} changes status to ${ALARM_CURRENT_STATUS}","defaultTemplate":true}}' http://localhost:8080/zstack/v1/zwatch/alarms/sns/text-templates/108482a9d3153463abd49712701ad937/actions
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 2.3 | |
name | String | body (contained in the updateSNSTextTemplate structure) | Optional. The resource name. | 2.3 | |
description | String | body (contained in the updateSNSTextTemplate structure) | Optional. The detailed description of the resource. | 2.3 | |
template | String | body (contained in the updateSNSTextTemplate structure) | Optional. The template text. | 2.3 | |
recoveryTemplate | String | body (contained in the updateSNSTextTemplate structure) | Optional. The recovery template text, which is a string. | 3.4.0 | |
defaultTemplate | Boolean | body (contained in the updateSNSTextTemplate structure) | Optional. Whether to set the template as the default template. | 2.3 | |
systemTags | List | body | Optional. The system tags. | 2.3 | |
userTags | List | body | Optional. The user tags. | 2.3 |
API Response
Sample
Response
{
"inventory": {
"uuid": "cc881c03f4c04ea9a0e0dda61f4c2f00",
"name": "email template",
"applicationPlatformType": "Email",
"template": "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"recoveryTemplate": "Alarm ${ALARM_NAME} Resource ${ALARM_RESOURCE_NAME} changes status to ${ALARM_CURRENT_STATUS}",
"defaultTemplate": false,
"createDate": "Jul 6, 2018 1:51:22 PM",
"lastOpDate": "Jul 6, 2018 1:51:22 PM"
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.3 |
inventory | SNSTextTemplateInventory | See inventory. | 2.3 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 2.3 |
description | String | The brief description of the error. | 2.3 |
details | String | The details about the error. | 2.3 |
elaboration | String | The reserved field. Default value: null. | 2.3 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 2.3 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.3 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.3 |
name | String | Th resource name. | 2.3 |
description | String | The detailed description of the resource. | 2.3 |
applicationPlatformType | String | The application platform type. | 2.3 |
template | String | The template text. | 2.3 |
recoveryTemplate | String | The recovery template text. | 3.4.0 |
defaultTemplate | Boolean | Whether to set the template as the default template. | 2.3 |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
SDK Sample
Java
SDK
UpdateSNSTextTemplateAction action = new UpdateSNSTextTemplateAction();
action.uuid = "108482a9d3153463abd49712701ad937";
action.name = "email template";
action.template = "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}";
action.recoveryTemplate = "Alarm ${ALARM_NAME} Resource ${ALARM_RESOURCE_NAME} changes status to ${ALARM_CURRENT_STATUS}";
action.defaultTemplate = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSNSTextTemplateAction.Result res = action.call();
Python
SDK
UpdateSNSTextTemplateAction action = UpdateSNSTextTemplateAction()
action.uuid = "108482a9d3153463abd49712701ad937"
action.name = "email template"
action.template = "Alarm ${ALARM_NAME} changes status to ${ALARM_CURRENT_STATUS}"
action.recoveryTemplate = "Alarm ${ALARM_NAME} Resource ${ALARM_RESOURCE_NAME} changes status to ${ALARM_CURRENT_STATUS}"
action.defaultTemplate = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSNSTextTemplateAction.Result res = action.call()