Skip to content

Commit

Permalink
Fix AWS Health Event Bridge Rule (#633)
Browse files Browse the repository at this point in the history
* Fix AWS Health Event Bridge Rule

* Fix AWS Health Event Bridge Rule

Co-authored-by: Likitha Vemulapalli <[email protected]>
  • Loading branch information
LikithaVemulapalli and LikithaVemulapalli authored Apr 28, 2022
1 parent 37e9899 commit 3298246
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ $ aws events put-targets --rule MyK8sInstanceStateChangeRule \
$ aws events put-rule \
--name MyK8sScheduledChangeRule \
--event-pattern "{\"source\": [\"aws.health\"],\"detail-type\": [\"AWS Health Event\"]}"
--event-pattern "{\"source\": [\"aws.health\"],\"detail-type\": [\"AWS Health Event\"],\"detail\": {\"service\": [\"EC2\"],\"eventTypeCategory\": [\"scheduledChange\"]}}"
$ aws events put-targets --rule MyK8sScheduledChangeRule \
--targets "Id"="1","Arn"="arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
Expand Down
4 changes: 2 additions & 2 deletions pkg/monitor/sqsevent/scheduled-change-event.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ func (m SQSMonitor) scheduledEventToInterruptionEvents(event *EventBridgeEvent,
}

if scheduledChangeEventDetail.Service != "EC2" {
err := fmt.Errorf("events from Amazon EventBridge for service (%s) are not supported", scheduledChangeEventDetail.Service)
err := skip{fmt.Errorf("events from Amazon EventBridge for service (%s) are not supported", scheduledChangeEventDetail.Service)}
return append(interruptionEventWrappers, InterruptionEventWrapper{nil, err})
}

if scheduledChangeEventDetail.EventTypeCategory != "scheduledChange" {
err := fmt.Errorf("events from Amazon EventBridge with EventTypeCategory (%s) are not supported", scheduledChangeEventDetail.EventTypeCategory)
err := skip{fmt.Errorf("events from Amazon EventBridge with EventTypeCategory (%s) are not supported", scheduledChangeEventDetail.EventTypeCategory)}
return append(interruptionEventWrappers, InterruptionEventWrapper{nil, err})
}

Expand Down

0 comments on commit 3298246

Please sign in to comment.