apisix

package
v0.0.0-...-fe055a6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableAPISIXStandalone

func EnableAPISIXStandalone(apisixConfig *[]utils.YamlItem) error

func MarshalYaml

func MarshalYaml(apisixConfig *Config) ([]byte, error)

func WriteToFile

func WriteToFile(apisixYamlPath string, apisixYaml []byte) error

Types

type BasicAuthCredential

type BasicAuthCredential struct {
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
}

type Config

type Config struct {
	Services    Services    `json:"services,omitempty" yaml:"services,omitempty"`
	Routes      Routes      `json:"routes,omitempty" yaml:"routes,omitempty"`
	Upstreams   Upstreams   `json:"upstreams,omitempty" yaml:"upstreams,omitempty"`
	GlobalRules GlobalRules `json:"global_rules,omitempty" yaml:"global_rules,omitempty"`
	Consumers   Consumers   `json:"consumers,omitempty" yaml:"consumers,omitempty"`
}

type Consumer

type Consumer struct {
	ID       string            `json:"id,omitempty" yaml:"id,omitempty"`
	Username string            `json:"username" yaml:"username"`
	Desc     string            `json:"desc,omitempty" yaml:"desc,omitempty"`
	Labels   map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Plugins  ConsumerPlugins   `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}

Consumer Configuration Consumer is the apisix consumer definition.

type ConsumerPlugins

type ConsumerPlugins struct {
	KeyAuth   *KeyAuthCredential   `json:"key-auth,omitempty" yaml:"key-auth,omitempty"`
	BasicAuth *BasicAuthCredential `json:"basic-auth,omitempty" yaml:"basic-auth,omitempty"`
	HmacAuth  *HmacAuthCredential  `json:"hmac-auth,omitempty" yaml:"hmac-auth,omitempty"`
	JwtAuth   *JwtSecrets          `json:"jwt-auth,omitempty" yaml:"jwt-auth,omitempty"`
}

type Consumers

type Consumers []Consumer

type GlobalRule

type GlobalRule struct {
	ID      string  `json:"id,omitempty" yaml:"id,omitempty"`
	Plugins Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}

GlobalRule Configuration GlobalRule is the apisix global_rules definition.

type GlobalRules

type GlobalRules []GlobalRule

type HmacAuthCredential

type HmacAuthCredential struct {
	AccessKey     string   `json:"access_key,omitempty" yaml:"access_key,omitempty"`
	SecretKey     string   `json:"secret_key,omitempty" yaml:"secret_key,omitempty"`
	ClockSkew     string   `json:"clock_skew,omitempty" yaml:"clock_skew,omitempty"`
	SignedHeaders []string `json:"signed_headers,omitempty" yaml:"signed_headers,omitempty"`
}

type JwtSecrets

type JwtSecrets struct {
	Key       string `json:"key,omitempty" yaml:"key,omitempty"`
	Secret    string `json:"secret,omitempty" yaml:"secret,omitempty"`
	Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,omitempty"`
}

type KeyAuth

type KeyAuth struct {
	Header string `json:"header,omitempty" yaml:"header,omitempty"`
	Query  string `json:"query,omitempty" yaml:"query,omitempty"`
}

type KeyAuthCredential

type KeyAuthCredential struct {
	Key string `json:"key,omitempty" yaml:"key,omitempty"`
}

type LimitCount

type LimitCount struct {
	Count                int      `json:"count,omitempty" yaml:"count,omitempty"`
	TimeWindow           int      `json:"time_window,omitempty" yaml:"time_window,omitempty"`
	Key                  string   `json:"key,omitempty" yaml:"key,omitempty"`
	RejectedCode         int      `json:"rejected_code,omitempty" yaml:"rejected_code,omitempty"`
	RejectedMsg          string   `json:"rejected_msg,omitempty" yaml:"rejected_msg,omitempty"`
	Policy               string   `json:"policy,omitempty" yaml:"policy,omitempty"`
	AllowDegradation     bool     `json:"allow_degradation,omitempty" yaml:"allow_degradation,omitempty"`
	ShowLimitQuotaHeader bool     `json:"show_limit_quota_header,omitempty" yaml:"show_limit_quota_header,omitempty"`
	RedisHost            string   `json:"redis_host,omitempty" yaml:"redis_host,omitempty"`
	RedisPort            int      `json:"redis_port,omitempty" yaml:"redis_port,omitempty"`
	RedisPassword        string   `json:"redis_password,omitempty" yaml:"redis_password,omitempty"`
	RedisDatabase        int      `json:"redis_database,omitempty" yaml:"redis_database,omitempty"`
	RedisTimeout         int      `json:"redis_timeout,omitempty" yaml:"redis_timeout,omitempty"`
	RedisClusterNodes    []string `json:"redis_cluster_nodes,omitempty" yaml:"redis_cluster_nodes,omitempty"`
	RedisClusterName     string   `json:"redis_cluster_name,omitempty" yaml:"redis_cluster_name,omitempty"`
}

type Plugins

type Plugins struct {
	KeyAuth      *KeyAuth      `json:"key-auth,omitempty" yaml:"key-auth,omitempty"`
	ProxyRewrite *ProxyRewrite `json:"proxy-rewrite,omitempty" yaml:"proxy-rewrite,omitempty"`
	LimitCount   *LimitCount   `json:"limit-count,omitempty" yaml:"limit-count,omitempty"`
	ProxyCache   *ProxyCache   `json:"proxy-cache,omitempty" yaml:"proxy-cache,omitempty"`
}

Plugins Configuration Plugins is the apisix plugins definition

type ProxyCache

type ProxyCache struct {
	CacheZone        string   `json:"cache_zone,omitempty" yaml:"cache_zone,omitempty"`
	CacheKey         []string `json:"cache_key,omitempty" yaml:"cache_key,omitempty"`
	CacheBypass      []string `json:"cache_bypass,omitempty" yaml:"cache_bypass,omitempty"`
	CacheMethod      []string `json:"cache_method,omitempty" yaml:"cache_method,omitempty"`
	CacheHttpStatus  []int    `json:"cache_http_status,omitempty" yaml:"cache_http_status,omitempty"`
	HideCacheHeaders bool     `json:"hide_cache_headers,omitempty" yaml:"hide_cache_headers,omitempty"`
	NoCache          []string `json:"no_cache,omitempty" yaml:"no_cache,omitempty"`
}

type ProxyRewrite

type ProxyRewrite struct {
	Scheme   string            `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	URI      string            `json:"uri,omitempty" yaml:"uri,omitempty"`
	RegexURI []string          `json:"regex_uri,omitempty" yaml:"regex_uri,omitempty"`
	Host     string            `json:"host,omitempty" yaml:"host,omitempty"`
	Headers  map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
}

type Route

type Route struct {
	ID              string            `json:"id,omitempty" yaml:"id,omitempty"`
	Name            string            `json:"name,omitempty" yaml:"name,omitempty"`
	URI             string            `json:"uri,omitempty" yaml:"uri,omitempty"`
	URIs            []string          `json:"uris,omitempty" yaml:"uris,omitempty"`
	Host            string            `json:"host,omitempty" yaml:"host,omitempty"`
	Hosts           []string          `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	RemoteAddress   string            `json:"remote_addr,omitempty" yaml:"remote_addr,omitempty"`
	RemoteAddresses []string          `json:"remote_addrs,omitempty" yaml:"remote_addrs,omitempty"`
	Methods         []string          `json:"methods,omitempty" yaml:"methods,omitempty"`
	Priority        uint              `json:"priority,omitempty" yaml:"priority,omitempty"`
	Vars            [][]string        `json:"vars,omitempty" yaml:"vars,omitempty"`
	FilterFunc      string            `json:"filter_func,omitempty" yaml:"filter_func,omitempty"`
	Plugins         Plugins           `json:"plugins,omitempty" yaml:"plugins,omitempty"`
	Script          string            `json:"script,omitempty" yaml:"script,omitempty"`
	Upstream        *Upstream         `json:"upstream,omitempty" yaml:"upstream,omitempty"`
	UpstreamID      string            `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
	ServiceID       string            `json:"service_id,omitempty" yaml:"service_id,omitempty"`
	PluginConfigID  string            `json:"plugin_config_id,omitempty" yaml:"plugin_config_id,omitempty"`
	Labels          map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Timeout         UpstreamTimeout   `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	EnableWebsocket bool              `json:"enable_websocket,omitempty" yaml:"enable_websocket,omitempty"`
	Status          uint              `json:"status,omitempty" yaml:"status,omitempty"`
}

Route Configuration Route is the apisix route definition.

type Routes

type Routes []Route

type SSL

type SSL struct {
	ID     string            `json:"id,omitempty" yaml:"id,omitempty"`
	Cert   string            `json:"cert,omitempty" yaml:"cert,omitempty"`
	Key    string            `json:"key,omitempty" yaml:"key,omitempty"`
	Certs  []string          `json:"certs,omitempty" yaml:"certs,omitempty"`
	Keys   []string          `json:"keys,omitempty" yaml:"keys,omitempty"`
	Client SSLClient         `json:"client,omitempty" yaml:"client,omitempty"`
	SNIs   []string          `json:"snis,omitempty" yaml:"snis,omitempty"`
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Status uint              `json:"status,omitempty" yaml:"status,omitempty"`
}

SSL Configuration SSL is the apisix ssl definition.

type SSLClient

type SSLClient struct {
	CA    string `json:"ca,omitempty" yaml:"ca,omitempty"`
	Depth uint   `json:"depth,omitempty" yaml:"depth,omitempty"`
}

SSLClient is the apisix ssl.client definition.

type SSLs

type SSLs []SSL

type Service

type Service struct {
	ID              string            `json:"id,omitempty" yaml:"id,omitempty"`
	Name            string            `json:"name,omitempty" yaml:"name,omitempty"`
	Desc            string            `json:"desc,omitempty" yaml:"desc,omitempty"`
	Labels          map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	EnableWebsocket bool              `json:"enable_websocket,omitempty" yaml:"enable_websocket,omitempty"`
	Hosts           []string          `json:"hosts,omitempty" yaml:"hosts,omitempty"`
	Upstream        *Upstream         `json:"upstreams,omitempty" yaml:"upstreams,omitempty"`
	UpstreamID      string            `json:"upstream_id,omitempty" yaml:"upstream_id,omitempty"`
	Plugins         Plugins           `json:"plugins,omitempty" yaml:"plugins,omitempty"`
}

Service Configuration Service apisix route definition

type Services

type Services []Service

type Upstream

type Upstream struct {
	ID            string                `json:"id,omitempty" yaml:"id,omitempty"`
	Name          string                `json:"name,omitempty" yaml:"name,omitempty"`
	Desc          string                `json:"desc,omitempty" yaml:"desc,omitempty"`
	Type          string                `json:"type,omitempty" yaml:"type,omitempty"`
	Nodes         UpstreamNodes         `json:"nodes,omitempty" yaml:"nodes,omitempty"`
	ServiceName   string                `json:"service_name,omitempty" yaml:"service_name,omitempty"`
	DiscoveryType string                `json:"discovery_type,omitempty" yaml:"discovery_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"`
	Retries       uint                  `json:"retries,omitempty" yaml:"retries,omitempty"`
	RetryTimeout  uint                  `json:"retry_timeout,omitempty" yaml:"retry_timeout,omitempty"`
	Timeout       UpstreamTimeout       `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	PassHost      string                `json:"pass_host,omitempty" yaml:"pass_host,omitempty"`
	UpstreamHost  string                `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"`
	Scheme        string                `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	Labels        map[string]string     `json:"labels,omitempty" yaml:"labels,omitempty"`
	TLS           UpstreamTLS           `json:"tls,omitempty" yaml:"tls,omitempty"`
	KeepalivePool UpstreamKeepalivePool `json:"keepalive_pool,omitempty" yaml:"keepalive_pool,omitempty"`
}

Upstream Configuration Upstream is the apisix upstream definition.

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"`
	RequestHeaders  []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 is the apisix upstream.checks.active definition.

type UpstreamActiveHealthCheckHealthy

type UpstreamActiveHealthCheckHealthy struct {
	UpstreamPassiveHealthCheckHealthy `json:",inline" yaml:",inline"`
	Interval                          int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckHealthy is the apisix upstream.checks.active.healthy definition.

type UpstreamActiveHealthCheckUnhealthy

type UpstreamActiveHealthCheckUnhealthy struct {
	UpstreamPassiveHealthCheckUnhealthy `json:",inline" yaml:",inline"`
	Interval                            int `json:"interval,omitempty" yaml:"interval,omitempty"`
}

UpstreamActiveHealthCheckUnhealthy is the apisix upstream.checks.active.unhealthy definition.

type UpstreamHealthCheck

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

UpstreamHealthCheck is the apisix upstream.checks definition.

type UpstreamKeepalivePool

type UpstreamKeepalivePool struct {
	Size        uint `json:"size,omitempty" yaml:"size,omitempty"`
	IdleTimeout uint `json:"idle_timeout,omitempty" yaml:"idle_timeout,omitempty"`
	Requests    uint `json:"requests,omitempty" yaml:"requests,omitempty"`
}

UpstreamKeepalivePool is the apisix upstream.keepalive_pool definition.

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 apisix upstream[index].node definition.

type UpstreamNodes

type UpstreamNodes []UpstreamNode

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 is the apisix upstream.checks.passive definition.

type UpstreamPassiveHealthCheckHealthy

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

UpstreamPassiveHealthCheckHealthy is the apisix upstream.checks.passive.healthy definition.

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     float64 `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
}

UpstreamPassiveHealthCheckUnhealthy is the apisix upstream.checks.passive.unhealthy definition.

type UpstreamTLS

type UpstreamTLS struct {
	ClientCert string `json:"client_cert,omitempty" yaml:"client_cert,omitempty"`
	ClientKey  string `json:"client_key,omitempty" yaml:"client_key,omitempty"`
}

UpstreamTLS is the apisix upstream.tls definition.

type UpstreamTimeout

type UpstreamTimeout struct {
	Connect float32 `json:"connect,omitempty" yaml:"connect,omitempty"`
	Send    float32 `json:"send,omitempty" yaml:"send,omitempty"`
	Read    float32 `json:"read,omitempty" yaml:"read,omitempty"`
}

UpstreamTimeout is the apisix upstream.timeout definition.

type Upstreams

type Upstreams []Upstream

Jump to

Keyboard shortcuts

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