Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct {
Username string `json:"username"`
GroupID string `json:"group_id,omitempty"`
Plugins map[string]PluginConfig `json:"plugins" yaml:"plugins"`
Labels map[string]any `json:"labels,omitempty"`
ConfigDigest [32]byte `json:"-" yaml:"-"`
}
{"username":"foo","plugins":{"basic-auth":{"_meta":{"disable":false},"password":"bar","username":"foo"}},"create_time":1712331168,"update_time":1712331168}
type ConsumerGroup ¶
type ConsumerGroup struct {
Plugins map[string]PluginConfig
ConfigDigest [32]byte `json:"-" yaml:"-"`
}
type GlobalRule ¶
type GlobalRule struct {
ID string `json:"id,omitempty"`
Plugins map[string]PluginConfig `json:"plugins,omitempty"`
}
type Node ¶
type Node struct {
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
Weight int `json:"weight,omitempty"`
Priority int `json:"priority,omitempty"`
// contains filtered or unexported fields
}
func (*Node) UnmarshalJSON ¶
func (Node) WeightConfigured ¶
type PluginConfig ¶
type PluginConfig any
type PluginConfigRule ¶
type PluginConfigRule struct {
Desc string `json:"desc,omitempty"`
Plugins map[string]PluginConfig `json:"plugins,omitempty"`
}
type Route ¶
type Route struct {
ID string `json:"id,omitempty"`
Uri string `json:"uri,omitempty"`
Uris []string `json:"uris,omitempty"`
Methods []string `json:"methods,omitempty"`
Host string `json:"host,omitempty"`
Hosts []string `json:"hosts,omitempty"`
Plugins map[string]PluginConfig `json:"plugins,omitempty"`
Priority int `json:"priority,omitempty"`
Name string `json:"name,omitempty"`
Desc string `json:"desc,omitempty"`
Labels map[string]any `json:"labels,omitempty"`
RemoteAddr string `json:"remote_addr,omitempty"`
RemoteAddrs []string `json:"remote_addrs,omitempty"`
Vars json.RawMessage `json:"vars,omitempty"`
// FIXME: the ID maybe number => will unmarshal fail
PluginConfigID string `json:"plugin_config_id,omitempty"`
ServiceID string `json:"service_id,omitempty"`
EnableWebsocket bool `json:"enable_websocket,omitempty"`
UpstreamID string `json:"upstream_id,omitempty"`
Upstream Upstream `json:"upstream"`
Timeout Timeout `json:"timeout"`
Script json.RawMessage `json:"script,omitempty"`
ScriptID json.RawMessage `json:"script_id,omitempty"`
FilterFunc string `json:"filter_func,omitempty"`
CreateTime int64 `json:"create_time,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
Status int `json:"status,omitempty"`
// contains filtered or unexported fields
}
func (Route) EffectiveHosts ¶
func (Route) HostConfigured ¶
func (Route) HostsConfigured ¶
func (Route) RemoteAddrConfigured ¶
func (Route) StatusConfigured ¶
func (*Route) UnmarshalJSON ¶
type SSL ¶
type SSL struct {
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Snis []string `json:"snis,omitempty" yaml:"snis,omitempty"`
Cert string `json:"cert,omitempty" yaml:"cert,omitempty"`
Key string `json:"key,omitempty" yaml:"key,omitempty"`
Status int `json:"status,omitempty" yaml:"status,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
SSL describes the APISIX SSL resource fields needed by upstream TLS. The metadata fields are retained so snapshots can be parsed without discarding the resource shape, while Kafka currently consumes Cert and Key.
type Service ¶
type Service struct {
ID string `json:"id,omitempty"`
Plugins map[string]PluginConfig `json:"plugins,omitempty"`
UpstreamID string `json:"upstream_id,omitempty"`
Upstream Upstream `json:"upstream"`
Name string `json:"name,omitempty"`
Desc string `json:"desc,omitempty"`
EnableWebsocket bool `json:"enable_websocket,omitempty"`
Hosts []string `json:"hosts,omitempty"`
}
type StreamRoute ¶
type StreamRoute struct {
ID string `json:"id,omitempty"`
ServerAddr string `json:"server_addr,omitempty"`
ServerPort int `json:"server_port,omitempty"`
RemoteAddr string `json:"remote_addr,omitempty"`
Plugins map[string]PluginConfig `json:"plugins,omitempty"`
UpstreamID string `json:"upstream_id,omitempty"`
Upstream Upstream `json:"upstream"`
}
StreamRoute describes the APISIX L4 route fields used by the Go stream owner. The stream listener and remote address are matched before the selected upstream is dialed.
type Upstream ¶
type Upstream struct {
Type string `json:"type,omitempty"`
Nodes []Node `json:"nodes,omitempty"`
Scheme string `json:"scheme,omitempty"`
Timeout Timeout `json:"timeout"`
TLS *UpstreamTLS `json:"tls,omitempty"`
DiscoveryType string `json:"discovery_type,omitempty"`
ServiceName string `json:"service_name,omitempty"`
Retries int `json:"retries,omitempty"`
Checks map[string]any `json:"checks,omitempty"`
HashOn string `json:"hash_on,omitempty"`
Key string `json:"key,omitempty"`
PassHost string `json:"pass_host,omitempty"`
UpstreamHost string `json:"upstream_host,omitempty"`
Name string `json:"name,omitempty"`
Desc string `json:"desc,omitempty"`
// contains filtered or unexported fields
}
{
"id": "1", # id
"retries": 1, # 请求重试次数
"timeout": { # 设置连接、发送消息、接收消息的超时时间,每项都为 15 秒
"connect":15,
"send":15,
"read":15
},
"nodes": {"host:80": 100}, # 上游机器地址列表,格式为`地址 + 端口`
# 等价于 "nodes": [ {"host":"host", "port":80, "weight": 100} ],
"type":"roundrobin",
"checks": {}, # 配置健康检查的参数
"hash_on": "",
"key": "",
"name": "upstream-xxx", # upstream 名称
"desc": "hello world", # upstream 描述
"scheme": "http" # 跟上游通信时使用的 scheme,默认是 `http`
}
func (Upstream) RetriesConfigured ¶
RetriesConfigured reports whether retries was explicitly present, including zero.
func (*Upstream) UnmarshalJSON ¶
type UpstreamTLS ¶
type UpstreamTLS struct {
ClientCertID any `json:"client_cert_id,omitempty" yaml:"client_cert_id,omitempty"`
ClientCert string `json:"client_cert,omitempty" yaml:"client_cert,omitempty"`
ClientKey string `json:"client_key,omitempty" yaml:"client_key,omitempty"`
Verify bool `json:"verify,omitempty" yaml:"verify,omitempty"`
}
UpstreamTLS contains APISIX upstream TLS fields used by HTTPS/grpcs and Kafka owners. client_cert_id is resolved from the local SSL resource store at the protocol owner boundary.