Documentation
¶
Index ¶
- Constants
- func AuthIDFromContext(ctx context.Context) (ids.AuthID, bool)
- func GatewayIDFromContext(ctx context.Context) (ids.GatewayID, bool)
- func MCPPath(slug string) string
- func SlugFromMCPPath(path string) string
- func WithAuthID(ctx context.Context, id ids.AuthID) context.Context
- func WithConsumer(ctx context.Context, consumer *RoutableConsumer) context.Context
- func WithData(ctx context.Context, data *Data) context.Context
- func WithGatewayID(ctx context.Context, id ids.GatewayID) context.Context
- type Associator
- type CreateInput
- type Creator
- type Data
- func (d *Data) EffectiveRegistries(rc *RoutableConsumer) []*registrydomain.Registry
- func (d *Data) MatchPath(path string) (*RoutableConsumer, bool)
- func (d *Data) MatchSlug(slug string) (*RoutableConsumer, bool)
- func (d *Data) RegistryByID(id ids.RegistryID) (*registrydomain.Registry, bool)
- func (d *Data) SetRegistryIndex(byID map[ids.RegistryID]*registrydomain.Registry)
- type DataFinder
- type Deleter
- type Finder
- type PathMatch
- type PathResolver
- type RoutableConsumer
- type UpdateInput
- type Updater
Constants ¶
View Source
const ( GatewayIDKey contextKey = "auth.gateway_id" ConsumerDataKey contextKey = "auth.consumer_data" AuthIDKey contextKey = "auth.auth_id" ConsumerKey contextKey = "auth.consumer" )
Variables ¶
This section is empty.
Functions ¶
func SlugFromMCPPath ¶
func WithConsumer ¶
func WithConsumer(ctx context.Context, consumer *RoutableConsumer) context.Context
Types ¶
type Associator ¶
type Associator interface {
AttachRegistry(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, registryID ids.RegistryID, weight *int) error
DetachRegistry(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, registryID ids.RegistryID) error
AttachRole(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, roleID ids.RoleID) error
DetachRole(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, roleID ids.RoleID) error
AttachAuth(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, authID ids.AuthID) error
DetachAuth(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, authID ids.AuthID) error
AttachPolicy(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, policyID ids.PolicyID) error
DetachPolicy(ctx context.Context, gatewayID ids.GatewayID, consumerID ids.ConsumerID, policyID ids.PolicyID) error
}
func NewAssociator ¶
func NewAssociator( repo domain.Repository, registryRepo registrydomain.Repository, roleRepo roledomain.Repository, authRepo authdomain.Repository, policyRepo policydomain.Repository, manager *cache.TTLMapManager, publisher cache.EventPublisher, logger *slog.Logger, ) Associator
type CreateInput ¶
type CreateInput struct {
GatewayID ids.GatewayID
Name string
Type domain.Type
RoutingMode domain.RoutingMode
LBConfig *domain.LBConfig
Headers map[string]string
Active *bool
Fallback *domain.Fallback
RegistryIDs []ids.RegistryID
RegistryWeights map[ids.RegistryID]int
RoleIDs []ids.RoleID
ModelPolicies domain.ModelPolicies
MCP *domain.MCPPolicy
}
type Creator ¶
func NewCreator ¶
func NewCreator( repo domain.Repository, registryRepo registrydomain.Repository, roleRepo roledomain.Repository, manager *cache.TTLMapManager, publisher cache.EventPublisher, logger *slog.Logger, ) Creator
type Data ¶
type Data struct {
GatewayID ids.GatewayID
Consumers []RoutableConsumer
Roles []*roledomain.Role
// contains filtered or unexported fields
}
func NewData ¶
func NewData(gatewayID ids.GatewayID, consumers []RoutableConsumer, roles ...[]*roledomain.Role) *Data
func (*Data) EffectiveRegistries ¶
func (d *Data) EffectiveRegistries(rc *RoutableConsumer) []*registrydomain.Registry
func (*Data) RegistryByID ¶
func (d *Data) RegistryByID(id ids.RegistryID) (*registrydomain.Registry, bool)
func (*Data) SetRegistryIndex ¶
func (d *Data) SetRegistryIndex(byID map[ids.RegistryID]*registrydomain.Registry)
type DataFinder ¶
type DataFinder interface {
FindByGateway(ctx context.Context, gatewayID ids.GatewayID) (*Data, error)
}
func NewDataFinder ¶
func NewDataFinder( repo domain.Repository, registryRepo registrydomain.Repository, policyRepo policydomain.Repository, authRepo authdomain.Repository, roleRepo roledomain.Repository, pluginRegistry appplugins.Registry, manager *cache.TTLMapManager, logger *slog.Logger, ) DataFinder
type Deleter ¶
type Deleter interface {
Delete(ctx context.Context, gatewayID ids.GatewayID, id ids.ConsumerID) error
}
func NewDeleter ¶
func NewDeleter( repo domain.Repository, manager *cache.TTLMapManager, publisher cache.EventPublisher, logger *slog.Logger, ) Deleter
type Finder ¶
type Finder interface {
FindByID(ctx context.Context, gatewayID ids.GatewayID, id ids.ConsumerID) (*domain.Consumer, error)
List(ctx context.Context, filter domain.ListFilter) ([]*domain.Consumer, int, error)
}
func NewFinder ¶
func NewFinder(repo domain.Repository, manager *cache.TTLMapManager, logger *slog.Logger) Finder
type PathResolver ¶
func NewPathResolver ¶
func NewPathResolver( consumers domain.Repository, auths authdomain.Repository, gateways gatewaydomain.Repository, manager *cache.TTLMapManager, logger *slog.Logger, ) PathResolver
type RoutableConsumer ¶
type RoutableConsumer struct {
Consumer *domain.Consumer
Registries []*registrydomain.Registry
FallbackBackends []*registrydomain.Registry
Policies []*policydomain.Policy
Auths []*authdomain.Auth
PolicyPlan *appplugins.StagePlan
}
func ConsumerFromContext ¶
func ConsumerFromContext(ctx context.Context) (*RoutableConsumer, bool)
type UpdateInput ¶
type UpdateInput struct {
ID ids.ConsumerID
GatewayID ids.GatewayID
Name *string
Type *domain.Type
RoutingMode *domain.RoutingMode
LBConfig *domain.LBConfig
Headers *map[string]string
Active *bool
Fallback *domain.Fallback
ModelPolicies *domain.ModelPolicies
Toolkit *domain.Toolkit
FailMode *domain.FailMode
}
type Updater ¶
func NewUpdater ¶
func NewUpdater( repo domain.Repository, authRepo authdomain.Repository, manager *cache.TTLMapManager, publisher cache.EventPublisher, logger *slog.Logger, ) Updater
Source Files
¶
Click to show internal directories.
Click to hide internal directories.