Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nested statements by overwriting their types with string #15

Merged

Conversation

TiberiuGC
Copy link
Member

Issue #, if available:

Description of changes:

      statement:
        andStatement: |
          statements:
            - labelMatchStatement:
                scope: "RULE_SET"
                key: "aws:UserAgent"
                value: "Mozilla"
            - ipSetReferenceStatement:
                arn: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested a review from a-hilaly September 6, 2024 11:25
Comment on lines +10 to +12
type Statement interface {
svcsdk.Statement | svcsdk.AndStatement | svcsdk.OrStatement | svcsdk.NotStatement
}
Copy link
Member

Choose a reason for hiding this comment

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

This is 🔥

Comment on lines 5 to 36
if rule.Statement != nil {
if rule.Statement.AndStatement != nil {
ko.Spec.Rules[i].Statement.AndStatement, err = statementToString(rule.Statement.AndStatement)
if err != nil {
return nil, err
}
}
if rule.Statement.OrStatement != nil {
ko.Spec.Rules[i].Statement.OrStatement, err = statementToString(rule.Statement.OrStatement)
if err != nil {
return nil, err
}
}
if rule.Statement.NotStatement != nil {
ko.Spec.Rules[i].Statement.NotStatement, err = statementToString(rule.Statement.NotStatement)
if err != nil {
return nil, err
}
}
if rule.Statement.ManagedRuleGroupStatement != nil && rule.Statement.ManagedRuleGroupStatement.ScopeDownStatement != nil {
ko.Spec.Rules[i].Statement.ManagedRuleGroupStatement.ScopeDownStatement, err = statementToString(rule.Statement.ManagedRuleGroupStatement.ScopeDownStatement)
if err != nil {
return nil, err
}
}
if rule.Statement.RateBasedStatement != nil && rule.Statement.RateBasedStatement.ScopeDownStatement != nil {
ko.Spec.Rules[i].Statement.RateBasedStatement.ScopeDownStatement, err = statementToString(rule.Statement.RateBasedStatement.ScopeDownStatement)
if err != nil {
return nil, err
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I have one or two suggestions here:
1/ We can move these to hooks.go
2/ I'm thinking that we can generate these functions using sdk_file_end hooks :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

ack-prow bot commented Sep 9, 2024

@TiberiuGC: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
wafv2-verify-attribution 8379caa link false /test wafv2-verify-attribution

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Thanks @TiberiuGC !
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2024
Copy link

ack-prow bot commented Sep 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, TiberiuGC

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot added the approved label Sep 10, 2024
@ack-prow ack-prow bot merged commit 8eecb5e into aws-controllers-k8s:main Sep 10, 2024
5 of 7 checks passed
@a-hilaly
Copy link
Member

@TiberiuGC can we have a v0.0.3 release please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants