Description
Is your feature request related to a problem?
In case 'Find' api is not available for a resource, I see that code-generator returns return nil, ackerr.NotImplemented
in sdkFind() function. There doesn't seem to be a way to write custom find
function.
I see that there is custom function available for update method using update_operation tag in generator.yaml. But I dont see find_operation tag where we can specify custom function for find operation.
As an example, there is not find method available for https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateNetworkAclEntry.html
But I can write custom code using https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeNetworkAcls.html and extract network_acl_entries
from network_acl
.
But I don't see an easy way to add this custom find function
Describe the solution you'd like
The solution would allow us to implement custom find
function. The name could be written in generator.yaml
as find_operation: <name-of-function>
similar to update_operation
. And generated code for sdkFind()
would call this custom find function. The find function itself could be written in hooks.go.
Describe alternatives you've considered
My first try was to use hooks (sdk_read_one_pre_build_request, sdk_read_many_pre_build_request, etc) to get around this problem. But when find
function is not available, then find
related hooks are not effective. Because code-generator takes templates/pkg/resource/sdk_find_not_implemented.go.tpl
path (where hooks logic is not available), instead of templates/pkg/resource/sdk_find_read_many.go.tpl
, where hooks logic is available.