grpcgovern

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlProviderV2Info = "/v2/provider/info"
	UrlPprofV1Info    = "/api/v1/pprof/info"
	UrlGovernInfo     = "/v2/govern/%s/%d"
	UrlEtcdInfo       = "/api/etcdctl/%s/%s"
	UrlGovernEvent    = "/api/provider/%s/events" // /api/provider/:appname/events
	UrlConfigurators  = "/v2/configurators/put"
	// 聚合provider,configurators, 第一个为appname,第二个为typeid
	// typeid 1为grpc,2为http
	UrlBaseAggregation  = "/v2/aggregation/base/%s/%d"
	UrlConfigServerPut  = "/v1/configserver/put"
	UrlConfigServerInfo = "/v1/configserver/%s/%d/%s"

	UrlAliLoggerDashboard = "/v1/alilogger/dashboard/%s/%s"
	UrlAliLoggerLogStore  = "/v1/alilogger/logstore/%s/%s/%s"
)
View Source
const (
	EtcdRegister     = "register"
	EtcdConfigServer = "config"
	EtcdSentinel     = "sentinel"
)

Variables

This section is empty.

Functions

func GenNewZoneCode

func GenNewZoneCode(env, zoneCode string) string

func Init

func Init()

Types

type GovernStatus

type GovernStatus string
const (
	GovernOK            GovernStatus = "ok"
	GovernTimeout       GovernStatus = "timeout"
	GovernInvalidDomain GovernStatus = "invalid_domain"
	GovernUnknownError  GovernStatus = "unknown_error"
	GovernUnknown       GovernStatus = "unknown"
)

type GrpcGovern

type GrpcGovern struct {
	DomainMap map[string]string // ZoneCode对应域名
	Token     string

	*resty.Client
	// contains filtered or unexported fields
}
var IGrpcGovern *GrpcGovern

func InitGrpcGovern

func InitGrpcGovern() *GrpcGovern

func (*GrpcGovern) Get

func (g *GrpcGovern) Get(env, zoneCode string, url string, v map[string]string, resp interface{}) (err error)

PostJSON post json 数据请求

func (*GrpcGovern) GovernStatus

func (g *GrpcGovern) GovernStatus(zoneCode string) HealthStatus

func (*GrpcGovern) Post

func (g *GrpcGovern) Post(env, zoneCode string, url string, v interface{}, resp interface{}) (err error)

PostJSON post json 数据请求

func (*GrpcGovern) PostStream

func (g *GrpcGovern) PostStream(env, zoneCode string, url string, v interface{}) (stream []byte, err error)

PostJSON post json 数据请求

type HealthStatus

type HealthStatus struct {
	Status  GovernStatus
	Message string // 如果服务有异常,这里显示错误信息
}

Jump to

Keyboard shortcuts

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