Skip to content

Commit

Permalink
Update docs and samples to reflect alarm ID becoming string (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
remi00 authored Jul 31, 2024
1 parent 7e63121 commit 8b81dc6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions docs/TEMPLATING_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Example:
[{
"Label": "ID",
"Name": "AlarmID",
"Value": "216148908",
"Value": "0190db1d-5d37-70a8-95bd-4092c918ecbe",
},
{
"Label": "Severity",
Expand Down Expand Up @@ -580,7 +580,7 @@ This will result in the following JSON payload on render:
{
"custom": {
"AlarmBaselineSource": "ACT_BASELINE_MISSING_DEFAULT_INSTEAD_OF_LOWEST",
"AlarmID": 197790253,
"AlarmID": "0190db1d-5d37-70a8-95bd-4092c918ecbe",
"AlarmPolicyID": 297,
"AlarmPolicyName": "DDoS Protect Policy",
"AlarmSeverity": "critical",
Expand Down Expand Up @@ -635,7 +635,7 @@ This will result in the following JSON payload on render:
```json
{
"AlarmBaselineSource": "ACT_BASELINE_MISSING_DEFAULT_INSTEAD_OF_LOWEST",
"AlarmID": 197790253,
"AlarmID": "0190db1d-5d37-70a8-95bd-4092c918ecbe",
"AlarmPolicyID": 297,
"AlarmPolicyName": "DDoS Protect Policy",
"AlarmSeverity": "critical",
Expand Down
6 changes: 3 additions & 3 deletions pkg/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ var TestAlarm = &NotificationViewModel{
&EventViewModelDetail{
Name: "AlarmID",
Label: "ID",
Value: 197790252,
Value: "0190db1d-5d37-70a8-95bd-4092c918ecbe",
Tag: "",
},
&EventViewModelDetail{
Expand Down Expand Up @@ -402,7 +402,7 @@ var TestSynth = &NotificationViewModel{
&EventViewModelDetail{
Name: "AlarmID",
Label: "",
Value: 1222228,
Value: "0190db1d-5d37-70a8-95bd-4092c918ecbe",
Tag: "",
},
&EventViewModelDetail{
Expand Down Expand Up @@ -565,7 +565,7 @@ var TestMitigation = &NotificationViewModel{
&EventViewModelDetail{
Name: "MitigationAlarmID",
Label: "Alarm ID",
Value: 197790252,
Value: "0190db1d-5d37-70a8-95bd-4092c918ecbe",
Tag: "",
},
&EventViewModelDetail{
Expand Down
30 changes: 15 additions & 15 deletions templates/json-legacy.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ See template documentation here: https://golang.org/pkg/text/template/
{{- with .Event -}}
{{- if .IsAlarm -}}
"EventType": "ALARM_STATE_CHANGE",
"AlarmID": {{ .Details.GetValue "AlarmID" }},
"AlarmID": "{{ .Details.GetValue "AlarmID" }}",
"AlarmState": "{{ .CurrentState }}",
"PolicyID": {{ .Details.GetValue "AlarmPolicyID" }},
"ThresholdID": {{ .Details.GetValue "AlarmThresholdID" }},
"PolicyID": "{{ .Details.GetValue "AlarmPolicyID" }}",
"ThresholdID": "{{ .Details.GetValue "AlarmThresholdID" }}",
"MitigationID": "0",
"ActivateSeverity": "{{.Details.GetValue "AlarmSeverity"}}",
"AlarmStart": "{{ timeRfc3339 .StartTime }}",
Expand Down Expand Up @@ -76,19 +76,19 @@ See template documentation here: https://golang.org/pkg/text/template/
}
},
{{- else if .IsMitigation -}}
"EventType": "MITIGATION_STATE_CHANGE",
"MitigationID": {{ .Details.GetValue "MitigationID" }},
"MitigationStart": "{{timeRfc3339 .StartTime}}",
"MitigationEnd": "{{timeRfc3339 .EndTime}}",
"MitigationStateNew": "{{.CurrentState}}",
"MitigationState": "{{.CurrentState}}",
"MitigationStateOld": "{{.PreviousState}}",
"MitigationMethodID": {{.Details.GetValue "MitigationMethodID"}},
"MitigationPlatformID": {{.Details.GetValue "MitigationPlatformID"}},
"MitigationPolicyID": {{ .Details.GetValue "MitigationPolicyID" }},
"MitigationMethodName": "{{.Details.GetValue "MitigationMethodName"}}",
"EventType": "MITIGATION_STATE_CHANGE",
"MitigationID": "{{ .Details.GetValue "MitigationID" }}",
"MitigationStart": "{{timeRfc3339 .StartTime}}",
"MitigationEnd": "{{timeRfc3339 .EndTime}}",
"MitigationStateNew": "{{.CurrentState}}",
"MitigationState": "{{.CurrentState}}",
"MitigationStateOld": "{{.PreviousState}}",
"MitigationMethodID": "{{.Details.GetValue "MitigationMethodID"}}",
"MitigationPlatformID": "{{.Details.GetValue "MitigationPlatformID"}}",
"MitigationPolicyID": "{{ .Details.GetValue "MitigationPolicyID" }}",
"MitigationMethodName": "{{.Details.GetValue "MitigationMethodName"}}",
"MitigationPlatformName": "{{.Details.GetValue "MitigationPlatformName"}}",
"MitigationAlertIP": "{{.Details.GetValue "MitigationAlertIP"}}",
"MitigationAlertIP": "{{.Details.GetValue "MitigationAlertIP"}}",
{{- else -}}
{{- . | toJSON | explodeJSONKeys -}},
{{- .Details.General.ToMap | toJSON | explodeJSONKeys -}},
Expand Down

0 comments on commit 8b81dc6

Please sign in to comment.