Skip to content
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

Add convenience methods for the number of the Policies and Templates in a PolicySet #1179

Closed
1 of 2 tasks
jv-garcia opened this issue Sep 6, 2024 · 1 comment
Closed
1 of 2 tasks
Labels
feature-request This issue requets a substantial new feature

Comments

@jv-garcia
Copy link
Contributor

Category

User level API features/changes

Describe the feature you'd like to request

Hey Cedar team,

My use case involves loading policies from a database and creating a cedar_policy::PolicySet with those. I'd like to introduce some assertions/safety checks so that I can make sure that the number of policies that I have in the policy set equals the amount of policies that I loaded.

To do this I suggest we add cedar_policy::PolicySet::num_of_policies() -> usize (happy to chat about the name, of course), and similar for templates. These methods would be simple proxies for the HashMap::len().

Describe alternatives you've considered

This is possible today using the provided iterators (like here), but doing that requires consuming the iterator. A call to theHashMap's len() would be more efficient.

Additional context

I'm still using 2.4.x, so I need to to backport to that version.

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
@jv-garcia jv-garcia added feature-request This issue requets a substantial new feature pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Sep 6, 2024
jv-garcia pushed a commit to jv-garcia/cedar that referenced this issue Sep 6, 2024
jv-garcia pushed a commit to jv-garcia/cedar that referenced this issue Sep 6, 2024
…cy set has

cedar-policy#1179
Signed-off-by: Juan Vicente Garcia Orozco <juano@amazon.com>
jv-garcia pushed a commit to jv-garcia/cedar that referenced this issue Sep 6, 2024
…cy set has

cedar-policy#1179
Signed-off-by: Juan Vicente Garcia Orozco <juano@amazon.com>
@shaobo-he-aws shaobo-he-aws added work-in-progress and removed pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Sep 10, 2024
@khieta
Copy link
Contributor

khieta commented Sep 16, 2024

Resolved by #1180, which was included in the 2.5.0 and 3.4.0 releases.

@khieta khieta closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requets a substantial new feature
Projects
None yet
Development

No branches or pull requests

3 participants