Documentation
¶
Index ¶
- func AssignFunction(rule *Rule)
- func DisplayFunc(iw io.Writer, dataMap map[string]interface{}, rule *Rule) error
- func Hook(w http.ResponseWriter, r *http.Request, endpoint *Endpoint, ...)
- func NoOp(iw io.Writer, dataMap map[string]interface{}, rule *Rule) error
- func TemplateFunc(iw io.Writer, dataMap map[string]interface{}, rule *Rule) error
- type Endpoint
- type EndpointService
- type Rule
- type SecretEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignFunction ¶
func AssignFunction(rule *Rule)
TODO make this mapping more configurable./find out if there's a better way to do this. Maps the function to the rule type.
func Hook ¶
func Hook(w http.ResponseWriter, r *http.Request, endpoint *Endpoint, secrets SecretEngine, log *log.Logger, dataBag *map[string]interface{})
Main routine that processes received hooks, obtaining endpoints and processing rules. Various error checking and validation happens at this stage, i.e mapping required secrets to dataBag. data bag is a map of input parameters passed to each rules function.
Types ¶
type Endpoint ¶
type Endpoint struct {
Name string `yaml:"name"`
Secrets []string `yaml:"secrets"`
Rules []Rule `yaml:"rules"`
}
Data structure contains information on an Endpoint, with associated rules and sources.
type EndpointService ¶
type EndpointService interface {
Endpoint(name string) (*Endpoint, error)
Endpoints() ([]Endpoint, error)
CreateEndpoint() error
DeleteEndpoint() error
}
Interface provides an extensible way of implementing the EndpointService, this is used in various parts of the application logic to decouple implementations.
type Rule ¶
type Rule struct {
Type string `yaml:type`
Destination string `yaml:destination`
Arguments map[string]string `yaml:arguments`
Secrets []string `yaml:secrets`
Headers map[string]string `yaml:headers`
Echo bool `yaml:echo`
// contains filtered or unexported fields
}
Contains rule state, is assigned a function based on type. Type mapped by AssignFunction.