Update Alarm Message Template

PUT/zstack/v1/zwatch/alarms/sns/text-templates/{uuid}/actions

Update an alarm message template.

Headers


Authorization: OAuth the-session-uuid

Body

{
  "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": []
}

In the above example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

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

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlThe UUID of the resource. Uniquely identifies the resource 2.3
name (Optional)Stringbody (contained in the updateSNSTextTemplate structure)The resource name 2.3
description (Optional)Stringbody (contained in the updateSNSTextTemplate structure)The detailed description of the resource 2.3
template (Optional)Stringbody (contained in the updateSNSTextTemplate structure)The alarm message template text 2.3
recoveryTemplate (Optional)Stringbody (contained in the updateSNSTextTemplate structure)The recovery alarm message template text 3.4.0
defaultTemplate (Optional)Booleanbody (contained in the updateSNSTextTemplate structure)Whether it is the default template 2.3
systemTags (Optional)ListbodySystem tags 2.3
userTags (Optional)ListbodyUser tags 2.3

API Response

Response Example

{
  "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"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. See error2.3
inventorySNSTextTemplateInventorySee inventory2.3

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, such as SYS.1000, HOST.10012.3
descriptionStringA brief description of the error2.3
detailsStringThe detailed error information2.3
elaborationStringReserved field. Default is null2.3
opaqueLinkedHashMapReserved field. Default is null2.3
causeErrorCodeThe root error. The source error that caused the current error. This field is null if there is no root error2.3

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource2.3
nameStringThe resource name2.3
descriptionStringThe detailed description of the resource2.3
applicationPlatformTypeStringThe application platform type2.3
templateStringThe template text2.3
recoveryTemplateStringThe template text3.4.0
defaultTemplateBooleanWhether it is the default template2.3
createDateTimestampThe creation time2.3
lastOpDateTimestampThe last modification time2.3

SDK Examples

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()