apihttp

package
v0.0.0-...-d989b54 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet            = "GET"
	MethodPost           = "POST"
	DefaultClientTimeout = 5 * time.Second
	DefaultPartner       = "server"
)
View Source
const (
	API_REQUEST_PARAMS_ERROR = 400
	API_INTERNAL_ERROR       = 500
)
View Source
const (
	InnerSecretKey = "D2BsaMhN4IPnsFJ8NPIki83n2f6xdC0s"
)

Variables

This section is empty.

Functions

func Call

func Call(host, url, method string, params map[string]string) (map[string]gjson.Result, error)

调用外部接口

func CheckServerGUID

func CheckServerGUID(params *GuidParams, guid string) bool

校验服务端的请求里的guid是否合法

func GetServerGUID

func GetServerGUID(params *GuidParams) string

func ServiceHandler

func ServiceHandler(w http.ResponseWriter, r *http.Request)

ServiceHandler provide routing parser

func StartHttpServer

func StartHttpServer() error

Types

type Client

type Client struct {
	Params ClientParams
}

func (*Client) Do

func (c *Client) Do() (map[string]gjson.Result, error)

type ClientParams

type ClientParams struct {
	Url       string
	Host      string
	Method    string
	ReqParams map[string]string
	Timeout   time.Duration
}

type GuidParams

type GuidParams struct {
	Partner string
	Rand    string
	Time    string
}

type Resp

type Resp struct {
	ErrorCode int         `json:"error_code"`
	Error     string      `json:"error"`
	Data      interface{} `json:"data"`
}

Resp define response data

type ServiceController

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

ServiceController ...

func (*ServiceController) AddFileAction

func (s *ServiceController) AddFileAction()

func (*ServiceController) ConfListAction

func (s *ServiceController) ConfListAction()

func (*ServiceController) ConfManageAction

func (s *ServiceController) ConfManageAction()

func (*ServiceController) ConfReloadAction

func (s *ServiceController) ConfReloadAction()

func (*ServiceController) ConfRollbackAction

func (s *ServiceController) ConfRollbackAction()

func (*ServiceController) ConfStatusAction

func (s *ServiceController) ConfStatusAction()

func (*ServiceController) DeleteDomainAction

func (s *ServiceController) DeleteDomainAction()

test interface

func (*ServiceController) DeleteFileAction

func (s *ServiceController) DeleteFileAction()

func (*ServiceController) DiscoveryGetServiceAction

func (s *ServiceController) DiscoveryGetServiceAction()

获取服务信息

func (*ServiceController) DiscoveryListServicesAction

func (s *ServiceController) DiscoveryListServicesAction()

获取服务列表

func (*ServiceController) DiscoverySetPropertyAction

func (s *ServiceController) DiscoverySetPropertyAction()

后台设置属性 更新metadata时,key需要以 backend-metadata- 开始,否则不生效

func (*ServiceController) DomainListAction

func (s *ServiceController) DomainListAction()

func (*ServiceController) GetDomainFromConfAction

func (s *ServiceController) GetDomainFromConfAction()

test interface

func (*ServiceController) GetDomainFromDsAction

func (s *ServiceController) GetDomainFromDsAction()

test interface

func (*ServiceController) HelloWorldAction

func (s *ServiceController) HelloWorldAction()

HelloWorldAction say i'm alive

func (*ServiceController) NodeInfoAction

func (s *ServiceController) NodeInfoAction()

func (*ServiceController) NodeListAction

func (s *ServiceController) NodeListAction()

func (*ServiceController) NodeManageAction

func (s *ServiceController) NodeManageAction()

func (*ServiceController) PackageListAction

func (s *ServiceController) PackageListAction()

Jump to

Keyboard shortcuts

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