I would like to make a proposal based on the results (on successful calls) written below, which has been got using only one of the methods of the AWSReader implementation, specifically the GetInstances
Using one only wildcard for specifying the regions "eu-*" which resolves 4 regions for now if the AWS return 0 results on all the regions, the list of instances received ([]*ec2.DescribeInstancesOutput) is
[{
} {
} {
} {
}]
which is 4 elements on such array, which are the number of regions which has been requested and on another call which return results, you get something like this (some data has been removed by placeholders)
My proposal will be to return a map of such types rather than a slice, where each key of the slice is the region, other possibility would be to have a custom type which allow to retrieve the results for each type, although we may reduce the map allocations, I don't think that we could improve a lot the performance and probably we won't improve it at the first instance, so a map, looks the simplest and easiest approach.
Having this replacement, it will be possible to know to which region the resources information pertains, otherwise, it isn't possible to figure out to which region the pertains.
A further improvement, but I would need to do a deeper analysis on each returned type, if if we could simplify some results, for example in the shown function call, the Reservations filed which contains values of the Reservation type, looks that only the Instances filed will be filled, so we could move them one level up and remove the Reservation type.
Although the goal of the library is
I would like to make a proposal based on the results (on successful calls) written below, which has been got using only one of the methods of the AWSReader implementation, specifically the
GetInstances
Using one only wildcard for specifying the regions
"eu-*"
which resolves 4 regions for now if the AWS return 0 results on all the regions, the list of instances received ([]*ec2.DescribeInstancesOutput) iswhich is 4 elements on such array, which are the number of regions which has been requested and on another call which return results, you get something like this (some data has been removed by placeholders)
My proposal will be to return a map of such types rather than a slice, where each key of the slice is the
region
, other possibility would be to have a custom type which allow to retrieve the results for each type, although we may reduce the map allocations, I don't think that we could improve a lot the performance and probably we won't improve it at the first instance, so a map, looks the simplest and easiest approach.Having this replacement, it will be possible to know to which region the resources information pertains, otherwise, it isn't possible to figure out to which region the pertains.
A further improvement, but I would need to do a deeper analysis on each returned type, if if we could simplify some results, for example in the shown function call, the
Reservations
filed which contains values of the Reservation type, looks that only theInstances
filed will be filled, so we could move them one level up and remove the Reservation type.What do you think?