Skip to content

Commit

Permalink
Adding code to OOTB support AWS Eventbridge generated events for S3 c…
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Bischoff committed Jun 25, 2024
1 parent a4f82b1 commit e82a2ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions metricbeat/include/list_init.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions x-pack/filebeat/input/awss3/sqs_s3_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (e *nonRetryableError) Error() string {
}

func (e *nonRetryableError) Is(err error) bool {
_, ok := err.(*nonRetryableError) //nolint:errorlint // This is not used directly to detected wrapped errors (errors.Is handles unwrapping).
_, ok := err.(*nonRetryableError) // This is not used directly to detected wrapped errors (errors.Is handles unwrapping).
return ok
}

Expand Down Expand Up @@ -309,8 +309,8 @@ func (p *sqsS3EventProcessor) getS3Notifications(body string) ([]s3EventV2, erro
}

func convertEventBridge(eventBridgeEvents *eventBridgeEvents, s3Events *s3EventsV2) {
for _, message := range eventBridgeEvents.Messages {
s3Events.Records = append(s3Events.Records, convertEventBridgeEvent(&message))
for i := range eventBridgeEvents.Messages {
s3Events.Records = append(s3Events.Records, convertEventBridgeEvent(&eventBridgeEvents.Messages[i]))
}
}

Expand All @@ -326,7 +326,6 @@ func convertEventBridgeEvent(message *eventBridgeEvent) s3EventV2 {
}
event.SetS3BucketName(message.Detail.Bucket.Name)
event.SetS3ObjectKey(message.Detail.Object.Key)
event.SetProvider("aws:s3") //TODO
return event
}

Expand Down
2 changes: 2 additions & 0 deletions x-pack/filebeat/input/awss3/sqs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"testing"
"time"

"github.com/aws/aws-sdk-go/service/sqs"

Check failure on line 16 in x-pack/filebeat/input/awss3/sqs_test.go

View workflow job for this annotation

GitHub Actions / lint (darwin)

`sqs` redeclared in this block (typecheck)

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
"github.com/gofrs/uuid"
Expand Down

0 comments on commit e82a2ca

Please sign in to comment.