Description
The ACK code-generator currently has the capability to generate resource output setters - which essentially translate API responses into CRD spec/status fields. And vice-versa CRD spec/status into API requests.
However, the code generator is only targeting fields that are "naturally" inferred from the operations input/output shapes.. and it is currently unable to generate the same code for custom fields that are injected into the CRD spec/status. Ideally, we need to implement this feature to reduce the amount of custom hooks in ReadOne/Create/Update sdk paths.
Note that we can have two different fields (one naturally inferred and one custom field) that needs to be set from the same API response. Typically, one of them is in the status and the other is in the spec. Only the spec fields should be used to set the API request.
Code hints:
- The logic that injects custom fields: https://github.com/aws-controllers-k8s/code-generator/blob/main/pkg/model/model.go#L139-L211
- The logic that generate resource setters from API response: https://github.com/aws-controllers-k8s/code-generator/blob/main/pkg/generate/code/set_resource.go#L158-L161
- The logic that generate SDK request from CRD fields: https://github.com/aws-controllers-k8s/code-generator/blob/main/pkg/generate/code/set_sdk.go#L179-L398