Skip to content

Commit

Permalink
Move logic to awss3 input
Browse files Browse the repository at this point in the history
  • Loading branch information
bhapas committed Aug 7, 2023
1 parent 892904b commit 5b37d6f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ automatic splitting at root level, if root level element is an array. {pull}3415
- Add support for localstack based input integration testing {pull}35727[35727]
- Allow parsing bytes in and bytes out as long integer in CEF processor. {issue}36100[36100] {pull}36108[36108]
- Add support for registered owners and users to AzureAD entity analytics provider. {pull}36092[36092]
- Add support for endpoint resolver in AWS config {pull}36208[36208]

*Auditbeat*

*Libbeat*
- Add support for endpoint resolver in AWS config {pull}36208[36208]

*Heartbeat*
- Added status to monitor run log report.
Expand Down
11 changes: 11 additions & 0 deletions x-pack/filebeat/input/awss3/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ type s3Input struct {

func newInput(config config, store beater.StateStore) (*s3Input, error) {
awsConfig, err := awscommon.InitializeAWSConfig(config.AWSConfig)

if config.AWSConfig.Endpoint != "" {
// Add a custom endpointResolver to the awsConfig so that all the requests are routed to this endpoint
awsConfig.EndpointResolverWithOptions = awssdk.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (awssdk.Endpoint, error) {
return awssdk.Endpoint{
URL: config.AWSConfig.Endpoint,
SigningRegion: awsConfig.Region,
}, nil
})
}

if err != nil {
return nil, fmt.Errorf("failed to initialize AWS credentials: %w", err)
}
Expand Down
11 changes: 0 additions & 11 deletions x-pack/libbeat/common/aws/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@ func InitializeAWSConfig(beatsConfig ConfigAWS) (awssdk.Config, error) {
}
}

if beatsConfig.Endpoint != "" {
// Add a custom endpointResolver to the awsConfig so that all the requests are routed to this endpoint
awsConfig.EndpointResolverWithOptions = awssdk.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (awssdk.Endpoint, error) {
return awssdk.Endpoint{
PartitionID: "aws",
URL: beatsConfig.Endpoint,
SigningRegion: awsConfig.Region,
}, nil
})
}

// Assume IAM role if iam_role config parameter is given
if beatsConfig.RoleArn != "" {
addAssumeRoleProviderToAwsConfig(beatsConfig, &awsConfig)
Expand Down

0 comments on commit 5b37d6f

Please sign in to comment.