api

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionV1 = "v1"

	PathV1 = prefix + VersionV1
)

Variables

This section is empty.

Functions

func GetApiV1Action

func GetApiV1Action() []*httpserver.Action

Get V1 actions

func InitMetric

func InitMetric() error

func RegisterInitFunc

func RegisterInitFunc(f func() error)

called by actions for registering some daemon functions and these functions will be called after flag-init and server-start

func RegisterV1Action

func RegisterV1Action(action Action)

Register a handler into v1 actions means all the URL of these handlers are start with PathV1

func ReturnRest

func ReturnRest(resp *RestResponse)

Types

type Action

type Action httpserver.Action

type MetricAPIResource

type MetricAPIResource struct {
	Conf      *config.Config
	Rd        *rdiscover.RDiscover
	ActionsV1 []*httpserver.Action
}

func GetAPIResource

func GetAPIResource() *MetricAPIResource

func (*MetricAPIResource) InitActions

func (a *MetricAPIResource) InitActions()

func (*MetricAPIResource) SetConfig

func (a *MetricAPIResource) SetConfig(op *config.Config, rd *rdiscover.RDiscover) error

type RestResponse

type RestResponse struct {
	Resp     *restful.Response
	HTTPCode int

	Data    interface{}
	ErrCode int
	Message string
	Extra   map[string]interface{}

	WrapFunc func([]byte) []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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