Support deleting keys by key_alias (#7552)

* feat(key_management_endpoints.py): allow deleting keys based on key alias

easier for proxy admin to delete known bad key

* fix(key_management_event_hooks.py): fix linting error

* docs(key_management_endpoints.py): document new key_aliases param

* fix(key_management_endpoints.py): return deleted keys to user

fixes return when passing key aliases
This commit is contained in:
Krish Dholakia 2025-01-04 19:41:48 -08:00 committed by GitHub
parent ce97e7e054
commit 34a9833b85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 72 additions and 26 deletions

View file

@ -142,7 +142,7 @@ class KeyManagementEventHooks:
# Enterprise Feature - Audit Logging. Enable with litellm.store_audit_logs = True
# we do this after the first for loop, since first for loop is for validation. we only want this inserted after validation passes
if litellm.store_audit_logs is True:
if litellm.store_audit_logs is True and data.keys is not None:
# make an audit log for each team deleted
for key in data.keys:
key_row = await prisma_client.get_data( # type: ignore