-
Notifications
You must be signed in to change notification settings - Fork 565
Define CloudWatch Alarm Payload structure #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eef90db
Added CloudWatchAlarmSnsPayload struct and nested structs within the …
paritosw 58e5541
Added test for the unmarshaling of CloudWatchAlarmSnsPayload
paritosw e3680bf
Added sample event json files
paritosw caaa938
Adding module files
paritosw 027ec34
Fixed json tag
paritosw 29d4ac0
Initialisms and acronyms changed to caps.
paritosw 9f1471f
Sanitized the example json payload
paritosw e5194c9
Removed unused dependency
paritosw 13d9b96
Fix the new type name using caps
paritosw 065232b
Merge branch 'master' into master
paritosw 04859dc
Changed all CloudWatch types to not being pointers for consistency
paritosw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
events/testdata/cloudwatch-alarm-sns-payload-multiple-metrics.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Records": [ | ||
{ | ||
"EventSource": "aws:sns", | ||
"EventVersion": "1.0", | ||
"EventSubscriptionArn": "arn:aws:sns:EXAMPLE", | ||
"Sns": { | ||
"Type": "Notification", | ||
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", | ||
"TopicArn": "arn:aws:sns:EXAMPLE", | ||
"Subject": "TestInvoke", | ||
"Message": "{\"AlarmName\":\"EXAMPLE\",\"AlarmDescription\":\"EXAMPLE\",\"AWSAccountId\":\"EXAMPLE\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 out of the last 1 datapoints [1234.0 (06/03/15 17:43:27)] was greater than the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\":\"2015-06-03T17:43:27.123+0000\",\"Region\":\"EXAMPLE\",\"AlarmArn\":\"arn:aws:cloudwatch:REGION:ACCOUNT_NUMBER:alarm:EXAMPLE\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"Period\":60,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanThreshold\",\"Threshold\":0.0,\"TreatMissingData\":\"- TreatMissingData: missing\",\"EvaluateLowSampleCountPercentile\":\"\",\"Metrics\":[{\"Expression\":\"m1*1\",\"Id\":\"e1\",\"Label\":\"Expression1\",\"ReturnData\":true},{\"Id\":\"m1\",\"MetricStat\":{\"Metric\":{\"Dimensions\":[{\"value\":\"TestInstance\",\"name\":\"InstanceId\"}],\"MetricName\":\"NetworkOut\",\"Namespace\":\"AWS/EC2\"},\"Period\":60,\"Stat\":\"Average\"},\"ReturnData\":false}]}}", | ||
"Timestamp": "2015-06-03T17:43:27.123Z", | ||
"SignatureVersion": "1", | ||
"Signature": "EXAMPLE", | ||
"SigningCertUrl": "EXAMPLE", | ||
"UnsubscribeUrl": "EXAMPLE", | ||
"MessageAttributes": {} | ||
} | ||
} | ||
] | ||
} |
22 changes: 22 additions & 0 deletions
22
events/testdata/cloudwatch-alarm-sns-payload-single-metric.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Records": [ | ||
{ | ||
"EventSource": "aws:sns", | ||
"EventVersion": "1.0", | ||
"EventSubscriptionArn": "arn:aws:sns:us-east-2: 594917905844:Default_CloudWatch_Alarms_Topic_Test: 872f5b40-db58-4161-94af-4fbc7f613012", | ||
bmoffatt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"Sns": { | ||
"Type": "Notification", | ||
"MessageId": "48c234a8-0bf8-56aa-82bd-63fcf9fc8cdc", | ||
"TopicArn": "arn:aws:sns:us-east-2: 594917905844:Default_CloudWatch_Alarms_Topic_Test", | ||
"Subject": "ALARM: \"test-alarm\" in US East (Ohio)", | ||
"Message": "{\"AlarmName\": \"EXAMPLE\",\"AlarmDescription\": \"EXAMPLE\",\"AWSAccountId\": \"123456789012\",\"NewStateValue\": \"ALARM\",\"NewStateReason\": \"Threshold Crossed: 1 out of the last 1 datapoints [1234.0 (06/03/15 17:43:27)] was greater than the threshold (0.0) (minimum 1 datapoint for OK -> ALARM transition).\",\"StateChangeTime\": \"2015-06-03T17:43:27.123+0000\",\"Region\": \"EXAMPLE\",\"AlarmArn\": \"arn:aws:cloudwatch:REGION:ACCOUNT_NUMBER:alarm:EXAMPLE\",\"OldStateValue\": \"INSUFFICIENT_DATA\",\"Trigger\": {\"MetricName\": \"NetworkOut\",\"Namespace\": \"AWS/EC2\",\"StatisticType\": \"Statistic\",\"Statistic\": \"AVERAGE\",\"Unit\": \"Bytes\",\"Dimensions\": [{\"value\": \"TestInstance\",\"name\": \"InstanceId\"}],\"Period\": 60,\"EvaluationPeriods\": 1,\"ComparisonOperator\": \"GreaterThanThreshold\",\"Threshold\": 0.0,\"TreatMissingData\": \"- TreatMissingData: missing\",\"EvaluateLowSampleCountPercentile\": \"\"}}", | ||
"Timestamp": "2015-06-03T17:43:27.123Z", | ||
"SignatureVersion": "1", | ||
"Signature": "RENXziJT8pGBhsGjpAOCAnoJ97DxibakoUk/hv71cxGUM2bSROtYAzCb1UNSvWsfonFXH4tf+aJsjKEkoDRCgnbft9rjohgW52L6GXEGpL0mgdoBF08EzRrLk/xCqoOvMzTP1W0gM2hiwyCmLmQvUw21gCU8RYZrk2LvFQ91sdXqneRcifrRBEyk92SZ60JHjMatnxWHFXOe71Ca8aPou0Qu1V76Sn1/J6hYq5tujMWohWBkPnqWXOvLPRJsrh6HnvVYhfBVUiE2QIEg3G9++0+fQoGHExAfrleK/1afmDNBhh27d3TKFRSOG78wF/NG2HeyYgg4ocQ6F6VwchPRew==", | ||
"SigningCertUrl": "https: //sns.us-east-2.amazonaws.com/SimpleNotificationService-a86cb10b4e1f29c941702d737128f7b6.pem", | ||
"UnsubscribeUrl": "https: //sns.us-east-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:594917905844:Default_CloudWatch_Alarms_Topic_Test:872f5b40-db58-4161-94af-4fbc7f613012", | ||
"MessageAttributes": {} | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.