Documentation
¶
Index ¶
- Constants
- func TranslateRequestBodyActions(result *executor.RequestExecutionResult, chain *registry.PolicyChain, ...) (*extprocv3.ProcessingResponse, error)
- func TranslateRequestHeadersActions(result *executor.RequestExecutionResult, chain *registry.PolicyChain, ...) (*extprocv3.ProcessingResponse, error)
- func TranslateResponseBodyActions(result *executor.ResponseExecutionResult, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
- func TranslateResponseHeadersActions(result *executor.ResponseExecutionResult, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
- type BodyMode
- type ConfigLoader
- type ExternalProcessorServer
- type Kernel
- func (k *Kernel) ApplyWholeRoutes(newRoutes map[string]*registry.PolicyChain)
- func (k *Kernel) BuildPolicyChain(routeKey string, policySpecs []policy.PolicySpec, reg *registry.PolicyRegistry, ...) (*registry.PolicyChain, error)
- func (k *Kernel) DumpRoutes() map[string]*registry.PolicyChain
- func (k *Kernel) GetPolicyChainForKey(key string) *registry.PolicyChain
- func (k *Kernel) GetRequestBodyMode(routeKey string) BodyMode
- func (k *Kernel) GetResponseBodyMode(routeKey string) BodyMode
- func (k *Kernel) RegisterRoute(metadataKey string, chain *registry.PolicyChain)
- func (k *Kernel) UnregisterRoute(metadataKey string)
- type Mutations
- type PolicyDiscoveryService
- type PolicyExecutionContext
- type RouteMapping
- type RouteMetadata
Constants ¶
const ( Wso2MetadataPrefix = "x-wso2-" APIIDKey = Wso2MetadataPrefix + "api-id" APINameKey = Wso2MetadataPrefix + "api-name" APIVersionKey = Wso2MetadataPrefix + "api-version" APITypeKey = Wso2MetadataPrefix + "api-type" APIContextKey = Wso2MetadataPrefix + "api-context" OperationPathKey = Wso2MetadataPrefix + "operation-path" APIKindKey = Wso2MetadataPrefix + "api-kind" ProjectIDKey = Wso2MetadataPrefix + "project-id" )
Constants for analytics metadata
Variables ¶
This section is empty.
Functions ¶
func TranslateRequestBodyActions ¶
func TranslateRequestBodyActions(result *executor.RequestExecutionResult, chain *registry.PolicyChain, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
TranslateRequestBodyActions converts request body execution result to ext_proc response
func TranslateRequestHeadersActions ¶
func TranslateRequestHeadersActions(result *executor.RequestExecutionResult, chain *registry.PolicyChain, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
TranslateRequestHeadersActions converts request headers execution result to ext_proc response
func TranslateResponseBodyActions ¶
func TranslateResponseBodyActions(result *executor.ResponseExecutionResult, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
TranslateResponseBodyActions converts response body execution result to ext_proc response
func TranslateResponseHeadersActions ¶
func TranslateResponseHeadersActions(result *executor.ResponseExecutionResult, execCtx *PolicyExecutionContext) (*extprocv3.ProcessingResponse, error)
TranslateResponseHeadersActions converts response headers execution result to ext_proc response
Types ¶
type ConfigLoader ¶
type ConfigLoader struct {
// contains filtered or unexported fields
}
ConfigLoader loads policy chain configurations T077: Implement file-based configuration loader as fallback
func NewConfigLoader ¶
func NewConfigLoader(kernel *Kernel, reg *registry.PolicyRegistry) *ConfigLoader
NewConfigLoader creates a new configuration loader
func (*ConfigLoader) LoadFromFile ¶
func (cl *ConfigLoader) LoadFromFile(path string) error
LoadFromFile loads policy chain configurations from a YAML file T077: File-based configuration loader implementation
type ExternalProcessorServer ¶
type ExternalProcessorServer struct {
extprocv3.UnimplementedExternalProcessorServer
// contains filtered or unexported fields
}
ExternalProcessorServer implements the Envoy external processor service T059: ExternalProcessorServer gRPC service struct
func NewExternalProcessorServer ¶
func NewExternalProcessorServer(kernel *Kernel, chainExecutor *executor.ChainExecutor, tracingConfig config.TracingConfig, tracingServiceName string) *ExternalProcessorServer
NewExternalProcessorServer creates a new ExternalProcessorServer
func (*ExternalProcessorServer) Process ¶
func (s *ExternalProcessorServer) Process(stream extprocv3.ExternalProcessor_ProcessServer) error
Process implements the bidirectional streaming RPC handler T060: Process(stream) bidirectional streaming RPC handler
type Kernel ¶
type Kernel struct {
// Route-to-chain mapping
// Key: metadata key from Envoy
// Value: PolicyChain for that route
Routes map[string]*registry.PolicyChain
// contains filtered or unexported fields
}
Kernel represents the integration layer between Envoy and the policy execution engine T050: Kernel struct with Routes map
func (*Kernel) ApplyWholeRoutes ¶
func (k *Kernel) ApplyWholeRoutes(newRoutes map[string]*registry.PolicyChain)
ApplyWholeRoutes replaces all existing route mappings with the provided set
func (*Kernel) BuildPolicyChain ¶
func (k *Kernel) BuildPolicyChain(routeKey string, policySpecs []policy.PolicySpec, reg *registry.PolicyRegistry, apiMetadata policy.PolicyMetadata) (*registry.PolicyChain, error)
BuildPolicyChain creates a PolicyChain from PolicySpecs with body requirement computation T055: BuildPolicyChain with body requirement computation apiMetadata is optional and can contain API-level information for policies that need it
func (*Kernel) DumpRoutes ¶
func (k *Kernel) DumpRoutes() map[string]*registry.PolicyChain
DumpRoutes returns a copy of all route mappings for debugging Returns a map of route key -> policy chain
func (*Kernel) GetPolicyChainForKey ¶
func (k *Kernel) GetPolicyChainForKey(key string) *registry.PolicyChain
GetPolicyChainForKey retrieves the policy chain for a given metadata key T051: GetPolicyChainForKey method implementation Returns nil when no policy chain exists for the route (not an error condition)
func (*Kernel) GetRequestBodyMode ¶
GetRequestBodyMode returns the body mode for request phase
func (*Kernel) GetResponseBodyMode ¶
GetResponseBodyMode returns the body mode for response phase
func (*Kernel) RegisterRoute ¶
func (k *Kernel) RegisterRoute(metadataKey string, chain *registry.PolicyChain)
RegisterRoute registers a policy chain for a route
func (*Kernel) UnregisterRoute ¶
UnregisterRoute removes a route mapping
type Mutations ¶
type Mutations struct {
HeaderMutation *extprocv3.HeaderMutation
BodyMutation *extprocv3.BodyMutation
}
Mutations holds header and body mutations for request/response processing
type PolicyDiscoveryService ¶
type PolicyDiscoveryService struct {
}
PolicyDiscoveryService would implement full xDS protocol T071-T074, T076: xDS service (stub for future implementation) For MVP, we use file-based configuration via ConfigLoader above
type PolicyExecutionContext ¶
type PolicyExecutionContext struct {
// contains filtered or unexported fields
}
PolicyExecutionContext manages the lifecycle of a single request through the policy chain. This context is created when a request arrives and lives until the response is completed. It encapsulates all state needed for processing both request and response phases.
type RouteMapping ¶
type RouteMapping struct {
// Metadata key from Envoy (route identifier)
// Example: "api-v1-private", "public-endpoint"
MetadataKey string
// PolicyChain to execute for this route
// Contains both request and response policies
Chain *registry.PolicyChain
}
RouteMapping maps Envoy metadata keys to PolicyChains for route-specific processing T049: RouteMapping struct definition