-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow nested statements by overwriting their types with string
#15
Conversation
type Statement interface { | ||
svcsdk.Statement | svcsdk.AndStatement | svcsdk.OrStatement | svcsdk.NotStatement | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is 🔥
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 | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TiberiuGC: The following test failed, say
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TiberiuGC !
/lgtm
[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 |
@TiberiuGC can we have a v0.0.3 release please? |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.