Skip to content

Conversation

@MakotoNaruse
Copy link
Contributor

@MakotoNaruse MakotoNaruse commented May 8, 2023

Summary

SSIA

The implementation is almost same as waf one

func resolveWafRuleGroupRuleIds(ctx context.Context, meta schema.ClientMeta, resource *schema.Resource, c schema.Column) error {
ruleGroup := resource.Item.(*types.RuleGroup)
// Resolves rule group rules
cl := meta.(*client.Client)
service := cl.Services().Waf
listActivatedRulesConfig := waf.ListActivatedRulesInRuleGroupInput{RuleGroupId: ruleGroup.RuleGroupId}
var ruleIDs []string
for {
rules, err := service.ListActivatedRulesInRuleGroup(ctx, &listActivatedRulesConfig, func(o *waf.Options) {
o.Region = cl.Region
})
if err != nil {
return err
}
for _, rule := range rules.ActivatedRules {
ruleIDs = append(ruleIDs, aws.ToString(rule.RuleId))
}
if aws.ToString(rules.NextMarker) == "" {
break
}
listActivatedRulesConfig.NextMarker = rules.NextMarker
}
return resource.Set("rule_ids", ruleIDs)
}

Checklist

  • Read the contribution guidelines 🧑‍🎓
  • Run make lint to ensure the proposed changes follow the coding style 🚨 (install golangci-lint here)
  • Run make test to ensure the proposed changes pass the tests 🧪
  • If changing a source plugin run make gen to ensure docs are up to date 📝
  • Ensure the status checks below are successful ✅

@cq-bot cq-bot added aws labels May 8, 2023
@github-actions
Copy link

github-actions bot commented May 8, 2023

This PR has the following changes to source plugin(s) tables:

  • Table aws_wafregional_rule_groups: column added with name rule_ids and type StringArray

Copy link
Member

@hermanschaaf hermanschaaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @MakotoNaruse !

@hermanschaaf hermanschaaf added the automerge Automatically merge once required checks pass label May 8, 2023
@kodiakhq kodiakhq bot merged commit 4637baa into cloudquery:main May 8, 2023
@hermanschaaf
Copy link
Member

FYI this should be released tomorrow as part of the next version of the AWS source plugin, v17.2.0.

kodiakhq bot pushed a commit that referenced this pull request May 9, 2023
🤖 I have created a release *beep* *boop*
---


## [17.2.0](plugins-source-aws-v17.1.0...plugins-source-aws-v17.2.0) (2023-05-09)


### This Release has the Following Changes to Tables
- Table `aws_config_configuration_aggregators` was added
- Table `aws_config_remediation_configurations` was added
- Table `aws_config_retention_configurations` was added
- Table `aws_networkfirewall_firewall_policies` was added
- Table `aws_networkfirewall_rule_groups` was added
- Table `aws_securityhub_enabled_standards` was added
- Table `aws_securityhub_hubs` was added
- Table `aws_wafregional_rule_groups`: column added with name `rule_ids` and type `StringArray`

### Features

* **aws-services:** Support newly added regions ([#10598](#10598)) ([e56bae2](e56bae2))
* **aws:** Add `aws_securityhub_hubs` and `aws_securityhub_enabled_standards` tables ([#10553](#10553)) ([bc77f53](bc77f53)), closes [#1592](#1592)
* **aws:** Add networkfirewall resources ([#10547](#10547)) ([74ada09](74ada09))
* **aws:** Add rule_ids to wafregional rule_group ([#10594](#10594)) ([4637baa](4637baa))
* **aws:** Refine AWS Org Error Message ([#10569](#10569)) ([b761ebc](b761ebc))
* More AWS Config resources ([#10509](#10509)) ([3db4ebb](3db4ebb))


### Bug Fixes

* **aws-policies:** Api Gateway xray tracing enabled query ([#10597](#10597)) ([341d849](341d849))
* **aws:** Use GetBucketLocation for S3 bucket region ([#10550](#10550)) ([7f0128f](7f0128f)), closes [#10548](#10548)
* **deps:** Update module github.com/aws/aws-sdk-go-v2/config to v1.18.23 ([#10576](#10576)) ([eeb13d5](eeb13d5))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/internal/v4a to v1.0.25 ([#10585](#10585)) ([00d7449](00d7449))
* **deps:** Update module github.com/aws/aws-sdk-go-v2/service/accessanalyzer to v1.19.12 ([#10586](#10586)) ([4f929fe](4f929fe))
* Remove unused line in mockassert library ([#10608](#10608)) ([3fc8708](3fc8708))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants