-
Notifications
You must be signed in to change notification settings - Fork 211
Adding functionality to assign one API to multiple resources #472
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
Adding functionality to assign one API to multiple resources #472
Conversation
Skipping CI for Draft Pull Request. |
/test apigatewayv2-controller-test |
pkg/model/sdk_api.go
Outdated
@@ -98,16 +100,18 @@ func (a *SDKAPI) GetOperationMap(cfg *ackgenconfig.Config) *OperationMap { | |||
// | |||
// see: https://github.com/aws-controllers-k8s/community/issues/1555 | |||
for opID, opCfg := range cfg.Operations { | |||
if opCfg.ResourceName == "" { | |||
if opCfg.ResourceName == nil { |
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.
opCfg.Resource
is of type string
, you can't compare to a nil pointer
/retest |
Co-authored-by: Vandita Patidar <[email protected]> Signed-off-by: Amine Hilaly <[email protected]>
ee94982
to
dd3c3f1
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Vandita2020 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
// The existance of the operation in the config file is not enough to | ||
// override the operation type and/or resource name. The operation type | ||
// and/or resource name must be specified in the config file. | ||
if !exists || len(opConfig.ResourceName) == 0 || len(opConfig.OperationType) == 0 { | ||
return []OpType{opType}, []string{resName} | ||
} |
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.
@Vandita2020 You approach is correct, we only missed this last bits of code ^. When a user provides an Operation configuration without ResourceName
nor OperationType
directives - this block doesn't get called. Causing the opTypes list to reset (L378)
/retest |
Fixes #1917
Description:
The PR adds functionality to use same API for an operation on multiple resources. This allows
ResourceName
to be a list so that same API for anOperationType
can map to multiple resources. This is required in certain cases where the same API, for same operation is used for multiple resources.The solution this PR applies is to pass multiple resources for same API.
This supports following cases cases:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.