Keep AccountTypeDef to avoid DescribeAccount calls #39
+75
−94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this design I haven't eliminated the use of DescribeAccount completely. It may still be needed to fill in the details for IDs captured via target_ids. But now all the organizations API calls are in the CoveHostAccount class, where they make most sense, and the active_cove_session function concerns itself only with assuming the role in the target account.
I've marked this as a draft because there's two things I'm unhappy with.
It seems to have introduced a memory leak. I may need to dig out the old test code from #20 to confirm that with more rigor.
The change of the internal structure from a list of IDs to a dict of IDs to AccountTypeDefs means the elegant hack used in #37 to repeat a single target account to simulate a big org doesn't work any more. I think the testing in #20 used the same technique, so I'll need to find another way to support that.
Any thoughts on how to solve these problems?