cmd

package
v0.0.0-...-a2ad1e4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DockerClient *docker.Client

DockerClient wraps docker client

Functions

func ContainerCreate

ContainerCreate create a container

func ContainerDelete

func ContainerDelete(id string) error

ContainerDelete delete a container

func ContainerGet

func ContainerGet(id string) (types.ContainerJSON, error)

ContainerGet returns docker inspect information

func ContainerUpdate

func ContainerUpdate(id, config string) error

ContainerUpdate updates an container

func DashboardList

func DashboardList() ([]interface{}, error)

DashboardList is parses and splits docker stat values from output

func DeploymentCreate

func DeploymentCreate(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)

DeploymentCreate used to create deployment

func DeploymentDelete

func DeploymentDelete(namespace, name string) error

DeploymentDelete used to delete deployment

func DeploymentUpdate

func DeploymentUpdate(namespace string, deployment *appsv1.Deployment) *appsv1.Deployment

DeploymentUpdate used to update pod

func GetDeployment

func GetDeployment(namespace, name string) (*appsv1.Deployment, error)

GetDeployment used to get deployment by deployment name

func GetDeploymentClient

func GetDeploymentClient(namespace string) appsv1.DeploymentInterface

GetDeploymentClient used to get Deployment Client by namespace

func GetNode

func GetNode(nodename string) (*v1.Node, error)

GetNode used to get node by node name

func GetNodeClient

func GetNodeClient() corev1.NodeInterface

GetNodeClient used to get nodes client

func GetPodClient

func GetPodClient(namespace string) corev1.PodInterface

GetPodClient used to get pod client

func GetPodTemplateClient

func GetPodTemplateClient(namespace string) corev1.PodTemplateInterface

GetPodTemplateClient used to get pod template client

func GetServiceClient

func GetServiceClient(namespace string) corev1.ServiceInterface

GetServiceClient used to get service client

func ImageCreate

func ImageCreate(name string) (io.ReadCloser, error)

ImageCreate pull an image

func ImageDelete

func ImageDelete(id string) error

ImageDelete delete an image

func ImageGet

func ImageGet(id string) (types.ImageInspect, error)

ImageGet return image

func NetworkCreate

func NetworkCreate(name string, networkCreate types.NetworkCreate) (types.NetworkCreateResponse, error)

NetworkCreate creates a network

func NetworkDelete

func NetworkDelete(id string) error

NetworkDelete delete a network

func NetworkGet

func NetworkGet(nid string) (types.NetworkResource, []byte, error)

NetworkGet return a network

func PodCreate

func PodCreate(namespace string, pod *v1.Pod) (*v1.Pod, error)

PodCreate used to create pod

func PodDelete

func PodDelete(namespace, name string) error

PodDelete used to delete pod by podName

func PodGet

func PodGet(namespace, name string) (*v1.Pod, error)

PodGet used to get pod by pod name

func PodUpdate

func PodUpdate(namespace string, pod *v1.Pod) *v1.Pod

PodUpdate used to update pod

func REFDelete

func REFDelete(id string) error

REFDelete delete ups by id

func REFUpdate

func REFUpdate(newItem REFsListOutput) error

REFUpdate update refs

func ServiceCreate

func ServiceCreate(namespace string, service *v1.Service) (*v1.Service, error)

ServiceCreate used to create service

func ServiceDelete

func ServiceDelete(namespace, name string) error

ServiceDelete used to delete service

func ServiceGet

func ServiceGet(namespace, serviceName string) (*v1.Service, error)

ServiceGet used to get service by service name

func ServiceUpdate

func ServiceUpdate(namespace string, service *v1.Service) *v1.Service

ServiceUpdate used to update service

func UPSDelete

func UPSDelete(id string) error

UPSDelete delete ups by id

func UPSUpdate

func UPSUpdate(newItem UPSListOutput) error

UPSUpdate update power supplies

Types

type Battery

type Battery struct {
	State        string `json:"State"`        // 状态
	Voltage      int    `json:"Voltage"`      // 电压
	Current      int    `json:"Current"`      // 电流
	Temperature  int    `json:"Temperature"`  // 温度
	BackupTime   int    `json:"BackupTime"`   // 后备时间
	CapacityLeft int    `json:"CapacityLeft"` // 剩余容量
}

Battery 电池参数

type ContainerCreateConfig

type ContainerCreateConfig struct {
	ContainerConfig  container.Config
	HostConfig       container.HostConfig
	NetworkingConfig network.NetworkingConfig
}

ContainerCreateConfig wraps container config 、host config and networking config

type ContainersListOutput

type ContainersListOutput struct {
	ID          string `json:"Id"`
	Name        string `json:"Name"`
	CreatedTime string `json:"CreatedTime"`
	State       string `json:"State"`
}

ContainersListOutput used to interact with template

func ContainersList

func ContainersList() ([]ContainersListOutput, error)

ContainersList used to list containers

type DeploymentsListOutput

type DeploymentsListOutput struct {
	Name              string            `json:"Name"`
	Labels            map[string]string `json:"Labels"`
	Namespace         string            `json:"Namespace"`
	CreationTimestamp string            `json:"CreationTimestamp"`
}

DeploymentsListOutput used to interact with template

func DeploymentsList

func DeploymentsList(namespace string) ([]DeploymentsListOutput, error)

DeploymentsList used to list deployment

type Environment

type Environment struct {
	Temperature int `json:"Temperature"` // 环境温度
	Humidty     int `json:"Humidty"`     // 环境湿度
}

Environment 环境参数

type ImagesListOutput

type ImagesListOutput struct {
	ID          string `json:"Id"`
	Name        string `json:"Name"`
	Tag         string `json:"Tag"`
	Size        string `json:"Size"`
	CreatedTime string `json:"CreatedTime"`
}

ImagesListOutput used to interact with template

func ImagesList

func ImagesList() ([]ImagesListOutput, error)

ImagesList return images

type Input

type Input struct {
	PowerFactor int `json:"PowerFactor"` // 输入功率因数
	Frequency   int `json:"Frequency"`   //  输入频率
}

Input 输入参数

type KubernetesClient

type KubernetesClient struct {
	Namespace string
	Clientset *kubernetes.Clientset
}

KubernetesClient wraps kubernetes Clientset

var K8SClient KubernetesClient

K8SClient wraps kubernetes client

func GetK8SClient

func GetK8SClient() KubernetesClient

GetK8SClient used to get client

func (*KubernetesClient) SetNamespace

func (client *KubernetesClient) SetNamespace(namespace string)

SetNamespace used to set k8s cliet namespace

type NetworksListOutput

type NetworksListOutput struct {
	ID          string `json:"Id"`
	Name        string `json:"Name"`
	Driver      string `json:"Driver"`
	Scope       string `json:"Scope"`
	CreatedTime string `json:"CreatedTime"`
}

NetworksListOutput used to interact with template

func NetworksList

func NetworksList() ([]NetworksListOutput, error)

NetworksList is parses and splits networks from output

type NodesListOutput

type NodesListOutput struct {
	Name              string           `json:"Name"`
	Addresses         []v1.NodeAddress `json:"Addresses"`
	CreationTimestamp string           `json:"CreationTimestamp"`
}

NodesListOutput used to interact with template

func NodesList

func NodesList() ([]NodesListOutput, error)

NodesList used to list node

type Output

type Output struct {
	Voltage    int `json:"Voltage"`    // 电压
	Current    int `json:"Current"`    // 电流
	Crequerycy int `json:"Crequerycy"` // 输出频率
}

Output 输出参数

type PodClient

type PodClient struct {
	corev1.PodInterface
}

PodClient wraps client to operate pod apis

type PodsContainersJSON

type PodsContainersJSON struct {
	Name     string     `json:"name"`
	Children []children `json:"children"`
}

PodsContainersJSON used to store pods and containers

func GenerateGraph

func GenerateGraph() (PodsContainersJSON, error)

GenerateGraph generate graph data and write into file

func PodContainersList

func PodContainersList(namespace string) (PodsContainersJSON, error)

PodContainersList list pods and containers

type PodsListOutput

type PodsListOutput struct {
	Name      string `json:"Name"`
	Namespace string `json:"Namespace"`
	HostIP    string `json:"HostIP"`
	StartTime string `json:"StartTime"`
	Phase     string `json:"Phase"`
}

PodsListOutput used to interact with template

func PodsList

func PodsList(namespace string) ([]PodsListOutput, error)

PodsList used to list pod

type REFsListOutput

type REFsListOutput struct {
	ID                string `json:"ID"`                // 标识符
	PowerRating       int    `json:"PowerRating"`       // 额定功率
	PowerSupplyMethod int    `json:"PowerSupplyMethod"` // 供电方式
	RunningState      int    `json:"RunningState"`      // 运行功率
	SystemGrant       int    `json:"SystemGrant"`       // 机型容量
	SystemType        string `json:"SystemType"`        // 系统型号
	WorkMode          int    `json:"WorkMode"`          // 工作模式
	In                Input
	Out               Output
	Battery           Battery
	Environment       Environment
}

REFsListOutput 制冷设备

func REFGet

func REFGet(id string) (REFsListOutput, error)

REFGet get ref by id

func REFsCreate

func REFsCreate(item REFsListOutput) ([]REFsListOutput, error)

REFsCreate create refs

func REFsList

func REFsList() ([]REFsListOutput, error)

REFsList list refs

type ServicesListOutput

type ServicesListOutput struct {
	Name      string            `json:"Name"`
	Namespace string            `json:"Namespace"`
	Labels    map[string]string `json:"Labels"`
}

ServicesListOutput used to interact with template

func ServicesList

func ServicesList(namespace string) ([]ServicesListOutput, error)

ServicesList list services

type UPSListOutput

type UPSListOutput struct {
	ID                string `json:"ID"`                // 标识符
	PowerRating       int    `json:"PowerRating"`       // 额定功率
	PowerSupplyMethod int    `json:"PowerSupplyMethod"` // 供电方式
	RunningState      int    `json:"RunningState"`      // 运行功率
	SystemGrant       int    `json:"SystemGrant"`       // 机型容量
	SystemType        string `json:"SystemType"`        // 系统型号
	WorkMode          int    `json:"WorkMode"`          // 工作模式
	In                Input
	Out               Output
	Battery           Battery
	Environment       Environment
}

UPSListOutput 代表供电设备

func UPSCreate

func UPSCreate(item UPSListOutput) ([]UPSListOutput, error)

UPSCreate create power supplies

func UPSGet

func UPSGet(id string) (UPSListOutput, error)

UPSGet get ups by id

func UPSList

func UPSList() ([]UPSListOutput, error)

UPSList list power supplies

Jump to

Keyboard shortcuts

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