Documentation
¶
Index ¶
- Constants
- func ConfModAiRouteCheck(cfg *ConfModAiRoute, confRoot string) error
- func ValidateRouteTable(table *RouteTable) error
- type AiRouteData
- type AiRouteDataFile
- type AiRouteTable
- type ConfModAiRoute
- type ModuleAiRoute
- type ModuleAiRouteState
- type RouteRule
- type RouteRuleFile
- type RouteTable
- type RouteTableFile
Constants ¶
const ( RouteTypeApikey = "apikey" RouteTypeEntity = "entity" RouteTypeGlobal = "global" )
route table types
const ModAiRoute = "mod_ai_route"
Variables ¶
This section is empty.
Functions ¶
func ConfModAiRouteCheck ¶
func ConfModAiRouteCheck(cfg *ConfModAiRoute, confRoot string) error
func ValidateRouteTable ¶
func ValidateRouteTable(table *RouteTable) error
Types ¶
type AiRouteData ¶
type AiRouteData struct {
Version string
RouteRules map[string]RouteTable
ApikeyRouteTableBindings map[string][]string
}
AiRouteData is the runtime representation of the whole AI route data.
func AiRouteDataLoad ¶
func AiRouteDataLoad(fileName string) (*AiRouteData, error)
type AiRouteDataFile ¶
type AiRouteDataFile struct {
Version string `json:"Version"`
RouteRules map[string]RouteTableFile `json:"route_rules"`
ApikeyRouteTableBindings map[string][]string `json:"ApikeyRouteTableBindings"`
}
AiRouteDataFile is the JSON DTO for the whole AI route data file.
func (*AiRouteDataFile) UnmarshalJSON ¶
func (f *AiRouteDataFile) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts both the canonical BFE field name "route_rules" and the ai-gateway-api InnerAPI field name "RouteRules". It also normalizes route table type values ("api_key" -> "apikey") for compatibility.
type AiRouteTable ¶
type AiRouteTable struct {
// contains filtered or unexported fields
}
func NewAiRouteTable ¶
func NewAiRouteTable() *AiRouteTable
func (*AiRouteTable) Search ¶
func (t *AiRouteTable) Search(apiKey string, req *bfe_basic.Request) *bfe_basic.AiRouteResult
func (*AiRouteTable) Update ¶
func (t *AiRouteTable) Update(data *AiRouteData) error
type ConfModAiRoute ¶
type ConfModAiRoute struct {
Basic struct {
RouteRulePath string // path for ai route rule
}
Log struct {
OpenDebug bool
}
}
func (*ConfModAiRoute) Check ¶
func (cfg *ConfModAiRoute) Check(confRoot string) error
type ModuleAiRoute ¶
type ModuleAiRoute struct {
// contains filtered or unexported fields
}
func NewModuleAiRoute ¶
func NewModuleAiRoute() *ModuleAiRoute
func (*ModuleAiRoute) Init ¶
func (m *ModuleAiRoute) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHandlers, cr string) error
func (*ModuleAiRoute) Name ¶
func (m *ModuleAiRoute) Name() string
type ModuleAiRouteState ¶
type RouteRule ¶
type RouteRule struct {
Name string
CondStr string
Cond condition.Condition
Targets []bfe_basic.AiRouteTarget
Fallbacks []bfe_basic.AiRouteFallback
}
RouteRule is the runtime representation of a route rule with compiled condition.
type RouteRuleFile ¶
type RouteRuleFile struct {
Name string `json:"name"`
Cond string `json:"Cond"`
Targets []bfe_basic.AiRouteTarget `json:"targets"`
Fallbacks []bfe_basic.AiRouteFallback `json:"fallbacks"`
}
RouteRuleFile is the JSON DTO for a single route rule.
type RouteTable ¶
RouteTable is the runtime representation of a route table.
type RouteTableFile ¶
type RouteTableFile struct {
Type string `json:"type"`
Owner string `json:"owner"`
Rules []RouteRuleFile `json:"rules"`
}
RouteTableFile is the JSON DTO for a route table.