-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate ResourceValue to ResourceIr to add metadata #25
Conversation
Resources in intermediate representation was the last holdover to a working program without manual manipulation of typescript. This change adds "Complexity", a concept to help translate CDK interfaces appropriately for L1s, and adds this decoration to ResourceIr. This change also adds a few other bells and whistles along the way while debugging final output (like AWS::AccountId)
let spec = spec(); | ||
let mut resource_instructions = Vec::new(); | ||
for resource in parse_tree.resources.resources.iter() { | ||
let resource_spec = spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This is more of an optimization question. Does this need to be done for every iteration? Can we save resource_spec after the first time we see the type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused, as each resource is more than likely unique, and the lookup is O(1) already (as it's backed by a hashmap in spec).
let opt = match property_rule.get_complexity() { | ||
Complexity::Simple(_) => Option::None, | ||
Complexity::Complex(x) => { | ||
let mut ret = | ||
format!("{}.{}", resource_translator.resource_type, x); | ||
if x == "Tag" { | ||
ret = "Tag".to_string(); | ||
} | ||
Option::Some(ret) | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth moving to its own method since it's re-used in two places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I'ma push so we got a working application but will then update to clean this up.
Resources in intermediate representation was the last holdover
to a working program without manual manipulation of typescript.
This change adds "Complexity", a concept to help translate CDK
interfaces appropriately for L1s, and adds this decoration to
ResourceIr. This change also adds a few other bells and whistles
along the way while debugging final output (like AWS::AccountId)