Documentation ¶
Index ¶
- Constants
- func NewClient(ctx context.Context, clientDetail *ClientDetail) (s client.Client, err error)
- func RegularPubTopic(source, actual, pub, path string) string
- func Wrapper(handler HandlerFunc) func(ctx *routing.Context) error
- type ClientDetail
- type ClientInfo
- type ClientRef
- type ClientSet
- type Config
- type FunctionInfo
- type HTTPServer
- type HandlerFunc
- type MqttCMFTInfo
- type RuleInfo
- type ServerConfig
- type SingleClient
Constants ¶
View Source
const ( KindMqtt kind = "mqtt" KindMqttCMFT kind = "mqtt-cmft" KinkHTTP kind = "http" KindHTTPServer kind = "http-server" )
All kinds
Variables ¶
This section is empty.
Functions ¶
func RegularPubTopic ¶ added in v2.4.0
Types ¶
type ClientDetail ¶ added in v2.4.0
type ClientDetail struct { Name string Subscription []mqtt.QOSTopic Info ClientInfo }
type ClientInfo ¶
type ClientInfo struct { Name string `yaml:"name" json:"name" validate:"nonzero"` Kind kind `yaml:"kind" json:"kind" validate:"nonzero"` Value map[string]interface{} `yaml:",inline" json:",inline"` }
ClientInfo client info
func (*ClientInfo) Parse ¶
func (v *ClientInfo) Parse(in interface{}) error
Parse parse to get real config
type ClientRef ¶
type ClientRef struct { Client string `yaml:"client" json:"client" default:"baetyl-broker"` QOS int `yaml:"qos" json:"qos" default:"0"` Topic string `yaml:"topic" json:"topic" default:""` Path string `yaml:"path" json:"path" default:""` Method string `yaml:"method" json:"method" default:"POST"` }
ClientRef ref to client
type ClientSet ¶ added in v2.4.0
type ClientSet struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { Clients []ClientInfo `yaml:"clients" json:"clients"` Rules []RuleInfo `yaml:"rules" json:"rules"` }
Config config of rule
type FunctionInfo ¶
type FunctionInfo struct {
Name string `yaml:"name" json:"name" validate:"nonzero"`
}
FunctionInfo function info
type HTTPServer ¶ added in v2.4.0
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶ added in v2.4.0
func NewHTTPServer(info ClientInfo, functionCli *http.Client) (*HTTPServer, error)
func (*HTTPServer) Close ¶ added in v2.4.0
func (h *HTTPServer) Close()
func (*HTTPServer) HandleHTTPRule ¶ added in v2.4.0
func (h *HTTPServer) HandleHTTPRule(ctx *routing.Context) (interface{}, error)
func (*HTTPServer) Start ¶ added in v2.4.0
func (h *HTTPServer) Start()
type HandlerFunc ¶ added in v2.4.0
type MqttCMFTInfo ¶ added in v2.4.0
type MqttCMFTInfo struct { Address string `yaml:"address" json:"address" validate:"nonzero"` ProductId string `yaml:"productId" json:"productId" validate:"nonzero"` DeviceId string `yaml:"deviceId" json:"deviceId" validate:"nonzero"` DeviceSecret string `yaml:"deviceSecret" json:"deviceSecret" validate:"nonzero"` }
type RuleInfo ¶
type RuleInfo struct { Name string `yaml:"name" json:"name" validate:"nonzero"` Source *ClientRef `yaml:"source" json:"source" validate:"nonzero"` Target *ClientRef `yaml:"target" json:"target"` Function *FunctionInfo `yaml:"function" json:"function"` }
RuleInfo rule info
type ServerConfig ¶ added in v2.4.0
type ServerConfig struct { Port int32 `yaml:"port" json:"port"` utils.Certificate }
type SingleClient ¶ added in v2.4.0
type SingleClient struct {
// contains filtered or unexported fields
}
func (*SingleClient) Start ¶ added in v2.4.0
func (l *SingleClient) Start(clients map[string]*SingleClient, functionClient *http.Client) error
Click to show internal directories.
Click to hide internal directories.