region

package
v5.1.3-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2019 License: LGPL-3.0 Imports: 22 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllTenant string

AllTenant AllTenant

Functions

func LoadConfig

func LoadConfig(regionAPI, token string) (map[string]map[string]interface{}, error)

LoadConfig load config

func SetInfo

func SetInfo(region, t string)

SetInfo 设置

Types

type APIConf

type APIConf struct {
	Endpoints []string `yaml:"endpoints"`
	Token     string   `yaml:"token"`
	AuthType  string   `yaml:"auth_type"`
	Cacert    string   `yaml:"client-ca-file"`
	Cert      string   `yaml:"tls-cert-file"`
	CertKey   string   `yaml:"tls-private-key-file"`
}

APIConf region api config

type ClusterInterface

type ClusterInterface interface {
	GetClusterInfo() (*model.ClusterResource, *util.APIHandleError)
	GetClusterHealth() (*utilhttp.ResponseBody, *util.APIHandleError)
}

ClusterInterface cluster api

type ConfigsInterface

type ConfigsInterface interface {
	Get() (*model.GlobalConfig, *util.APIHandleError)
	Put(*model.GlobalConfig) *util.APIHandleError
}

ConfigsInterface 数据中心配置API

type MonitorInterface

type MonitorInterface interface {
	GetRule(name string) (*model.AlertingNameConfig, *util.APIHandleError)
	GetAllRule() (*model.AlertingRulesConfig, *util.APIHandleError)
	DelRule(name string) (*utilhttp.ResponseBody, *util.APIHandleError)
	AddRule(path string) (*utilhttp.ResponseBody, *util.APIHandleError)
	RegRule(ruleName string, path string) (*utilhttp.ResponseBody, *util.APIHandleError)
}

ClusterInterface cluster api

type NodeConditionInterface

type NodeConditionInterface interface {
	List() ([]client.NodeCondition, *util.APIHandleError)
	Delete(conditionType client.NodeConditionType) ([]client.NodeCondition, *util.APIHandleError)
}

NodeConditionInterface node condition manage api

type NodeInterface

type NodeInterface interface {
	GetNodeByRule(rule string) ([]*client.HostNode, *util.APIHandleError)
	Get(node string) (*client.HostNode, *util.APIHandleError)
	GetNodeResource(node string) (*client.NodePodResource, *util.APIHandleError)
	List() ([]*client.HostNode, *util.APIHandleError)
	GetAllNodeHealth() (map[string][]map[string]string, *util.APIHandleError)
	Add(node *client.APIHostNode) (*client.HostNode, *util.APIHandleError)
	Up(nid string) *util.APIHandleError
	Down(nid string) *util.APIHandleError
	UnSchedulable(nid string) *util.APIHandleError
	ReSchedulable(nid string) *util.APIHandleError
	Delete(nid string) *util.APIHandleError
	Label(nid string) NodeLabelInterface
	Condition(nid string) NodeConditionInterface
	Install(nid string) *util.APIHandleError
	UpdateNodeStatus(nid, status string) (*client.HostNode, *util.APIHandleError)
}

NodeInterface node api

type NodeLabelInterface

type NodeLabelInterface interface {
	Add(k, v string) *util.APIHandleError
	Delete(k string) *util.APIHandleError
	List() (map[string]string, *util.APIHandleError)
}

NodeLabelInterface node label interface

type NotificationInterface

type NotificationInterface interface {
	GetNotification(start string, end string) ([]*model.NotificationEvent, *util.APIHandleError)
	HandleNotification(serviceName string, message string) ([]*model.NotificationEvent, *util.APIHandleError)
}

NotificationInterface cluster api

type Region

type Region interface {
	Tenants(name string) TenantInterface
	Resources() ResourcesInterface
	Tasks() TaskInterface
	Nodes() NodeInterface
	Cluster() ClusterInterface
	Configs() ConfigsInterface
	Version() string
	Monitor() MonitorInterface
	Notification() NotificationInterface
	DoRequest(path, method string, body io.Reader, decode *utilhttp.ResponseBody) (int, error)
}

Region region api

func GetRegion

func GetRegion() Region

GetRegion GetRegion

func NewRegion

func NewRegion(c APIConf) (Region, error)

NewRegion NewRegion

type ResourcesInterface

type ResourcesInterface interface {
	Tenants(tenantName string) ResourcesTenantInterface
}

ResourcesInterface ResourcesInterface

type ResourcesTenantInterface

type ResourcesTenantInterface interface {
	Get() (*model.TenantResource, *util.APIHandleError)
}

ResourcesTenantInterface ResourcesTenantInterface

type ServiceDeployInfo

type ServiceDeployInfo struct {
	Namespace    string            `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
	Statefuleset string            `protobuf:"bytes,2,opt,name=statefuleset,proto3" json:"statefuleset,omitempty"`
	Deployment   string            `protobuf:"bytes,3,opt,name=deployment,proto3" json:"deployment,omitempty"`
	Pods         map[string]string `` /* 149-byte string literal not displayed */
	Services     map[string]string `` /* 157-byte string literal not displayed */
	Endpoints    map[string]string `` /* 159-byte string literal not displayed */
	Secrets      map[string]string `` /* 155-byte string literal not displayed */
	Ingresses    map[string]string `` /* 159-byte string literal not displayed */
	Replicatset  map[string]string `` /* 163-byte string literal not displayed */
	Status       string            `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty"`
}

ServiceDeployInfo service deploy info

type ServiceInterface

type ServiceInterface interface {
	Get() (*serviceInfo, *util.APIHandleError)
	GetDeployInfo() (*ServiceDeployInfo, *util.APIHandleError)
	Pods() ([]*podInfo, *util.APIHandleError)
	List() ([]*dbmodel.TenantServices, *util.APIHandleError)
	Stop(eventID string) (string, *util.APIHandleError)
	Start(eventID string) (string, *util.APIHandleError)
	EventLog(eventID, level string) ([]*model.MessageData, *util.APIHandleError)
}

ServiceInterface ServiceInterface

type TaskInterface

type TaskInterface interface {
	Get(name string) (*model.Task, *util.APIHandleError)
	GetTaskStatus(task string) (map[string]*model.TaskStatus, *util.APIHandleError)
	Add(task *model.Task) *util.APIHandleError
	AddGroup(group *model.TaskGroup) *util.APIHandleError
	Exec(name string, nodes []string) *util.APIHandleError
	List() ([]*model.Task, *util.APIHandleError)
}

TaskInterface task api

type TenantInterface

type TenantInterface interface {
	Get() (*dbmodel.Tenants, *util.APIHandleError)
	List() ([]*dbmodel.Tenants, *util.APIHandleError)
	Delete() *util.APIHandleError
	Services(serviceAlias string) ServiceInterface
}

TenantInterface TenantInterface

Jump to

Keyboard shortcuts

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