apisix

package
v0.0.5-0...-8e55a6f Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOption = errors.New("apisix endpoint and apiKey are required")
)
View Source
var File_apisix_apisix_proto protoreflect.FileDescriptor

Functions

func LoadFromYaml

func LoadFromYaml(data []byte)

func WalkModules

func WalkModules(f func(module *Module) error) error

Types

type AdminClient

type AdminClient struct {
	// contains filtered or unexported fields
}

func NewAdminClient

func NewAdminClient(endpoint string, apiKey string) (*AdminClient, error)

func (*AdminClient) PutGlobalRules

func (a *AdminClient) PutGlobalRules(id string, route *structpb.Struct) error

PutGlobalRules https://apisix.apache.org/docs/apisix/admin-api/#global-rule-api

func (*AdminClient) PutStreamRoute

func (a *AdminClient) PutStreamRoute(id string, route *structpb.Struct) error

PutStreamRoute https://apisix.apache.org/docs/apisix/admin-api/#stream-route-api

func (*AdminClient) PutUpstream

func (a *AdminClient) PutUpstream(id string, upstream *Upstream) error

PutUpstream https://apisix.apache.org/docs/apisix/admin-api/#upstream-api

func (*AdminClient) PutUpstreamStruct

func (a *AdminClient) PutUpstreamStruct(id string, upstream *structpb.Struct) error

PutUpstreamStruct https://apisix.apache.org/docs/apisix/admin-api/#upstream-api

type Config

type Config struct {
	Endpoint string    `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	ApiKey   string    `protobuf:"bytes,2,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
	Modules  []*Module `protobuf:"bytes,3,rep,name=modules,proto3" json:"modules,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetApiKey

func (x *Config) GetApiKey() string

func (*Config) GetEndpoint

func (x *Config) GetEndpoint() string

func (*Config) GetModules

func (x *Config) GetModules() []*Module

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

func (*Config) Validate

func (m *Config) Validate() error

Validate checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Config) ValidateAll

func (m *Config) ValidateAll() error

ValidateAll checks the field values on Config with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfigMultiError, or nil if none found.

type ConfigMultiError

type ConfigMultiError []error

ConfigMultiError is an error wrapping multiple validation errors returned by Config.ValidateAll() if the designated constraints aren't met.

func (ConfigMultiError) AllErrors

func (m ConfigMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ConfigMultiError) Error

func (m ConfigMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ConfigValidationError

type ConfigValidationError struct {
	// contains filtered or unexported fields
}

ConfigValidationError is the validation error returned by Config.Validate if the designated constraints aren't met.

func (ConfigValidationError) Cause

func (e ConfigValidationError) Cause() error

Cause function returns cause value.

func (ConfigValidationError) Error

func (e ConfigValidationError) Error() string

Error satisfies the builtin error interface

func (ConfigValidationError) ErrorName

func (e ConfigValidationError) ErrorName() string

ErrorName returns error name.

func (ConfigValidationError) Field

func (e ConfigValidationError) Field() string

Field function returns field value.

func (ConfigValidationError) Key

func (e ConfigValidationError) Key() bool

Key function returns key value.

func (ConfigValidationError) Reason

func (e ConfigValidationError) Reason() string

Reason function returns reason value.

type Module

type Module struct {

	// https://apisix.apache.org/docs/apisix/admin-api/#route
	Routes map[string]*structpb.Struct `` /* 154-byte string literal not displayed */
	// https://apisix.apache.org/docs/apisix/admin-api/#global-rule
	GlobalRules map[string]*structpb.Struct `` /* 183-byte string literal not displayed */
	// https://apisix.apache.org/docs/apisix/admin-api/#upstream
	Upstreams map[string]*structpb.Struct `` /* 160-byte string literal not displayed */
	// https://apisix.apache.org/docs/apisix/admin-api/#stream-route
	StreamRoutes map[string]*structpb.Struct `` /* 186-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Module) Descriptor deprecated

func (*Module) Descriptor() ([]byte, []int)

Deprecated: Use Module.ProtoReflect.Descriptor instead.

func (*Module) GetGlobalRules

func (x *Module) GetGlobalRules() map[string]*structpb.Struct

func (*Module) GetRoutes

func (x *Module) GetRoutes() map[string]*structpb.Struct

func (*Module) GetStreamRoutes

func (x *Module) GetStreamRoutes() map[string]*structpb.Struct

func (*Module) GetUpstreams

func (x *Module) GetUpstreams() map[string]*structpb.Struct

func (*Module) ProtoMessage

func (*Module) ProtoMessage()

func (*Module) ProtoReflect

func (x *Module) ProtoReflect() protoreflect.Message

func (*Module) Reset

func (x *Module) Reset()

func (*Module) String

func (x *Module) String() string

func (*Module) Validate

func (m *Module) Validate() error

Validate checks the field values on Module with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Module) ValidateAll

func (m *Module) ValidateAll() error

ValidateAll checks the field values on Module with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ModuleMultiError, or nil if none found.

type ModuleMultiError

type ModuleMultiError []error

ModuleMultiError is an error wrapping multiple validation errors returned by Module.ValidateAll() if the designated constraints aren't met.

func (ModuleMultiError) AllErrors

func (m ModuleMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ModuleMultiError) Error

func (m ModuleMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ModuleValidationError

type ModuleValidationError struct {
	// contains filtered or unexported fields
}

ModuleValidationError is the validation error returned by Module.Validate if the designated constraints aren't met.

func (ModuleValidationError) Cause

func (e ModuleValidationError) Cause() error

Cause function returns cause value.

func (ModuleValidationError) Error

func (e ModuleValidationError) Error() string

Error satisfies the builtin error interface

func (ModuleValidationError) ErrorName

func (e ModuleValidationError) ErrorName() string

ErrorName returns error name.

func (ModuleValidationError) Field

func (e ModuleValidationError) Field() string

Field function returns field value.

func (ModuleValidationError) Key

func (e ModuleValidationError) Key() bool

Key function returns key value.

func (ModuleValidationError) Reason

func (e ModuleValidationError) Reason() string

Reason function returns reason value.

type Node

type Node struct {
	Host   string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Port   uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	Weight int64  `protobuf:"varint,3,opt,name=weight,proto3" json:"weight,omitempty"`
	// contains filtered or unexported fields
}

func (*Node) Descriptor deprecated

func (*Node) Descriptor() ([]byte, []int)

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetHost

func (x *Node) GetHost() string

func (*Node) GetPort

func (x *Node) GetPort() uint64

func (*Node) GetWeight

func (x *Node) GetWeight() int64

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

func (*Node) Validate

func (m *Node) Validate() error

Validate checks the field values on Node with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Node) ValidateAll

func (m *Node) ValidateAll() error

ValidateAll checks the field values on Node with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in NodeMultiError, or nil if none found.

type NodeMultiError

type NodeMultiError []error

NodeMultiError is an error wrapping multiple validation errors returned by Node.ValidateAll() if the designated constraints aren't met.

func (NodeMultiError) AllErrors

func (m NodeMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (NodeMultiError) Error

func (m NodeMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type NodeValidationError

type NodeValidationError struct {
	// contains filtered or unexported fields
}

NodeValidationError is the validation error returned by Node.Validate if the designated constraints aren't met.

func (NodeValidationError) Cause

func (e NodeValidationError) Cause() error

Cause function returns cause value.

func (NodeValidationError) Error

func (e NodeValidationError) Error() string

Error satisfies the builtin error interface

func (NodeValidationError) ErrorName

func (e NodeValidationError) ErrorName() string

ErrorName returns error name.

func (NodeValidationError) Field

func (e NodeValidationError) Field() string

Field function returns field value.

func (NodeValidationError) Key

func (e NodeValidationError) Key() bool

Key function returns key value.

func (NodeValidationError) Reason

func (e NodeValidationError) Reason() string

Reason function returns reason value.

type Option

type Option struct {
	Services []string
	Timeout  time.Duration
}

type Upstream

type Upstream struct {
	Nodes  []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
	Type   string  `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Scheme string  `protobuf:"bytes,3,opt,name=scheme,proto3" json:"scheme,omitempty"`
	Name   string  `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Upstream) Descriptor deprecated

func (*Upstream) Descriptor() ([]byte, []int)

Deprecated: Use Upstream.ProtoReflect.Descriptor instead.

func (*Upstream) GetName

func (x *Upstream) GetName() string

func (*Upstream) GetNodes

func (x *Upstream) GetNodes() []*Node

func (*Upstream) GetScheme

func (x *Upstream) GetScheme() string

func (*Upstream) GetType

func (x *Upstream) GetType() string

func (*Upstream) ProtoMessage

func (*Upstream) ProtoMessage()

func (*Upstream) ProtoReflect

func (x *Upstream) ProtoReflect() protoreflect.Message

func (*Upstream) Reset

func (x *Upstream) Reset()

func (*Upstream) String

func (x *Upstream) String() string

func (*Upstream) Validate

func (m *Upstream) Validate() error

Validate checks the field values on Upstream with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Upstream) ValidateAll

func (m *Upstream) ValidateAll() error

ValidateAll checks the field values on Upstream with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UpstreamMultiError, or nil if none found.

type UpstreamMultiError

type UpstreamMultiError []error

UpstreamMultiError is an error wrapping multiple validation errors returned by Upstream.ValidateAll() if the designated constraints aren't met.

func (UpstreamMultiError) AllErrors

func (m UpstreamMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UpstreamMultiError) Error

func (m UpstreamMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type UpstreamValidationError

type UpstreamValidationError struct {
	// contains filtered or unexported fields
}

UpstreamValidationError is the validation error returned by Upstream.Validate if the designated constraints aren't met.

func (UpstreamValidationError) Cause

func (e UpstreamValidationError) Cause() error

Cause function returns cause value.

func (UpstreamValidationError) Error

func (e UpstreamValidationError) Error() string

Error satisfies the builtin error interface

func (UpstreamValidationError) ErrorName

func (e UpstreamValidationError) ErrorName() string

ErrorName returns error name.

func (UpstreamValidationError) Field

func (e UpstreamValidationError) Field() string

Field function returns field value.

func (UpstreamValidationError) Key

func (e UpstreamValidationError) Key() bool

Key function returns key value.

func (UpstreamValidationError) Reason

func (e UpstreamValidationError) Reason() string

Reason function returns reason value.

type WatchSyncAdmin

type WatchSyncAdmin struct {
	// contains filtered or unexported fields
}

func NewWatchSyncAdmin

func NewWatchSyncAdmin(discovery registry.Discovery, adminClient *AdminClient, opt *Option) *WatchSyncAdmin

func (*WatchSyncAdmin) Start

func (w *WatchSyncAdmin) Start(ctx context.Context) (err error)

func (*WatchSyncAdmin) Stop

func (w *WatchSyncAdmin) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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