mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd/database): add AI Gateway key auth lookup and last-used queries (#26505)
Adds DB methods`GetAIGatewayKeyIDByHashedSecret` and `UpdateAIGatewayKeyLastUsedAt`. `GetAIGatewayKeyIDByHashedSecret` - returns AI Gateway key ID by hashed secret value. `UpdateAIGatewayKeyLastUsedAt` - updates last used timestamp for given AI Gateway key. Used by standalone AI Gateway for authentication and keeping track of currently used keys.
This commit is contained in:
@@ -10,6 +10,7 @@ const (
|
||||
APIKeyScopeAiGatewayKeyCreate APIKeyScope = "ai_gateway_key:create"
|
||||
APIKeyScopeAiGatewayKeyDelete APIKeyScope = "ai_gateway_key:delete"
|
||||
APIKeyScopeAiGatewayKeyRead APIKeyScope = "ai_gateway_key:read"
|
||||
APIKeyScopeAiGatewayKeyUpdate APIKeyScope = "ai_gateway_key:update"
|
||||
APIKeyScopeAiModelPriceAll APIKeyScope = "ai_model_price:*"
|
||||
APIKeyScopeAiModelPriceRead APIKeyScope = "ai_model_price:read"
|
||||
APIKeyScopeAiModelPriceUpdate APIKeyScope = "ai_model_price:update"
|
||||
|
||||
@@ -83,7 +83,7 @@ const (
|
||||
// said resource type.
|
||||
var RBACResourceActions = map[RBACResource][]RBACAction{
|
||||
ResourceWildcard: {},
|
||||
ResourceAIGatewayKey: {ActionCreate, ActionDelete, ActionRead},
|
||||
ResourceAIGatewayKey: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceAiModelPrice: {ActionRead, ActionUpdate},
|
||||
ResourceAIProvider: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
|
||||
ResourceAiSeat: {ActionCreate, ActionRead},
|
||||
|
||||
Reference in New Issue
Block a user