http_generic

package
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScriptKeyDataIn          = "dataIn"          // post data to script
	ScriptKeyDataOut         = "dataOut"         // get data from script
	ScriptKeyConfigIn        = "configIn"        // post config data to script
	ScriptKeyPreRunResponse  = "preRunResponse"  // post pre run response to script
	ScriptKeyPostRunResponse = "postRunResponse" // post post-run response to script
	ScriptKeyExecute         = "execute"         // get execute binary signal from script
	DefaultNode              = "default"         // default node endpoint name, if none matches

	BodyLanguageJSON      = "json"
	BodyLanguageYAML      = "yaml"
	BodyLanguagePlainText = "plaintext"

	PreRun  = "pre_run"
	PostRun = "post_run"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpConfig

type HttpConfig struct {
	HttpNode
	Disabled          bool   `json:"disabled" yaml:"disabled"`
	ExecutionInterval string `json:"executionInterval" yaml:"executionInterval"`
}

http config

type HttpNode

type HttpNode struct {
	HttpNodeConfig
	Insecure bool                      `json:"insecure" yaml:"insecure"`
	PreRun   map[string]HttpNodeConfig `json:"preRun" yaml:"preRun"`
	PostRun  map[string]HttpNodeConfig `json:"postRun" yaml:"postRun"`
}

http node

func (*HttpNode) Clone

func (hn *HttpNode) Clone() *HttpNode

Clone cones HttpNode

type HttpNodeConfig

type HttpNodeConfig struct {
	URL                 string                 `json:"url" yaml:"url"`
	Method              string                 `json:"method" yaml:"method"`
	Headers             map[string]string      `json:"headers" yaml:"headers"`
	QueryParameters     map[string]interface{} `json:"queryParameters" yaml:"queryParameters"`
	BodyLanguage        string                 `json:"bodyLanguage" yaml:"bodyLanguage"`
	Body                interface{}            `json:"body" yaml:"body"`
	ResponseCode        int                    `json:"responseCode" yaml:"responseCode"`
	IncludeGlobalConfig bool                   `json:"includeGlobalConfig" yaml:"includeGlobalConfig"`
	Script              string                 `json:"script" yaml:"script"`
}

Http node config

func (*HttpNodeConfig) Clone

func (hn *HttpNodeConfig) Clone() *HttpNodeConfig

Clone cones HttpNodeConfig

type HttpProtocol

type HttpProtocol struct {
	GatewayConfig *gwTY.Config
	Config        *HttpProtocolConf
	// contains filtered or unexported fields
}

http protocol

func New

func New(logger *zap.Logger, gwCfg *gwTY.Config, protocol cmap.CustomMap, rxMsgFunc func(rm *msgTY.RawMessage) error, scheduler schedulerTY.CoreScheduler) (*HttpProtocol, error)

New returns new instance of generic http protocol

func (*HttpProtocol) Close

func (hp *HttpProtocol) Close() error

Close closes the generic http protocol

func (*HttpProtocol) Post

func (hp *HttpProtocol) Post(msg *msgTY.Message) error

Post the received message to the specified target url if none matched uses "default" named endpoint

type HttpProtocolConf

type HttpProtocolConf struct {
	Type            string                 `json:"type" yaml:"type"`
	Headers         map[string]string      `json:"headers" yaml:"headers"`
	QueryParameters map[string]interface{} `json:"queryParameters" yaml:"queryParameters"`
	Endpoints       map[string]HttpConfig  `json:"endpoints" yaml:"endpoints"`
	Nodes           map[string]HttpNode    `json:"nodes" yaml:"nodes"`
}

http protocol config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL