From 9bb82d88b96454da1639fbdb683aaf183adddd1b Mon Sep 17 00:00:00 2001 From: Jerad C Date: Tue, 13 Dec 2022 09:53:18 -0600 Subject: [PATCH] remove event schema version checks --- pkg/event/asgterminate/v1/parser.go | 3 +-- pkg/event/asgterminate/v2/parser.go | 3 +-- pkg/event/rebalancerecommendation/v0/parser.go | 3 +-- pkg/event/scheduledchange/v1/parser.go | 3 +-- pkg/event/spotinterruption/v1/parser.go | 3 +-- pkg/event/statechange/v1/parser.go | 3 +-- resources/queue-infrastructure.yaml | 11 ----------- 7 files changed, 6 insertions(+), 23 deletions(-) diff --git a/pkg/event/asgterminate/v1/parser.go b/pkg/event/asgterminate/v1/parser.go index e749cefd..9faf8f37 100644 --- a/pkg/event/asgterminate/v1/parser.go +++ b/pkg/event/asgterminate/v1/parser.go @@ -27,7 +27,6 @@ import ( const ( source = "aws.autoscaling" detailType = "EC2 Instance-terminate Lifecycle Action" - version = "1" acceptedTransition = "autoscaling:EC2_INSTANCE_TERMINATING" ) @@ -48,7 +47,7 @@ func (p Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/pkg/event/asgterminate/v2/parser.go b/pkg/event/asgterminate/v2/parser.go index a810d4da..3e06a54d 100644 --- a/pkg/event/asgterminate/v2/parser.go +++ b/pkg/event/asgterminate/v2/parser.go @@ -27,7 +27,6 @@ import ( const ( source = "aws.autoscaling" detailType = "EC2 Instance-terminate Lifecycle Action" - version = "2" acceptedTransition = "autoscaling:EC2_INSTANCE_TERMINATING" ) @@ -48,7 +47,7 @@ func (p Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/pkg/event/rebalancerecommendation/v0/parser.go b/pkg/event/rebalancerecommendation/v0/parser.go index 52511d43..fb2ca84f 100644 --- a/pkg/event/rebalancerecommendation/v0/parser.go +++ b/pkg/event/rebalancerecommendation/v0/parser.go @@ -27,7 +27,6 @@ import ( const ( source = "aws.ec2" detailType = "EC2 Instance Rebalance Recommendation" - version = "0" ) type Parser struct{} @@ -43,7 +42,7 @@ func (Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/pkg/event/scheduledchange/v1/parser.go b/pkg/event/scheduledchange/v1/parser.go index 88d8a388..1b5b3bcb 100644 --- a/pkg/event/scheduledchange/v1/parser.go +++ b/pkg/event/scheduledchange/v1/parser.go @@ -27,7 +27,6 @@ import ( const ( source = "aws.health" detailType = "AWS Health Event" - version = "1" acceptedService = "EC2" acceptedEventTypeCategory = "scheduledChange" ) @@ -45,7 +44,7 @@ func (Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/pkg/event/spotinterruption/v1/parser.go b/pkg/event/spotinterruption/v1/parser.go index b1567770..dea6759e 100644 --- a/pkg/event/spotinterruption/v1/parser.go +++ b/pkg/event/spotinterruption/v1/parser.go @@ -27,7 +27,6 @@ import ( const ( source = "aws.ec2" detailType = "EC2 Spot Instance Interruption Warning" - version = "1" ) type Parser struct{} @@ -43,7 +42,7 @@ func (Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/pkg/event/statechange/v1/parser.go b/pkg/event/statechange/v1/parser.go index 2bac7578..6765857d 100644 --- a/pkg/event/statechange/v1/parser.go +++ b/pkg/event/statechange/v1/parser.go @@ -28,7 +28,6 @@ import ( const ( source = "aws.ec2" detailType = "EC2 Instance State-change Notification" - version = "1" acceptedStates = "stopping,stopped,shutting-down,terminated" ) @@ -47,7 +46,7 @@ func (Parser) Parse(ctx context.Context, str string) terminator.Event { return nil } - if evt.Source != source || evt.DetailType != detailType || evt.Version != version { + if evt.Source != source || evt.DetailType != detailType { return nil } diff --git a/resources/queue-infrastructure.yaml b/resources/queue-infrastructure.yaml index ed6c26d8..76957c7d 100644 --- a/resources/queue-infrastructure.yaml +++ b/resources/queue-infrastructure.yaml @@ -39,9 +39,6 @@ Resources: - aws.autoscaling detail-type: - EC2 Instance-terminate Lifecycle Action - version: - - "1" - - "2" detail: LifecycleTransition: - "autoscaling:EC2_INSTANCE_TERMINATING" @@ -60,8 +57,6 @@ Resources: - aws.ec2 detail-type: - EC2 Instance Rebalance Recommendation - version: - - "0" State: ENABLED Targets: - Id: !GetAtt Queue.QueueName @@ -77,8 +72,6 @@ Resources: - aws.health detail-type: - AWS Health Event - version: - - "1" detail: source: - EC2 @@ -99,8 +92,6 @@ Resources: - aws.ec2 detail-type: - EC2 Spot Instance Interruption Warning - version: - - "1" State: ENABLED Targets: - Id: !GetAtt Queue.QueueName @@ -116,8 +107,6 @@ Resources: - aws.ec2 detail-type: - EC2 Instance State-change Notification - version: - - "1" detail: state: - stopping