mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
fix(terraform): omit empty key team updates
This commit is contained in:
parent
168a0055a2
commit
9ed1ca3399
2 changed files with 4 additions and 2 deletions
|
|
@ -79,7 +79,6 @@ func (c *Client) UpdateKey(key *Key) (*Key, error) {
|
|||
// Create a new map with only the fields that can be updated
|
||||
updateData := map[string]interface{}{
|
||||
"key": key.Key,
|
||||
"team_id": key.TeamID,
|
||||
"metadata": key.Metadata,
|
||||
"key_alias": key.KeyAlias,
|
||||
"aliases": key.Aliases,
|
||||
|
|
@ -92,6 +91,9 @@ func (c *Client) UpdateKey(key *Key) (*Key, error) {
|
|||
|
||||
// The proxy rejects an empty-string budget_duration with a 400, so only
|
||||
// send it when set.
|
||||
if key.TeamID != "" {
|
||||
updateData["team_id"] = key.TeamID
|
||||
}
|
||||
if key.BudgetDuration != "" {
|
||||
updateData["budget_duration"] = key.BudgetDuration
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ func TestUpdateKeyOmitsUnsetNewFields(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, k := range []string{
|
||||
"budget_id", "enforced_params", "allowed_routes", "allowed_passthrough_routes",
|
||||
"team_id", "budget_id", "enforced_params", "allowed_routes", "allowed_passthrough_routes",
|
||||
"rpm_limit_type", "tpm_limit_type", "prompts", "organization_id",
|
||||
} {
|
||||
if _, present := captured[k]; present {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue