client

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBuilder

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

APIBuilder api builder

func (*APIBuilder) AddBlacklist

func (ab *APIBuilder) AddBlacklist(ips ...string) *APIBuilder

AddBlacklist add ip black list

func (*APIBuilder) AddDefaultValueCookie

func (ab *APIBuilder) AddDefaultValueCookie(name, value string) *APIBuilder

AddDefaultValueCookie add default value cookie

func (*APIBuilder) AddDefaultValueHeader

func (ab *APIBuilder) AddDefaultValueHeader(name, value string) *APIBuilder

AddDefaultValueHeader add default value header

func (*APIBuilder) AddDispatchNode

func (ab *APIBuilder) AddDispatchNode(cluster uint64) *APIBuilder

AddDispatchNode add a dispatch node

func (*APIBuilder) AddDispatchNodeValidation

func (ab *APIBuilder) AddDispatchNodeValidation(cluster uint64, param metapb.Parameter, rule string, required bool) *APIBuilder

AddDispatchNodeValidation add dispatch node validation

func (*APIBuilder) AddPerm

func (ab *APIBuilder) AddPerm(perm string) *APIBuilder

AddPerm add a perm

func (*APIBuilder) AddWhitelist

func (ab *APIBuilder) AddWhitelist(ips ...string) *APIBuilder

AddWhitelist add ip white list

func (*APIBuilder) AuthPlugin

func (ab *APIBuilder) AuthPlugin(name string) *APIBuilder

AuthPlugin set a auth filter plugin

func (*APIBuilder) Commit

func (ab *APIBuilder) Commit() (uint64, error)

Commit commit

func (*APIBuilder) DefaultValue

func (ab *APIBuilder) DefaultValue(value []byte) *APIBuilder

DefaultValue set default value

func (*APIBuilder) DispatchNodeURLRewrite

func (ab *APIBuilder) DispatchNodeURLRewrite(cluster uint64, urlRewrite string) *APIBuilder

DispatchNodeURLRewrite set dispatch node url rewrite

func (*APIBuilder) DispatchNodeValueAttrName

func (ab *APIBuilder) DispatchNodeValueAttrName(cluster uint64, attrName string) *APIBuilder

DispatchNodeValueAttrName set dispatch node attr name of value

func (*APIBuilder) Down

func (ab *APIBuilder) Down() *APIBuilder

Down down this api

func (*APIBuilder) MatchDomain

func (ab *APIBuilder) MatchDomain(domain string) *APIBuilder

MatchDomain set a match domain

func (*APIBuilder) MatchMethod

func (ab *APIBuilder) MatchMethod(method string) *APIBuilder

MatchMethod set a match method

func (*APIBuilder) MatchURLPattern

func (ab *APIBuilder) MatchURLPattern(urlPattern string) *APIBuilder

MatchURLPattern set a match path

func (*APIBuilder) Name

func (ab *APIBuilder) Name(name string) *APIBuilder

Name set a name

func (*APIBuilder) NoBlacklist

func (ab *APIBuilder) NoBlacklist() *APIBuilder

NoBlacklist set no blacklist

func (*APIBuilder) NoDefaultValue

func (ab *APIBuilder) NoDefaultValue() *APIBuilder

NoDefaultValue set no default value

func (*APIBuilder) NoWhitelist

func (ab *APIBuilder) NoWhitelist() *APIBuilder

NoWhitelist set no whiltelist

func (*APIBuilder) RemoveBlacklist

func (ab *APIBuilder) RemoveBlacklist(ips ...string) *APIBuilder

RemoveBlacklist remove ip white list

func (*APIBuilder) RemoveDispatchNodeURLRewrite

func (ab *APIBuilder) RemoveDispatchNodeURLRewrite(cluster uint64) *APIBuilder

RemoveDispatchNodeURLRewrite remove dispatch node

func (*APIBuilder) RemovePerm

func (ab *APIBuilder) RemovePerm(perm string) *APIBuilder

RemovePerm remove a perm

func (*APIBuilder) RemoveWhitelist

func (ab *APIBuilder) RemoveWhitelist(ips ...string) *APIBuilder

RemoveWhitelist remove ip white list

func (*APIBuilder) UP

func (ab *APIBuilder) UP() *APIBuilder

UP up this api

func (*APIBuilder) Use

func (ab *APIBuilder) Use(value metapb.API) *APIBuilder

Use use a cluster

type Client

type Client interface {
	NewClusterBuilder() *ClusterBuilder
	RemoveCluster(id uint64) error
	GetCluster(id uint64) (*metapb.Cluster, error)
	GetClusterList(fn func(*metapb.Cluster) bool) error

	NewServerBuilder() *ServerBuilder
	RemoveServer(id uint64) error
	GetServer(id uint64) (*metapb.Server, error)
	GetServerList(fn func(*metapb.Server) bool) error

	NewAPIBuilder() *APIBuilder
	RemoveAPI(id uint64) error
	GetAPI(id uint64) (*metapb.API, error)
	GetAPIList(fn func(*metapb.API) bool) error

	NewRoutingBuilder() *RoutingBuilder
	RemoveRouting(id uint64) error
	GetRouting(id uint64) (*metapb.Routing, error)
	GetRoutingList(fn func(*metapb.Routing) bool) error

	AddBind(cluster, server uint64) error
	RemoveBind(cluster, server uint64) error
	RemoveClusterBind(cluster uint64) error
	GetBindServers(cluster uint64) ([]uint64, error)
}

Client gateway client

func NewClient

func NewClient(timeout time.Duration, addrs ...string) (Client, error)

NewClient returns a gateway client, using direct address

func NewClientWithEtcdDiscovery

func NewClientWithEtcdDiscovery(prefix string, timeout time.Duration, etcdAddrs ...string) (Client, error)

NewClientWithEtcdDiscovery returns a gateway client, using etcd service discovery

type ClusterBuilder

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

ClusterBuilder cluster builder

func (*ClusterBuilder) Commit

func (cb *ClusterBuilder) Commit() (uint64, error)

Commit commit

func (*ClusterBuilder) Loadbalance

func (cb *ClusterBuilder) Loadbalance(lb metapb.LoadBalance) *ClusterBuilder

Loadbalance set a loadbalance

func (*ClusterBuilder) Name

func (cb *ClusterBuilder) Name(name string) *ClusterBuilder

Name set a name

func (*ClusterBuilder) Use

func (cb *ClusterBuilder) Use(value metapb.Cluster) *ClusterBuilder

Use use a cluster

type RoutingBuilder

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

RoutingBuilder routing builder

func (*RoutingBuilder) AddCondition

func (rb *RoutingBuilder) AddCondition(param metapb.Parameter, op metapb.CMP, expect string) *RoutingBuilder

AddCondition add condition

func (*RoutingBuilder) Commit

func (rb *RoutingBuilder) Commit() (uint64, error)

Commit commit

func (*RoutingBuilder) Down

func (rb *RoutingBuilder) Down() *RoutingBuilder

Down down this routing

func (*RoutingBuilder) Strategy

func (rb *RoutingBuilder) Strategy(strategy metapb.RoutingStrategy) *RoutingBuilder

Strategy set strategy for this routing

func (*RoutingBuilder) To

func (rb *RoutingBuilder) To(clusterID uint64) *RoutingBuilder

To routing to

func (*RoutingBuilder) TrafficRate

func (rb *RoutingBuilder) TrafficRate(rate int) *RoutingBuilder

TrafficRate set traffic rate for this routing

func (*RoutingBuilder) Up

func (rb *RoutingBuilder) Up() *RoutingBuilder

Up up this routing

func (*RoutingBuilder) Use

func (rb *RoutingBuilder) Use(value metapb.Routing) *RoutingBuilder

Use use a cluster

type ServerBuilder

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

ServerBuilder server builder

func (*ServerBuilder) Addr

func (sb *ServerBuilder) Addr(addr string) *ServerBuilder

Addr set addr

func (*ServerBuilder) CheckHTTPBody

func (sb *ServerBuilder) CheckHTTPBody(path, body string, interval time.Duration, timeout time.Duration) *ServerBuilder

CheckHTTPBody use a heath check

func (*ServerBuilder) CheckHTTPCode

func (sb *ServerBuilder) CheckHTTPCode(path string, interval time.Duration, timeout time.Duration) *ServerBuilder

CheckHTTPCode use a heath check

func (*ServerBuilder) CircuitBreakerCheckPeriod

func (sb *ServerBuilder) CircuitBreakerCheckPeriod(checkPeriod time.Duration) *ServerBuilder

CircuitBreakerCheckPeriod set circuit breaker period

func (*ServerBuilder) CircuitBreakerCloseToHalfTimeout

func (sb *ServerBuilder) CircuitBreakerCloseToHalfTimeout(timeout time.Duration) *ServerBuilder

CircuitBreakerCloseToHalfTimeout set circuit breaker timeout that close status convert to half

func (*ServerBuilder) CircuitBreakerHalfToCloseCondition

func (sb *ServerBuilder) CircuitBreakerHalfToCloseCondition(failureRate int) *ServerBuilder

CircuitBreakerHalfToCloseCondition set circuit breaker condition of half convert to close

func (*ServerBuilder) CircuitBreakerHalfToOpenCondition

func (sb *ServerBuilder) CircuitBreakerHalfToOpenCondition(succeedRate int) *ServerBuilder

CircuitBreakerHalfToOpenCondition set circuit breaker condition of half convert to open

func (*ServerBuilder) CircuitBreakerHalfTrafficRate

func (sb *ServerBuilder) CircuitBreakerHalfTrafficRate(rate int) *ServerBuilder

CircuitBreakerHalfTrafficRate set circuit breaker traffic in half status

func (*ServerBuilder) Commit

func (sb *ServerBuilder) Commit() (uint64, error)

Commit commit

func (*ServerBuilder) HTTPBackend

func (sb *ServerBuilder) HTTPBackend() *ServerBuilder

HTTPBackend set backend is http backend

func (*ServerBuilder) MaxQPS

func (sb *ServerBuilder) MaxQPS(max int64) *ServerBuilder

MaxQPS set max qps

func (*ServerBuilder) NoCircuitBreaker

func (sb *ServerBuilder) NoCircuitBreaker() *ServerBuilder

NoCircuitBreaker no circuit breaker

func (*ServerBuilder) NoHeathCheck

func (sb *ServerBuilder) NoHeathCheck() *ServerBuilder

NoHeathCheck no heath check

func (*ServerBuilder) Use

func (sb *ServerBuilder) Use(value metapb.Server) *ServerBuilder

Use use a server

Jump to

Keyboard shortcuts

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