Task Description: Implement the ParseNotification function in Go
Create a function named ParseNotification located in the /app/ directory that takes a string as input representing a notification and returns a slice of pointers to S3ObjectInfo and an error. The function should handle the following cases based on the various example notifications provided in the test cases:
For AWS CloudTrail notifications and S3 event notifications, extract the s3Bucket and s3ObjectKey fields and return a slice of *S3ObjectInfo objects. Each object should be populated with the respective bucket name and object key extracted from the notification.
If the notification represents a test event or a validation message (as shown in the test cases for TestParseTestS3Notification and TestParseCloudTrailValidationMessage), return an empty slice of *S3ObjectInfo with a nil error.
If the notification is in an unknown format (as indicated in the TestParseUnknownMessage test case), return an error.
The function should adhere to the structure of the S3ObjectInfo type which is expected to be defined as follows:
go
type S3ObjectInfo struct {
S3Bucket string
S3ObjectKey string
}
Requirements for function implementation:
Parse JSON notifications using encoding/json package.
Handle each notification type correctly as per the examples in the test code.
Return a properly formatted error message if an unknown notification type is encountered.
Ensure that the function passes all provided unit tests.
Implementing this functionality will ensure that the ParseNotification function meets the expected behavior as validated by the test cases.
Important: declare your solution in package sources (the test file uses package sources, so the implementation must use the matching package name).