api

package
v0.0.0-...-df8b58b Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Ok = Response{Ok: true}

Ok Response

Functions

func IntFormParam

func IntFormParam(c echo.Context, name string) (int64, bool, error)

IntFormParam int form param

func IntFormParamD

func IntFormParamD(c echo.Context, name string, defval int64) (int64, bool, error)

IntFormParamD int form param with default

func IntQueryParam

func IntQueryParam(c echo.Context, name string) (int64, bool, error)

IntQueryParam int query param

func IntQueryParamD

func IntQueryParamD(c echo.Context, name string, defval int64) (int64, bool, error)

IntQueryParamD int query param with default

func JSONError

func JSONError(c echo.Context, err error) error

JSONError json error

func JSONErrorC

func JSONErrorC(c echo.Context, code int, err error) error

JSONErrorC json error with code

func JSONErrorf

func JSONErrorf(c echo.Context, errCode string, format string, args ...interface{}) error

JSONErrorf json error format

func JSONFormParam

func JSONFormParam(c echo.Context, name string, v interface{}) (bool, error)

JSONFormParam json form param

func JSONOk

func JSONOk(c echo.Context) error

JSONOk json ok result

func JSONResult

func JSONResult(c echo.Context, result interface{}) error

JSONResult json result

Types

type Config

type Config struct {
	Listen      string        `default:"127.0.0.1:4433"`
	CertFile    string        `default:"apicert.pem"`
	KeyFile     string        `default:"apikey.pem"`
	StopTimeout time.Duration `default:"60s" yaml:"stop_timeout"`

	PermitPublicServiceQuery bool `default:"true"`
	DevNets                  []IPNet
}

Config api server config

type IPNet

type IPNet net.IPNet

IPNet ipnet

func (*IPNet) UnmarshalYAML

func (ipnet *IPNet) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshal yaml

type Response

type Response struct {
	Ok     bool        `json:"ok"`
	Result interface{} `json:"result,omitempty"`
	Error  interface{} `json:"error,omitempty"`
}

Response simple response

type Server

type Server struct {
	ProtoSwitch bool
	// contains filtered or unexported fields
}

Server api server

func NewServer

func NewServer(config *Config, etcdClient *clientv3.Client,
	servs *services.ServiceCtrl, cfgs *configs.ConfigCtrl, apps *apps.AppCtrl) *Server

NewServer new api server

func (*Server) Run

func (server *Server) Run() error

Run run server

type ServicePlugResult

type ServicePlugResult struct {
	LeaseID clientv3.LeaseID `json:"lease_id"`
	TTL     int64            `json:"ttl"`
}

ServicePlugResult service plug result

Jump to

Keyboard shortcuts

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