Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(config *Configuration) error
Types ¶
type Configuration ¶
Configuration represents the root configuration structure
func NewConfiguration ¶
func NewConfiguration( configPath string, requestPlugins map[string]RequestHandlerSig, responsePlugins map[string]ResponseHandlerSig, ) (*Configuration, error)
NewConfiguration function generates a configuration structure from a given yaml file Additionally it can also receive user defined plugins for requests/responses The plugins are associated to an endpoint by the key defined in the yaml config
type ErrorResponse ¶
type Plugin ¶
type Plugin struct {
Key string
Type string
Tags []string
Config PluginConfig
RequestHandler RequestHandlerSig
ResponseHandler ResponseHandlerSig
}
Plugin configuration structure RequestHandler and ResponseHandler are not set through config but instead additionally mapped on by the configuration
type PluginConfig ¶
PluginConfig specifies the plugin configuration structure
type ProxyResponse ¶
func (*ProxyResponse) GetBody ¶
func (resp *ProxyResponse) GetBody() ([]byte, error)
GetBody returns the original body, loading it if necessary
func (*ProxyResponse) SetBody ¶
func (resp *ProxyResponse) SetBody(newBody []byte)
SetBody resets the body to a new value
type RequestHandlerSig ¶
type RequestHandlerSig = func(http.ResponseWriter, *http.Request, map[string]string) *ErrorResponse
type Resource ¶
type Resource struct {
Url string
Plugins []Plugin // applies to all endpoints
Endpoints []Endpoint
}
Resource configuration structure
type ResponseHandlerSig ¶
type ResponseHandlerSig = func(*ProxyResponse, map[string]string)
Click to show internal directories.
Click to hide internal directories.