v2

package
v2.4.4+incompatible Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: MIT Imports: 15 Imported by: 1

README

v2版的API的Data格式统一成了json, 各个API的返回结果的Data的源数据如下, 可使用对应数据结构的xxx.Decode([]byte)函数进行解析

使用这些数据结构需要:

import "github.com/laincloud/lainlet/api/v2"

/v2/configwatcher

type GeneralConfig struct {
	Data map[string]string // data type return by configwatcher
}

/v2/coreinfowatcher

import lainEngine "github.com/laincloud/deployd/engine"

type CoreInfo lainEngine.PodGroupCoreInfo // 这个格式需要参考deployd的代码

type GeneralCoreInfo struct {
	Data map[string]coreinfo.CoreInfo // 真正的Data
}

/v2/localspecquery

type LocalSpec struct {
	Data    []string // 真正的Data
}

/v2/procwatcher

type Pod struct {
	InstanceNo int
	IP         string
	Port       int
	ProcName   string
}

type PodGroup struct {
	Pods []Pod `json:"proc"`
}

type GeneralPodGroup struct {
	Data []PodGroup // 真正的Data
}

/v2/proxywatcher

type Container struct {
	ContainerIp   string `json:"container_ip"`
	ContainerPort int    `json:"container_port"`
}

type ProcInfo struct {
	Containers []Container `json:"containers"`
}

type ProxyData struct {    
	Data map[string]ProcInfo // 真正的data
}

/v2/depends

type ContainerInfo struct {
	NodeIP string
	IP     string
	Port   int
}

type DependsItem struct {
	Annotation string
	Containers []ContainerInfo
}

type Depends struct {
	Data map[string]map[string]map[string]DependsItem // 真正的data
}


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppNameAPI

func GetAppNameAPI(rw http.ResponseWriter, req *http.Request) (int, string)

Types

type Annotation

type Annotation struct {
	Ports []Port `json:"ports"`
}

type AppInfo

type AppInfo struct {
	Appname string
}

Container info, aim to make it compatible with old api, having to defined a new struct.

type AppsData

type AppsData struct {
	Data map[string]AppInfo
}

func (*AppsData) Decode

func (ad *AppsData) Decode(r []byte) error

func (*AppsData) Encode

func (ad *AppsData) Encode() ([]byte, error)

func (*AppsData) Key

func (ad *AppsData) Key(r *http.Request) (string, error)

func (*AppsData) Make

func (ad *AppsData) Make(data map[string]interface{}) (api.API, bool, error)

func (*AppsData) URI

func (ad *AppsData) URI() string

func (*AppsData) WatcherName

func (ad *AppsData) WatcherName() string

type Container

type Container struct {
	Command  []string
	Id       string `json:"ContainerId"`
	Ip       string `json:"ContainerIp"`
	Cpu      int
	Env      []string
	Expose   int
	Image    string
	Memory   int64
	NodeIp   string
	NodeName string
	Volumes  []string
}

type ContainerForBackupctl

type ContainerForBackupctl struct {
	Id       string
	Ip       string
	NodeIp   string
	NodeName string
}

type ContainerForProxy

type ContainerForProxy struct {
	ContainerIp   string `json:"container_ip"`
	ContainerPort int    `json:"container_port"`
}

Container info, aim to make it compatible with old api, having to defined a new struct.

type ContainerForWebrouter

type ContainerForWebrouter struct {
	IP     string `json:"ContainerIp"`
	Expose int
}

type ContainerInfo

type ContainerInfo struct {
	ContainerID string
	NodeIP      string
	IP          string
	Port        int
}

The ContainerInfo used for dependency

type CoreInfo

type CoreInfo struct {
	PodInfos []PodInfo
}

Coreinfo type

type CoreInfoForBackupctl

type CoreInfoForBackupctl struct {
	Data map[string][]PodInfoForBackupctl
}

func (*CoreInfoForBackupctl) Decode

func (ci *CoreInfoForBackupctl) Decode(r []byte) error

func (*CoreInfoForBackupctl) Encode

func (ci *CoreInfoForBackupctl) Encode() ([]byte, error)

func (*CoreInfoForBackupctl) Key

func (ci *CoreInfoForBackupctl) Key(r *http.Request) (string, error)

func (*CoreInfoForBackupctl) Make

func (ci *CoreInfoForBackupctl) Make(data map[string]interface{}) (api.API, bool, error)

func (*CoreInfoForBackupctl) URI

func (ci *CoreInfoForBackupctl) URI() string

func (*CoreInfoForBackupctl) WatcherName

func (ci *CoreInfoForBackupctl) WatcherName() string

type CoreInfoForRebellion

type CoreInfoForRebellion struct {
	PodInfos []PodInfoForRebellion
}

Coreinfo type

type CoreInfoForWebrouter

type CoreInfoForWebrouter struct {
	PodInfos []PodInfoForWebrouter
}

Coreinfo type

type Dependency

type Dependency struct {
	PodName string
	Policy  int
}

type Depends

type Depends struct {
	Data map[string]map[string]map[string]DependsItem
}

Depends API

func (*Depends) Decode

func (d *Depends) Decode(r []byte) error

func (*Depends) Encode

func (d *Depends) Encode() ([]byte, error)

func (*Depends) Key

func (d *Depends) Key(r *http.Request) (string, error)

func (*Depends) Make

func (d *Depends) Make(data map[string]interface{}) (api.API, bool, error)

func (*Depends) URI

func (d *Depends) URI() string

func (*Depends) WatcherName

func (d *Depends) WatcherName() string

type DependsItem

type DependsItem struct {
	Annotation string
	Containers []ContainerInfo
}

type GeneralConfig

type GeneralConfig struct {
	Data map[string]string // data type return by configwatcher
}

Config API

func (*GeneralConfig) Decode

func (gc *GeneralConfig) Decode(r []byte) error

func (*GeneralConfig) Encode

func (gc *GeneralConfig) Encode() ([]byte, error)

func (*GeneralConfig) Key

func (gc *GeneralConfig) Key(r *http.Request) (string, error)

func (*GeneralConfig) Make

func (gc *GeneralConfig) Make(conf map[string]interface{}) (api.API, bool, error)

func (*GeneralConfig) URI

func (gc *GeneralConfig) URI() string

func (*GeneralConfig) WatcherName

func (gc *GeneralConfig) WatcherName() string

type GeneralContainers

type GeneralContainers struct {
	Data map[string]container.Info // data type return by configwatcher
}

node watcher api, /lain/nodes/nodes

func (*GeneralContainers) Decode

func (gc *GeneralContainers) Decode(r []byte) error

func (*GeneralContainers) Encode

func (gc *GeneralContainers) Encode() ([]byte, error)

func (*GeneralContainers) Key

func (gc *GeneralContainers) Key(r *http.Request) (string, error)

func (*GeneralContainers) Make

func (gc *GeneralContainers) Make(data map[string]interface{}) (api.API, bool, error)

func (*GeneralContainers) URI

func (gc *GeneralContainers) URI() string

func (*GeneralContainers) WatcherName

func (gc *GeneralContainers) WatcherName() string

type GeneralCoreInfo

type GeneralCoreInfo struct {
	Data map[string]CoreInfo
}

Coreinfo API

func (*GeneralCoreInfo) Decode

func (gci *GeneralCoreInfo) Decode(r []byte) error

func (*GeneralCoreInfo) Encode

func (gci *GeneralCoreInfo) Encode() ([]byte, error)

func (*GeneralCoreInfo) Key

func (gci *GeneralCoreInfo) Key(r *http.Request) (string, error)

func (*GeneralCoreInfo) Make

func (gci *GeneralCoreInfo) Make(data map[string]interface{}) (api.API, bool, error)

func (*GeneralCoreInfo) URI

func (gci *GeneralCoreInfo) URI() string

func (*GeneralCoreInfo) WatcherName

func (gci *GeneralCoreInfo) WatcherName() string

type GeneralNodes

type GeneralNodes struct {
	Data map[string]nodes.NodeInfo // data type return by configwatcher
}

node watcher api, /lain/nodes/nodes

func (*GeneralNodes) Decode

func (gn *GeneralNodes) Decode(r []byte) error

func (*GeneralNodes) Encode

func (gn *GeneralNodes) Encode() ([]byte, error)

func (*GeneralNodes) Key

func (gn *GeneralNodes) Key(r *http.Request) (string, error)

func (*GeneralNodes) Make

func (gn *GeneralNodes) Make(data map[string]interface{}) (api.API, bool, error)

func (*GeneralNodes) URI

func (gn *GeneralNodes) URI() string

func (*GeneralNodes) WatcherName

func (gn *GeneralNodes) WatcherName() string

type GeneralPodGroup

type GeneralPodGroup struct {
	Data []PodGroup
}

PodGroup API

func (*GeneralPodGroup) Decode

func (gpg *GeneralPodGroup) Decode(r []byte) error

func (*GeneralPodGroup) Encode

func (gpg *GeneralPodGroup) Encode() ([]byte, error)

func (*GeneralPodGroup) Key

func (gpg *GeneralPodGroup) Key(r *http.Request) (string, error)

func (*GeneralPodGroup) Make

func (gpg *GeneralPodGroup) Make(data map[string]interface{}) (api.API, bool, error)

func (*GeneralPodGroup) URI

func (gpg *GeneralPodGroup) URI() string

func (*GeneralPodGroup) WatcherName

func (gpg *GeneralPodGroup) WatcherName() string

type LocalSpec

type LocalSpec struct {
	Data    []string
	LocalIP string
	// contains filtered or unexported fields
}

Localspec API, it do not support watch request

func (*LocalSpec) BanWatch

func (ls *LocalSpec) BanWatch()

to realize BanWatcher interface, abandon watch action

func (*LocalSpec) Decode

func (ls *LocalSpec) Decode(r []byte) error

func (*LocalSpec) Encode

func (ls *LocalSpec) Encode() ([]byte, error)

func (*LocalSpec) Key

func (ls *LocalSpec) Key(r *http.Request) (string, error)

func (*LocalSpec) Make

func (ls *LocalSpec) Make(data map[string]interface{}) (api.API, bool, error)

func (*LocalSpec) URI

func (ls *LocalSpec) URI() string

func (*LocalSpec) WatcherName

func (ls *LocalSpec) WatcherName() string

type Pod

type Pod struct {
	InstanceNo int
	IP         string
	Port       int
	ProcName   string
}

type PodGroup

type PodGroup struct {
	Pods []Pod `json:"proc"`
}

type PodInfo

type PodInfo struct {
	Annotation   string
	Containers   []Container `json:"ContainerInfos"`
	Dependencies []Dependency
	InstanceNo   int
}

type PodInfoForBackupctl

type PodInfoForBackupctl struct {
	Annotation string
	Containers []ContainerForBackupctl
	InstanceNo int
}

type PodInfoForRebellion

type PodInfoForRebellion struct {
	Annotation string
	AppVersion string
	InstanceNo int
}

type PodInfoForWebrouter

type PodInfoForWebrouter struct {
	Annotation string
	Containers []ContainerForWebrouter `json:"ContainerInfos"`
}

type Port

type Port struct {
	Srcport int    `json:"srcport"`
	Dstport int    `json:"dstport"`
	Proto   string `json:"proto"`
}

type Ports

type Ports struct {
	Data []int
}

func (*Ports) Decode

func (si *Ports) Decode(r []byte) error

func (*Ports) Encode

func (si *Ports) Encode() ([]byte, error)

func (*Ports) Key

func (si *Ports) Key(r *http.Request) (string, error)

func (*Ports) Make

func (si *Ports) Make(data map[string]interface{}) (api.API, bool, error)

func (*Ports) URI

func (si *Ports) URI() string

func (*Ports) WatcherName

func (si *Ports) WatcherName() string

type ProcInfo

type ProcInfo struct {
	Containers []ContainerForProxy `json:"containers"`
}

type ProxyData

type ProxyData struct {
	Data map[string]ProcInfo
}

Proxy API

func (*ProxyData) Decode

func (pd *ProxyData) Decode(r []byte) error

func (*ProxyData) Encode

func (pd *ProxyData) Encode() ([]byte, error)

func (*ProxyData) Key

func (pd *ProxyData) Key(r *http.Request) (string, error)

func (*ProxyData) Make

func (pd *ProxyData) Make(data map[string]interface{}) (api.API, bool, error)

func (*ProxyData) URI

func (pd *ProxyData) URI() string

func (*ProxyData) WatcherName

func (pd *ProxyData) WatcherName() string

type RebellionAPIProvider

type RebellionAPIProvider struct {
	Data map[string]CoreInfoForRebellion
}

Coreinfo API

func (*RebellionAPIProvider) Decode

func (ap *RebellionAPIProvider) Decode(r []byte) error

func (*RebellionAPIProvider) Encode

func (ap *RebellionAPIProvider) Encode() ([]byte, error)

func (*RebellionAPIProvider) Key

func (ap *RebellionAPIProvider) Key(r *http.Request) (string, error)

func (*RebellionAPIProvider) Make

func (ap *RebellionAPIProvider) Make(data map[string]interface{}) (api.API, bool, error)

func (*RebellionAPIProvider) URI

func (ap *RebellionAPIProvider) URI() string

func (*RebellionAPIProvider) WatcherName

func (ap *RebellionAPIProvider) WatcherName() string

type StreamProc

type StreamProc struct {
	Name      string
	Upstreams []StreamUpstream
	Services  []StreamService
}

type StreamRouterInfo

type StreamRouterInfo struct {
	Data map[string][]StreamProc
}

func (*StreamRouterInfo) Decode

func (si *StreamRouterInfo) Decode(r []byte) error

func (*StreamRouterInfo) Encode

func (si *StreamRouterInfo) Encode() ([]byte, error)

func (*StreamRouterInfo) Key

func (si *StreamRouterInfo) Key(r *http.Request) (string, error)

func (*StreamRouterInfo) Make

func (si *StreamRouterInfo) Make(data map[string]interface{}) (api.API, bool, error)

func (*StreamRouterInfo) URI

func (si *StreamRouterInfo) URI() string

func (*StreamRouterInfo) WatcherName

func (si *StreamRouterInfo) WatcherName() string

type StreamService

type StreamService struct {
	UpstreamPort int
	ListenPort   int
	Send         string
	Expect       string
}

type StreamUpstream

type StreamUpstream struct {
	Host       string
	InstanceNo int
}

type WebrouterInfo

type WebrouterInfo struct {
	Data map[string]CoreInfoForWebrouter
}

Coreinfo API

func (*WebrouterInfo) Decode

func (wi *WebrouterInfo) Decode(r []byte) error

func (*WebrouterInfo) Encode

func (wi *WebrouterInfo) Encode() ([]byte, error)

func (*WebrouterInfo) Key

func (wi *WebrouterInfo) Key(r *http.Request) (string, error)

func (*WebrouterInfo) Make

func (wi *WebrouterInfo) Make(data map[string]interface{}) (api.API, bool, error)

func (*WebrouterInfo) URI

func (wi *WebrouterInfo) URI() string

func (*WebrouterInfo) WatcherName

func (wi *WebrouterInfo) WatcherName() string

Jump to

Keyboard shortcuts

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