Documentation
¶
Overview ¶
Package request contains components that help to transform an incoming request into OPA-compatible units like a package and a query.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapperOutput ¶
Output returned by the RequestMapper.
type PathAmbiguousError ¶
Error thrown if there are more then one path mapping in the api.yaml-config that match the incoming path.
func (PathAmbiguousError) Error ¶
func (e PathAmbiguousError) Error() string
Textual representation of a PathAmbiguousError.
type PathMapper ¶
type PathMapper interface { // Configure() configures the PathMapper and returns nil or any encountered error during processors configuration. // Please note that Configure has to be called once before the component can be used (Otherwise Map() will return an error)! Configure(appConf *configs.AppConfig) error // Maps an incoming path to a Datastore and a Package. // // To make the implementation more flexible, the PathMapper itself decides which type of input it needs. // Therefore an appropriate interface like request.pathMapperInput should be used to transport the needed information // for path mapping. Map(interface{}) (*MapperOutput, error) }
PathMapper is the interface that maps an incoming path to a Datastore and a Package. This should be enough for the opa.PolicyCompiler to fire a query for partial evaluation with the datastore as unknowns.
type PathNotFoundError ¶
type PathNotFoundError struct {
RequestURL string
}
Error thrown if there is no mapping in the api.yaml-config matching the incoming path.
func (PathNotFoundError) Error ¶
func (e PathNotFoundError) Error() string
Textual representation of a PatNotFoundError.
type PathProcessor ¶
type PathProcessor interface { // Configure() configures the PathProcessor and returns nil or any encountered error during processors configuration. // Please note that Configure has to be called once before the component can be used (Otherwise Process() will return an error)! Configure(appConf *configs.AppConfig, processorConf *PathProcessorConfig) error // Processes an incoming path by parsing and afterwards mapping it to a Datastore and a Package. // // To make the implementation more flexible, the PathMapper itself decides which type of input it needs. // Therefore an appropriate interface like request.UrlProcessorInput should be used to transport the needed information // for path processing. Process(input interface{}) (*PathProcessorOutput, error) }
PathProcessor is the interface that processes an incoming path by parsing and afterwards mapping it to a Datastore and a Package.
This should be enough for the opa.PolicyCompiler to fire a query for partial evaluation with the datastore as unknowns. To separate concerns, the PathProcessor should focus on path parsing and leave the mapping to the request.PathMapper.
type PathProcessorConfig ¶
type PathProcessorConfig struct {
PathMapper *PathMapper
}
PathProcessorConfig contains all configuration needed by a single request.PathProcessor to run.
Note that this configuration also contains all configurations for nested components. With this in mind, an instance of a PathProcessor can be seen as a standalone thread with all its subcomponents attached to it. As a result of that, two PathProcessors that process different types of paths should be able to run in parallel.
type PathProcessorOutput ¶
type PathProcessorOutput struct { Datastore string Package string Path []string Queries map[string]interface{} }
Result of a successfully mapped path.
Datastore and package should be used to map the incoming request to unknowns and a target package for OPA's partial evaluation. Extracted Query-Parameters mapped to their values can i.e. be attached to the input-field of the OPA-query. A slice containing all separated path parts is also returned.