Documentation ¶
Index ¶
- Variables
- func ContainerCreate(config ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
- func ContainerDelete(id string) error
- func ContainerGet(id string) (types.ContainerJSON, error)
- func ContainerUpdate(id, config string) error
- func DashboardList() ([]interface{}, error)
- func DeploymentCreate(namespace string, deployment *appsv1.Deployment) (*appsv1.Deployment, error)
- func DeploymentDelete(namespace, name string) error
- func DeploymentUpdate(namespace string, deployment *appsv1.Deployment) *appsv1.Deployment
- func GetDeployment(namespace, name string) (*appsv1.Deployment, error)
- func GetDeploymentClient(namespace string) appsv1.DeploymentInterface
- func GetNode(nodename string) (*v1.Node, error)
- func GetNodeClient() corev1.NodeInterface
- func GetPodClient(namespace string) corev1.PodInterface
- func GetPodTemplateClient(namespace string) corev1.PodTemplateInterface
- func GetServiceClient(namespace string) corev1.ServiceInterface
- func ImageCreate(name string) (io.ReadCloser, error)
- func ImageDelete(id string) error
- func ImageGet(id string) (types.ImageInspect, error)
- func NetworkCreate(name string, networkCreate types.NetworkCreate) (types.NetworkCreateResponse, error)
- func NetworkDelete(id string) error
- func NetworkGet(nid string) (types.NetworkResource, []byte, error)
- func PodCreate(namespace string, pod *v1.Pod) (*v1.Pod, error)
- func PodDelete(namespace, name string) error
- func PodGet(namespace, name string) (*v1.Pod, error)
- func PodUpdate(namespace string, pod *v1.Pod) *v1.Pod
- func REFDelete(id string) error
- func REFUpdate(newItem REFsListOutput) error
- func ServiceCreate(namespace string, service *v1.Service) (*v1.Service, error)
- func ServiceDelete(namespace, name string) error
- func ServiceGet(namespace, serviceName string) (*v1.Service, error)
- func ServiceUpdate(namespace string, service *v1.Service) *v1.Service
- func UPSDelete(id string) error
- func UPSUpdate(newItem UPSListOutput) error
- type Battery
- type ContainerCreateConfig
- type ContainersListOutput
- type DeploymentsListOutput
- type Environment
- type ImagesListOutput
- type Input
- type KubernetesClient
- type NetworksListOutput
- type NodesListOutput
- type Output
- type PodClient
- type PodsContainersJSON
- type PodsListOutput
- type REFsListOutput
- type ServicesListOutput
- type UPSListOutput
Constants ¶
This section is empty.
Variables ¶
var DockerClient *docker.Client
DockerClient wraps docker client
Functions ¶
func ContainerCreate ¶
func ContainerCreate(config ContainerCreateConfig) (container.ContainerCreateCreatedBody, error)
ContainerCreate create a container
func ContainerGet ¶
func ContainerGet(id string) (types.ContainerJSON, error)
ContainerGet returns docker inspect information
func ContainerUpdate ¶
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 ¶
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 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 NetworkCreate ¶
func NetworkCreate(name string, networkCreate types.NetworkCreate) (types.NetworkCreateResponse, error)
NetworkCreate creates a network
func NetworkGet ¶
func NetworkGet(nid string) (types.NetworkResource, []byte, error)
NetworkGet return a network
func ServiceCreate ¶
ServiceCreate used to create service
func ServiceDelete ¶
ServiceDelete used to delete service
func ServiceGet ¶
ServiceGet used to get service by service name
func ServiceUpdate ¶
ServiceUpdate used to update service
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
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 (*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
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
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 REFsCreate ¶
func REFsCreate(item REFsListOutput) ([]REFsListOutput, error)
REFsCreate create 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