-
Couldn't load subscription status.
- Fork 271
Description
Is your feature request related to a problem?
I am unable to generate Instance CRD for ec2-controller because code-generator cannot unwrap the list responses from RunInstances and DescribeInstances, the Create and List operations, respectively.
RunInstances is a "create many" call in that a single request can create multiple instances. As a result, the output shape returns a list of Instances (within a Reservation struct). Similarly, DescribeInstances returns a list of Reservations each containing a list of Instances.
The Instance CRD implementation will only allow requesting/creating a single instance at a time; therefore, we only want the first instance in the RunInstances output shape, Reservation.Instances[0], and the first instance of the first reservation in the DescribeInstances output shape, Reservations[0].Instances[0].
Describe the solution you'd like
Extend the functionality of output_wrapper_field_path config to support type "list" (only supports struct today). Unwrapping a list element will always take the first element.
Desired generator.yaml for Instance:
RunInstances:
output_wrapper_field_path: Reservation.Instances
operation_type:
- Create
resource_name: Instance
DescribeInstances:
output_wrapper_field_path: Reservations.Instances
operation_type:
- List
resource_name: Instance
- refactor
setResourceReadManytosetListResource(or something similar) and use this function forReadManyand unwrapping list elements.
Describe alternatives you've considered
- map
RunInstancestoCreateBatchoperation and create asetResourceCreateMany()