Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTLS

type ClientTLS struct {
	Cert string `json:"client_cert,omitempty" yaml:"client_cert,omitempty"`
	Key  string `json:"client_key,omitempty" yaml:"client_key,omitempty"`
}

ClientTLS is tls cert and key use in mTLS

type Configuration

type Configuration struct {
	Name     string     `yaml:"name" json:"name"`
	Version  string     `yaml:"version" json:"version"`
	Services []*Service `yaml:"services,omitempty" json:"services,omitempty"`
	Routes   []*Route   `yaml:"routes,omitempty" json:"routes,omitempty"`
}

Configuration is the configuration of services

type Plugins

type Plugins map[string]interface{}

func (*Plugins) DeepCopy

func (p *Plugins) DeepCopy() *Plugins

func (*Plugins) DeepCopyInto

func (p *Plugins) DeepCopyInto(out *Plugins)

type Route

type Route struct {
	ID string `json:"id" yaml:"id"`

	Name        string      `json:"name" yaml:"name"`
	Labels      StringArray `json:"labels,omitempty" yaml:"labels,omitempty"`
	Description string      `json:"desc,omitempty" yaml:"desc,omitempty"`

	Host            string           `json:"host,omitempty" yaml:"host,omitempty"`
	Hosts           []string         `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	Uri             string           `json:"uri,omitempty" yaml:"uri,omitempty"`
	Priority        int              `json:"priority,omitempty" yaml:"priority,omitempty"`
	Timeout         *UpstreamTimeout `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Vars            Vars             `json:"vars,omitempty" yaml:"vars,omitempty"`
	Uris            []string         `json:"uris,omitempty" yaml:"uris,omitempty"`
	Methods         []string         `json:"methods,omitempty" yaml:"methods,omitempty"`
	EnableWebsocket bool             `json:"enable_websocket,omitempty" yaml:"enable_websocket,omitempty"`
	RemoteAddrs     []string         `json:"remote_addrs,omitempty" yaml:"remote_addrs,omitempty"`
	UpstreamId      string           `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
	ServiceID       string           `json:"service_id,omitempty" yaml:"service_id,omitempty"`
	Plugins         Plugins          `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	PluginConfigId  string           `json:"plugin_config_id,omitempty" yaml:"plugin_config_id,omitempty"`
	FilterFunc      string           `json:"filter_func,omitempty" yaml:"filter_func,omitempty"`
}

Route apisix route object +k8s:deepcopy-gen=true

type Service

type Service struct {
	ID string `json:"id" yaml:"id"`

	Name        string `json:"name" yaml:"name"`
	Description string `json:"desc,omitempty" yaml:"desc,omitempty"`
	// Labels are used for resource classification and indexing
	Labels StringArray `json:"labels,omitempty" yaml:"labels,omitempty"`
	// HTTP hosts for this service.
	Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	// Plugin settings on Service level
	Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	// Upstream settings for the Service.
	Upstream Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
	// UpstreamId settings for the Service.
	UpstreamId string `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
	// Enables a websocket. Set to false by default.
	EnableWebsocket bool `json:"enable_websocket,omitempty" yaml:"enable_websocket,omitempty"`
}

Service is the abstraction of a backend service on API gateway.

type StringArray

type StringArray []string

StringArray is enhanced version of pq.StringArray that can be handled nil value automatically.

type StringOrSlice

type StringOrSlice struct {
	StrVal   string   `json:"-"`
	SliceVal []string `json:"-"`
}

StringOrSlice represents a string or a string slice. TODO Do not use interface{} to avoid the reflection overheads. +k8s:deepcopy-gen=true

func (*StringOrSlice) MarshalJSON

func (s *StringOrSlice) MarshalJSON() ([]byte, error)

func (*StringOrSlice) UnmarshalJSON

func (s *StringOrSlice) UnmarshalJSON(p []byte) error

type Upstream

type Upstream struct {
	// ID is the upstream name. It should be unique among all upstreams
	// in the same service.
	ID string `json:"id" yaml:"id"`

	Name    string               `json:"name" yaml:"name"`
	Type    string               `json:"type,omitempty" yaml:"type,omitempty"`
	HashOn  string               `json:"hash_on,omitempty" yaml:"hash_on,omitempty"`
	Key     string               `json:"key,omitempty" yaml:"key,omitempty"`
	Checks  *UpstreamHealthCheck `json:"checks,omitempty" yaml:"checks,omitempty"`
	Nodes   UpstreamNodes        `json:"nodes" yaml:"nodes"`
	Scheme  string               `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	Retries *int                 `json:"retries,omitempty" yaml:"retries,omitempty"`
	Timeout *UpstreamTimeout     `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	TLS     *ClientTLS           `json:"tls,omitempty" yaml:"tls,omitempty"`

	// for Service Discovery
	ServiceName   string            `json:"service_name,omitempty" yaml:"service_name,omitempty"`
	DiscoveryType string            `json:"discovery_type,omitempty" yaml:"discovery_type,omitempty"`
	DiscoveryArgs map[string]string `json:"discovery_args,omitempty" yaml:"discovery_args,omitempty"`
}

Upstream is the definition of the upstream on Service.

type UpstreamActiveHealthCheck

type UpstreamActiveHealthCheck struct {
	Type               string                             `json:"type,omitempty" yaml:"type,omitempty"`
	Timeout            int                                `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Concurrency        int                                `json:"concurrency,omitempty" yaml:"concurrency,omitempty"`
	Host               string                             `json:"host,omitempty" yaml:"host,omitempty"`
	Port               int32                              `json:"port,omitempty" yaml:"port,omitempty"`
	HTTPPath           string                             `json:"http_path,omitempty" yaml:"http_path,omitempty"`
	HTTPSVerifyCert    bool                               `json:"https_verify_certificate,omitempty" yaml:"https_verify_certificate,omitempty"`
	HTTPRequestHeaders []string                           `json:"req_headers,omitempty" yaml:"req_headers,omitempty"`
	Healthy            UpstreamActiveHealthCheckHealthy   `json:"healthy,omitempty" yaml:"healthy,omitempty"`
	Unhealthy          UpstreamActiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
}

UpstreamActiveHealthCheck defines the active kind of upstream health check. +k8s:deepcopy-gen=true

type UpstreamActiveHealthCheckHealthy

type UpstreamActiveHealthCheckHealthy struct {
	UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"`

	Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckHealthy defines the conditions to judge whether an upstream node is healthy with the active manner. +k8s:deepcopy-gen=true

type UpstreamActiveHealthCheckUnhealthy

type UpstreamActiveHealthCheckUnhealthy struct {
	UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"`

	Interval int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckUnhealthy defines the conditions to judge whether an upstream node is unhealthy with the active manager. +k8s:deepcopy-gen=true

type UpstreamHealthCheck

type UpstreamHealthCheck struct {
	Active  *UpstreamActiveHealthCheck  `json:"active" yaml:"active"`
	Passive *UpstreamPassiveHealthCheck `json:"passive,omitempty" yaml:"passive,omitempty"`
}

UpstreamHealthCheck defines the active and/or passive health check for an Upstream, with the upstream health check feature, pods can be kicked out or joined in quickly, if the feedback of Kubernetes liveness/readiness probe is long. +k8s:deepcopy-gen=true

type UpstreamNode

type UpstreamNode struct {
	Host   string `json:"host,omitempty" yaml:"host,omitempty"`
	Port   int    `json:"port,omitempty" yaml:"port,omitempty"`
	Weight int    `json:"weight,omitempty" yaml:"weight,omitempty"`
}

UpstreamNode is the node in upstream +k8s:deepcopy-gen=true

type UpstreamNodes

type UpstreamNodes []UpstreamNode

UpstreamNodes is the upstream node list.

func (*UpstreamNodes) UnmarshalJSON

func (n *UpstreamNodes) UnmarshalJSON(p []byte) error

UnmarshalJSON implements json.Unmarshaler interface. lua-cjson doesn't distinguish empty array and table, and by default empty array will be encoded as '{}'. We have to maintain the compatibility.

type UpstreamPassiveHealthCheck

type UpstreamPassiveHealthCheck struct {
	Type      string                              `json:"type,omitempty" yaml:"type,omitempty"`
	Healthy   UpstreamPassiveHealthCheckHealthy   `json:"healthy,omitempty" yaml:"healthy,omitempty"`
	Unhealthy UpstreamPassiveHealthCheckUnhealthy `json:"unhealthy,omitempty" yaml:"unhealthy,omitempty"`
}

UpstreamPassiveHealthCheck defines the passive kind of upstream health check. +k8s:deepcopy-gen=true

type UpstreamPassiveHealthCheckHealthy

type UpstreamPassiveHealthCheckHealthy struct {
	HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
	Successes    int   `json:"successes,omitempty" yaml:"successes,omitempty"`
}

UpstreamPassiveHealthCheckHealthy defines the conditions to judge whether an upstream node is healthy with the passive manner. +k8s:deepcopy-gen=true

type UpstreamPassiveHealthCheckUnhealthy

type UpstreamPassiveHealthCheckUnhealthy struct {
	HTTPStatuses []int `json:"http_statuses,omitempty" yaml:"http_statuses,omitempty"`
	HTTPFailures int   `json:"http_failures,omitempty" yaml:"http_failures,omitempty"`
	TCPFailures  int   `json:"tcp_failures,omitempty" yaml:"tcp_failures,omitempty"`
	Timeouts     int   `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
}

UpstreamPassiveHealthCheckUnhealthy defines the conditions to judge whether an upstream node is unhealthy with the passive manager. +k8s:deepcopy-gen=true

type UpstreamTimeout

type UpstreamTimeout struct {
	// Connect is the connect timeout
	Connect int `json:"connect" yaml:"connect"`
	// Send is the send timeout
	Send int `json:"send" yaml:"send"`
	// Read is the read timeout
	Read int `json:"read" yaml:"read"`
}

UpstreamTimeout represents the timeout settings on Upstream.

type Vars

type Vars [][]StringOrSlice

Vars represents the route match expressions of APISIX.

Jump to

Keyboard shortcuts

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