community
community copied to clipboard
Allow configuration of `SetManyOutputNotFoundErrReturn` per Operation
Is your feature request related to a problem?
Now that the setResourceReadMany
function has been set to pull double duty when passed a Create
operation with a list element as the output (in https://github.com/aws-controllers-k8s/code-generator/pull/337) there can arise problems from the return value within the loop. Create and Describe operations can be used in different places in Go code (the templates for Crossplane generation specifically) that expect different return types (e.g. the number of returned objects).
Describe the solution you'd like
I think it would make sense and not be particularly difficult to implement adding an additional config to apply SetManyOutputNotFoundErrReturn
options from the Operations configs.
I'm Imagining something like this:
operations:
CreateLoadBalancer:
operation_type:
- Create
output_wrapper_field_path: LoadBalancers
set_many_output_notfound_err_return: return nil, errors.New(errNotFound)
Describe alternatives you've considered Other than setting the top level option to something no-op (e.g. setting to something like "_ = found"), I don't think there's really much of a workaround here.
@EdgeJ As I noted in comments in the https://github.com/aws-controllers-k8s/code-generator/pull/337 review, the code for SetResourceReadyMany
is getting really ugly and messy. I think the longer-term solution there is to have two separate Go code-generating functions, one for the "find-a-specific-resource-in-a-list-of-resources" problem and another function that actually sets values on the resource that is returned from the first function. This second function should probably just be the "normal" SetResource
function implementation that assumes a single resource object and sets field values on it.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle rotten
/remove-lifecycle rotten
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
/lifecycle frozen