Skip to content

Commit

Permalink
⭐️ Added support for advanced selector (aws) (#3441)
Browse files Browse the repository at this point in the history
* added support for advanced selector, but it still does not show any results

Signed-off-by: Hossein Rouhani <[email protected]>

* Improved

Signed-off-by: Hossein Rouhani <[email protected]>

---------

Signed-off-by: Hossein Rouhani <[email protected]>
  • Loading branch information
HRouhani authored Mar 5, 2024
1 parent e13f4f2 commit ff1c0bf
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions providers/aws/resources/aws_cloudtrail.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,31 @@ func (a *mqlAwsCloudtrailTrail) eventSelectors() ([]interface{}, error) {

arnValue := a.Arn.Data
// no pagination required
trailmgmtevents, err := svc.GetEventSelectors(ctx, &cloudtrail.GetEventSelectorsInput{
eventSelectorsOutput, err := svc.GetEventSelectors(ctx, &cloudtrail.GetEventSelectorsInput{
TrailName: &arnValue,
})
if err != nil {
return nil, err
}
return convert.JsonToDictSlice(trailmgmtevents.EventSelectors)

// Basic event selectors
basicSelectors, err := convert.JsonToDictSlice(eventSelectorsOutput.EventSelectors)
if err != nil {
return nil, err
}

allSelectors := basicSelectors

// Advanced event selectors if they exist
if len(eventSelectorsOutput.AdvancedEventSelectors) > 0 {
advancedSelectors, err := convert.JsonToDictSlice(eventSelectorsOutput.AdvancedEventSelectors)
if err != nil {
return nil, err
}

// Basic plus advanced event selectors
allSelectors = append(basicSelectors, advancedSelectors...)
}

return allSelectors, nil
}

0 comments on commit ff1c0bf

Please sign in to comment.