ELIOT Command Line Interface Commit
[eliot.git] / blueprints / common / elcli / elcli / cmd / common / types.go
1 /* Copyright 2019 The ELIOT Authors.
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7     http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 */
15
16 package common
17
18 var (
19         //Setup having option.
20         Setup           string
21         //Masters list
22         Masters         []string
23         //Nodes list
24         Nodes           []string        
25 )
26
27 // InitOptions Strucutre
28 type InitOptions struct {
29         KubernetesVersion  string
30         DockerVersion      string
31         K8SImageRepository string
32         K8SPodNetworkCidr  string
33 }
34
35 //JoinOptions has the kubeedge cloud init information filled by CLI
36 type JoinOptions struct {
37         InitOptions
38         CertPath           string
39         CloudCoreIP        string
40         K8SAPIServerIPPort string
41         EdgeNodeID         string
42 }
43
44 //InstallState enum set used for verifying a tool version is installed in host
45 type InstallState uint8
46
47 //Difference enum values for type InstallState
48 const (
49         NewInstallRequired InstallState = iota
50         AlreadySameVersionExist
51         DefVerInstallRequired
52         VersionNAInRepo
53 )
54
55 //ModuleRunning is defined to know the running status of KubeEdge components
56 type ModuleRunning uint8
57
58 //Different possible values for ModuleRunning type
59 const (
60         NoneRunning ModuleRunning = iota
61         KubeEdgeCloudRunning
62         KubeEdgeEdgeRunning
63 )
64
65 //ToolsInstaller interface for tools with install and teardown methods.
66 type ToolsInstaller interface {
67         InstallTools() error
68         TearDown() error
69 }
70
71 //OSTypeInstaller interface for methods to be executed over a specified OS distribution type
72 type OSTypeInstaller interface {
73         IsToolVerInRepo(string, string) (bool, error)
74         IsDockerInstalled(string) (InstallState, error)
75         InstallDocker() error
76         IsK8SComponentInstalled(string, string) (InstallState, error)
77         InstallK8S() error
78         StartK8Scluster() error
79         SetDockerVersion(string)
80         SetK8SVersionAndIsNodeFlag(version string, flag bool)
81         SetK8SImageRepoAndPodNetworkCidr(string, string)
82         }
83
84 //FlagData stores value and default value of the flags used in this command
85 type FlagData struct {
86         Val    interface{}
87         DefVal interface{}
88 }