forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix aws-s3 config initialization plus cleanup (elastic#25763)
The bug was that the FileSelectorCfg values were not being initialized to their defaults prior to config `Unpack`. This caused previously working configs to fail because the new options recently added were uninitialized. This fixes the issue by implementing the ucfg Initializer interface (https://pkg.go.dev/github.com/elastic/go-ucfg#Initializer) to ensure defaults are set. Other changes: - Refactoring the config to have a `readerConfig` struct that contained all the S3 object processing options since they were defined in several structs. - Replaced `int`s used to represent byte sizes with `cfgtype.ByteSize` so that users can write values like `10 MiB` for convenience. - Changed the validation logic to check that api_timeout and visibility_timeout are > 0. Previously they accepted 0. - Changed the config structs to use `*match.Matcher` instead of manually initializing and validating regexp values. match.Matcher implements the ucfg interface so there is less work to do here. - Added tests to cover all of the config validation logic.
- Loading branch information
1 parent
053b582
commit 5233fb0
Showing
6 changed files
with
272 additions
and
123 deletions.
There are no files selected for viewing
This file contains 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 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 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
Oops, something went wrong.