service.go 1.6 KB
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
package service

import "encoding/json"

type Simple struct {
	Name        string `json:"name"`
	Driver      string `json:"driver"`
	DriverTitle string `json:"driverTitle"`
	Type        string `json:"type"`
}

type Service struct {
	Simple

	Desc        string `json:"desc"`
	IsDefault   bool   `json:"isDefault"`
	HealthCheck bool   `json:"healthCheck"`
	UpdateTime  string `json:"updateTime"`
Y
Your Name 已提交
19
	CreateTime  string `json:"createTime"`
E
eoLinker API Management 已提交
20 21 22 23
}

type Info struct {
	*Service
Y
Your Name 已提交
24 25 26 27 28 29 30
	Config             string            `json:"config"`
	ClusterConfig      string            `json:"-"`
	ClusterConfigObj   map[string]string `json:"clusterConfig"`
	HealthCheckPath    string            `json:"healthCheckPath"`
	HealthCheckPeriod  int               `json:"healthCheckPeriod"`
	HealthCheckCode    string            `json:"healthCheckCode"`
	HealthCheckTimeOut int               `json:"healthCheckTimeOut"`
E
eoLinker API Management 已提交
31 32
}

Y
Your Name 已提交
33 34
func (i *Info) Decode() {
	json.Unmarshal([]byte(i.ClusterConfig), &i.ClusterConfigObj)
E
eoLinker API Management 已提交
35 36 37
}

type AddParam struct {
Y
Your Name 已提交
38 39 40 41 42
	Name          string `opt:"name,require"`
	Driver        string `opt:"driver" default:"static"`
	Desc          string `opt:"desc"`
	Config        string `opt:"config"`
	ClusterConfig string `opt:"clusterConfig"`
E
eoLinker API Management 已提交
43 44 45 46 47 48 49
	//ClusterConfigObj map[string]string `json:"clusterConfig"`
	HealthCheck        bool   `opt:"healthCheck" default:"false"`
	HealthCheckPath    string `opt:"healthCheckPath"`
	HealthCheckPeriod  int    `opt:"healthCheckPeriod" default:"5" min:"1" max:"60"`
	HealthCheckCode    string `opt:"healthCheckCode" default:"200"`
	HealthCheckTimeOut int    `opt:"healthCheckTimeOut" default:"300" max:"5000" min:"0"`
}