-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Category
User level API changes
Describe the feature you'd like to request
Currently we have two APIs for getting information from a template-linked api::Policy:
template_id()returnsSome(tid)if the policy is template-linked, wheretidis the ID of the templatetemplate_links()(added by API for extracting values from template-linked policy #515) returnsSome(vals)if the policy is template-linked, wherevalsare the values linked into the template's slots.
An invariant is that if template_id() returns Some(_) then template_links() should return Some(_) as well. Client code still has to deal with the possibility of failure, though, by using expect() on the second call. They could avoid that step if template_links() returned both tid and vals.
Changing the API to do this would be a breaking change, but not for any released version of Cedar.
Describe alternatives you've considered
One alternative would be to add a third API, e.g., template_id_and_links that returns both. But that would only be useful if we imagined scenarios in which you'd want to know the links but not know the template ID. I can't think of reasonable (non corner-case) scenarios for that.
Another alternative would be to do nothing, and ask the client to use expect() as discussed above.
Additional context
No response
Is this something that you'd be interested in working on?
- 👋 I may be able to implement this feature request
-
⚠️ This feature might incur a breaking change