Skip to content

Commit

Permalink
Add policy summary endpoint (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaherne-duo authored Aug 2, 2023
1 parent 02ed594 commit e04dec1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions duo_client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,16 @@ def get_policy_v2(self, policy_key):
path = "/admin/v2/policies/" + self._quote_policy_id(policy_key)
response = self.json_api_call("GET", path, {})
return response

def get_policy_summary_v2(self):
"""
Returns (dict) - summary of all policies and the applications
and groups to which they are applied.
"""

path = "/admin/v2/policies/summary"
response = self.json_api_call("GET", path, {})
return response


class AccountAdmin(Admin):
Expand Down
7 changes: 7 additions & 0 deletions tests/admin/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,10 @@ def test_get_policies_v2_iterator(self):
self.assertDictEqual(
util.params_to_dict(args), {"limit": ["100"], "offset": ["0"]}
)

def test_get_policy_summary(self):
response = self.client.get_policy_summary_v2()
uri, _ = response["uri"].split("?")

self.assertEqual(response["method"], "GET")
self.assertEqual(uri, "/admin/v2/policies/summary")

0 comments on commit e04dec1

Please sign in to comment.