Documentation ¶
Index ¶
- Constants
- func CheckPayloadSignature(payload []byte, secret string, signature string) (string, bool)
- func ExtractParameterAsString(s string, params interface{}) (string, bool)
- func GetParameter(s string, params interface{}) (interface{}, bool)
- func ReplaceParameter(s string, params interface{}, value interface{}) bool
- type AndRule
- type Argument
- type CommandStatusResponse
- type Hook
- type Hooks
- type MatchRule
- type NotRule
- type OrRule
- type Rules
Constants ¶
const ( SourceHeader string = "header" SourceQuery string = "url" SourcePayload string = "payload" SourceString string = "string" SourceEntirePayload string = "entire-payload" SourceEntireQuery string = "entire-query" SourceEntireHeaders string = "entire-headers" )
Constants used to specify the parameter source
const ( MatchValue string = "value" MatchRegex string = "regex" MatchHashSHA1 string = "payload-hash-sha1" )
Constants for the MatchRule type
Variables ¶
This section is empty.
Functions ¶
func CheckPayloadSignature ¶
CheckPayloadSignature calculates and verifies SHA1 signature of the given payload
func ExtractParameterAsString ¶
ExtractParameterAsString extracts value from interface{} as string based on the passed string
func GetParameter ¶
GetParameter extracts interface{} value based on the passed string
func ReplaceParameter ¶
ReplaceParameter replaces parameter value with the passed value in the passed map (please note you should pass pointer to the map, because we're modifying it) based on the passed string
Types ¶
type AndRule ¶
type AndRule []Rules
AndRule will evaluate to true if and only if all of the ChildRules evaluate to true
type Argument ¶
Argument type specifies the parameter key name and the source it should be extracted from
type CommandStatusResponse ¶
type CommandStatusResponse struct { ResponseMessage string `json:"message"` Output string `json:"output"` Error string `json:"error"` }
CommandStatusResponse type encapsulates the executed command exit code, message, stdout and stderr
type Hook ¶
type Hook struct { ID string `json:"id"` ExecuteCommand string `json:"execute-command"` CommandWorkingDirectory string `json:"command-working-directory"` ResponseMessage string `json:"response-message"` CaptureCommandOutput bool `json:"include-command-output-in-response"` PassArgumentsToCommand []Argument `json:"pass-arguments-to-command"` JSONStringParameters []Argument `json:"parse-parameters-as-json"` TriggerRule *Rules `json:"trigger-rule"` }
Hook type is a structure containing details for a single hook
func (*Hook) ExtractCommandArguments ¶
ExtractCommandArguments creates a list of arguments, based on the PassArgumentsToCommand property that is ready to be used with exec.Command()
func (*Hook) ParseJSONParameters ¶
ParseJSONParameters decodes specified arguments to JSON objects and replaces the string with the newly created object
type Hooks ¶
type Hooks []Hook
Hooks is an array of Hook objects
func (*Hooks) LoadFromFile ¶
LoadFromFile attempts to load hooks from specified JSON file
type MatchRule ¶
type MatchRule struct { Type string `json:"type"` Regex string `json:"regex"` Secret string `json:"secret"` Value string `json:"value"` Parameter Argument `json:"parameter"` }
MatchRule will evaluate to true based on the type
type NotRule ¶
type NotRule Rules
NotRule will evaluate to true if any and only if the ChildRule evaluates to false
type OrRule ¶
type OrRule []Rules
OrRule will evaluate to true if any of the ChildRules evaluate to true