Documentation ¶
Index ¶
- type AutoResponder
- type DBAutoResponder
- func (ar *DBAutoResponder) AddOrUpdateResponse(response *Response)
- func (ar *DBAutoResponder) AddOrUpdateRule(rule *Rule)
- func (ar *DBAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
- func (ar *DBAutoResponder) GetResponse(id uint64) *Response
- func (ar *DBAutoResponder) GetResponses() []*Response
- func (ar *DBAutoResponder) GetRule(id uint64) *Rule
- func (ar *DBAutoResponder) GetRules() []*Rule
- func (ar *DBAutoResponder) Init()
- func (ar *DBAutoResponder) RemoveResponse(id uint64)
- func (ar *DBAutoResponder) RemoveRule(id uint64)
- type FarxAutoResponder
- func (ar *FarxAutoResponder) AddOrUpdateResponse(response *Response)
- func (ar *FarxAutoResponder) AddOrUpdateRule(rule *Rule)
- func (ar *FarxAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
- func (ar *FarxAutoResponder) GetResponse(id uint64) *Response
- func (ar *FarxAutoResponder) GetResponses() []*Response
- func (ar *FarxAutoResponder) GetRule(id uint64) *Rule
- func (ar *FarxAutoResponder) GetRules() []*Rule
- func (ar *FarxAutoResponder) Init()
- func (ar *FarxAutoResponder) Reload(farxPath string) (bool, error)
- func (ar *FarxAutoResponder) RemoveResponse(id uint64)
- func (ar *FarxAutoResponder) RemoveRule(id uint64)
- type FarxFileXML
- type Headers
- type JSONAutoResponder
- func (ar *JSONAutoResponder) AddOrUpdateResponse(response *Response)
- func (ar *JSONAutoResponder) AddOrUpdateRule(rule *Rule)
- func (ar *JSONAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
- func (ar *JSONAutoResponder) GetResponse(id uint64) *Response
- func (ar *JSONAutoResponder) GetResponses() []*Response
- func (ar *JSONAutoResponder) GetRule(id uint64) *Rule
- func (ar *JSONAutoResponder) GetRules() []*Rule
- func (ar *JSONAutoResponder) Init()
- func (ar *JSONAutoResponder) RemoveResponse(id uint64)
- func (ar *JSONAutoResponder) RemoveRule(id uint64)
- type Response
- type ResponseRule
- type Rule
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoResponder ¶
type AutoResponder interface { //Init auto responder Init() //AddOrUpdateRule adds or updates given rule AddOrUpdateRule(rule *Rule) //FindMatchingRule gets the rule with given url pattern and http method FindMatchingRule(urlPattern string, method string) *Rule //GetRule gets the rule with given id GetRule(id uint64) *Rule //GetRules gets the rules with given url pattern and http method GetRules() []*Rule //RemoveRule removes the rule RemoveRule(id uint64) //AddOrUpdateResponse adds or updates given rule AddOrUpdateResponse(response *Response) //GetResponse gets the response with given id GetResponse(id uint64) *Response //GetResponses gets the response slice GetResponses() []*Response //RemoveResponse removes the response with given id RemoveResponse(id uint64) }
AutoResponder implements an interface for autoresponder
func NewAutoResponder ¶
func NewAutoResponder(conf *utils.Config) AutoResponder
NewAutoResponder Inits an Auto Responder
type DBAutoResponder ¶
type DBAutoResponder struct { DBPath string // contains filtered or unexported fields }
DBAutoResponder DB auto responder
func NewDBAutoResponder ¶
func NewDBAutoResponder() DBAutoResponder
NewDBAutoResponder Inits a DB Auto Responder
func (*DBAutoResponder) AddOrUpdateResponse ¶
func (ar *DBAutoResponder) AddOrUpdateResponse(response *Response)
AddOrUpdateResponse adds or updates given rule
func (*DBAutoResponder) AddOrUpdateRule ¶
func (ar *DBAutoResponder) AddOrUpdateRule(rule *Rule)
AddOrUpdateRule adds or updates given rule
func (*DBAutoResponder) FindMatchingRule ¶
func (ar *DBAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
FindMatchingRule gets the rule with given url pattern and http method
func (*DBAutoResponder) GetResponse ¶
func (ar *DBAutoResponder) GetResponse(id uint64) *Response
GetResponse gets the response with given id
func (*DBAutoResponder) GetResponses ¶
func (ar *DBAutoResponder) GetResponses() []*Response
GetResponses gets the response slice
func (*DBAutoResponder) GetRule ¶
func (ar *DBAutoResponder) GetRule(id uint64) *Rule
GetRule gets the rule with given id
func (*DBAutoResponder) GetRules ¶
func (ar *DBAutoResponder) GetRules() []*Rule
GetRules gets the rules with given url pattern and http method
func (*DBAutoResponder) RemoveResponse ¶
func (ar *DBAutoResponder) RemoveResponse(id uint64)
RemoveResponse removes the response with given id
func (*DBAutoResponder) RemoveRule ¶
func (ar *DBAutoResponder) RemoveRule(id uint64)
RemoveRule removes the rule
type FarxAutoResponder ¶
type FarxAutoResponder struct { FolderPath string Rules []*ruleFile }
FarxAutoResponder File system json auto responder
func NewFarxAutoResponder ¶
func NewFarxAutoResponder() FarxAutoResponder
NewFarxAutoResponder Inits a DB Auto Responder
func (*FarxAutoResponder) AddOrUpdateResponse ¶
func (ar *FarxAutoResponder) AddOrUpdateResponse(response *Response)
AddOrUpdateResponse adds or updates given rule
func (*FarxAutoResponder) AddOrUpdateRule ¶
func (ar *FarxAutoResponder) AddOrUpdateRule(rule *Rule)
AddOrUpdateRule adds or updates given rule
func (*FarxAutoResponder) FindMatchingRule ¶
func (ar *FarxAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
FindMatchingRule gets the rule with given url pattern and http method
func (*FarxAutoResponder) GetResponse ¶
func (ar *FarxAutoResponder) GetResponse(id uint64) *Response
GetResponse gets the response with given id
func (*FarxAutoResponder) GetResponses ¶
func (ar *FarxAutoResponder) GetResponses() []*Response
GetResponses gets the response slice
func (*FarxAutoResponder) GetRule ¶
func (ar *FarxAutoResponder) GetRule(id uint64) *Rule
GetRule gets the rule with given id
func (*FarxAutoResponder) GetRules ¶
func (ar *FarxAutoResponder) GetRules() []*Rule
GetRules gets the rules with given url pattern and http method
func (*FarxAutoResponder) Reload ¶
func (ar *FarxAutoResponder) Reload(farxPath string) (bool, error)
Reload updates given farx
func (*FarxAutoResponder) RemoveResponse ¶
func (ar *FarxAutoResponder) RemoveResponse(id uint64)
RemoveResponse removes the response with given id
func (*FarxAutoResponder) RemoveRule ¶
func (ar *FarxAutoResponder) RemoveRule(id uint64)
RemoveRule removes the rule
type FarxFileXML ¶
FarxFileXML Farx response auto responder xml definition
func ReadFarxFile ¶
func ReadFarxFile(path string) (*FarxFileXML, error)
ReadFarxFile Farx file reader
type JSONAutoResponder ¶
type JSONAutoResponder struct { FolderPath string Rules map[uint64]*ruleFile Responses map[uint64]*responseFile }
JSONAutoResponder File system json auto responder
func NewJSONAutoResponder ¶
func NewJSONAutoResponder() JSONAutoResponder
NewJSONAutoResponder Inits a DB Auto Responder
func (*JSONAutoResponder) AddOrUpdateResponse ¶
func (ar *JSONAutoResponder) AddOrUpdateResponse(response *Response)
AddOrUpdateResponse adds or updates given rule
func (*JSONAutoResponder) AddOrUpdateRule ¶
func (ar *JSONAutoResponder) AddOrUpdateRule(rule *Rule)
AddOrUpdateRule adds or updates given rule
func (*JSONAutoResponder) FindMatchingRule ¶
func (ar *JSONAutoResponder) FindMatchingRule(urlPattern string, method string) *Rule
FindMatchingRule gets the rule with given url pattern and http method
func (*JSONAutoResponder) GetResponse ¶
func (ar *JSONAutoResponder) GetResponse(id uint64) *Response
GetResponse gets the response with given id
func (*JSONAutoResponder) GetResponses ¶
func (ar *JSONAutoResponder) GetResponses() []*Response
GetResponses gets the response slice
func (*JSONAutoResponder) GetRule ¶
func (ar *JSONAutoResponder) GetRule(id uint64) *Rule
GetRule gets the rule with given id
func (*JSONAutoResponder) GetRules ¶
func (ar *JSONAutoResponder) GetRules() []*Rule
GetRules gets the rules with given url pattern and http method
func (*JSONAutoResponder) RemoveResponse ¶
func (ar *JSONAutoResponder) RemoveResponse(id uint64)
RemoveResponse removes the response with given id
func (*JSONAutoResponder) RemoveRule ¶
func (ar *JSONAutoResponder) RemoveRule(id uint64)
RemoveRule removes the rule
type Response ¶
type Response struct { ID uint64 `json:"id"` Label string `json:"label"` StatusCode int `json:"statusCode"` Headers []*Headers `json:"headers"` Body string `json:"body"` }
Response ...
func NewResponseFromString ¶
NewResponseFromString parse raw string content
type ResponseRule ¶
type ResponseRule struct { Match string `xml:"Match,attr"` Headers string `xml:"Headers,attr"` Body string `xml:"Body,attr"` Action string `xml:"Action,attr"` Latency int `xml:"Latency,attr"` Enabled bool `xml:"Enabled,attr"` }
ResponseRule Farx response rule xml definition
func (*ResponseRule) MapToResponse ¶
func (xmlRule *ResponseRule) MapToResponse() *Response
MapToResponse Transforms ResponseRule to Response
func (*ResponseRule) MapToRule ¶
func (xmlRule *ResponseRule) MapToRule() *Rule
MapToRule Transforms ResponseRule to Rule
type Rule ¶
type Rule struct { ID uint64 `json:"id"` URLPattern string `json:"urlPattern"` MatchType string `json:"matchType"` Method string `json:"method"` ResponseID uint64 `json:"responseID"` Latency int `json:"latency"` IsActive bool `json:"isActive"` Response *Response `json:"-"` }
Rule ...
type State ¶
type State struct { ResponseRules []*ResponseRule `xml:"ResponseRule"` Enabled bool `xml:"Enabled,attr"` }
State Farx response state xml definition