service

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient http client method

type Limiter

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

func NewLimiter

func NewLimiter(zkCli *zkclient.ZkClient) *Limiter

func (*Limiter) GetMatchedRule

func (l *Limiter) GetMatchedRule(req *restful.Request) *metadata.LimiterRule

GetMatchedRule get the matched limiter rule according request

func (*Limiter) GetRules

func (l *Limiter) GetRules() map[string]*metadata.LimiterRule

GetRules get all rules of limiter

func (*Limiter) LenOfRules

func (l *Limiter) LenOfRules() int

LenOfRules get the count of limiter's rules

func (*Limiter) SyncLimiterRules

func (l *Limiter) SyncLimiterRules() error

SyncLimiterRules sync the api limiter rules from zk

type RequestType

type RequestType string
const (
	UnknownType     RequestType = "unknown"
	TopoType        RequestType = "topo"
	HostType        RequestType = "host"
	ProcType        RequestType = "proc"
	EventType       RequestType = "event"
	DataCollectType RequestType = "collect"
	OperationType   RequestType = "operation"
	TaskType        RequestType = "task"
	AdminType       RequestType = "admin"
	CloudType       RequestType = "cloud"
)

type Service

type Service interface {
	WebServices() []*restful.WebService
	SetConfig(engine *backbone.Engine, httpClient HTTPClient, discovery discovery.DiscoveryInterface,
		clientSet apimachinery.ClientSetInterface, cache *redis.Client, limiter *Limiter)
}

Service service methods

func NewService

func NewService() Service

NewService create a new service instance

type URLPath

type URLPath string

URLPath url path filter

func (URLPath) FilterChain

func (u URLPath) FilterChain(req *restful.Request) (RequestType, error)

FilterChain url path filter

func (*URLPath) WithAdmin

func (u *URLPath) WithAdmin(req *restful.Request) (isHit bool)

WithAdmin transform admin server url

func (*URLPath) WithCloud

func (u *URLPath) WithCloud(req *restful.Request) (isHit bool)

WithCloud transform cloud's url

func (*URLPath) WithDataCollect

func (u *URLPath) WithDataCollect(req *restful.Request) (isHit bool)

WithDataCollect transform DataCollect's url

func (*URLPath) WithEvent

func (u *URLPath) WithEvent(req *restful.Request) (isHit bool)

WithEvent transform event's url

func (*URLPath) WithHost

func (u *URLPath) WithHost(req *restful.Request) (isHit bool)

WithHost transform the host's url

func (*URLPath) WithOperation

func (u *URLPath) WithOperation(req *restful.Request) (isHit bool)

WithOperation transform OperationStatistic's url

func (*URLPath) WithProc

func (u *URLPath) WithProc(req *restful.Request) (isHit bool)

WithProc transform the proc's url

func (*URLPath) WithTask

func (u *URLPath) WithTask(req *restful.Request) (isHit bool)

WithTask transform task server url

func (*URLPath) WithTopo

func (u *URLPath) WithTopo(req *restful.Request) (isHit bool)

WithTopo parse topo api's url

Jump to

Keyboard shortcuts

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