-
Notifications
You must be signed in to change notification settings - Fork 21
/
command.go
49 lines (39 loc) · 1.27 KB
/
command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package core
type App struct {
Name string `bson:"name" json:"name"`
App_args []AppResource `bson:"app_args" json:"app_args"`
AppDef *AppCommandMode `bson:"appdef" json:"appdef"` // App defintion
}
type Command struct {
Name string `bson:"name" json:"name"`
Args string `bson:"args" json:"args"`
Dockerimage string `bson:"Dockerimage" json:"Dockerimage"`
Cmd_script []string `bson:"cmd_script" json:"cmd_script"`
Environ Envs `bson:"environ" json:"environ"`
HasPrivateEnv bool `bson:"has_private_env" json:"has_private_env"`
Description string `bson:"description" json:"description"`
ParsedArgs []string `bson:"-" json:"-"`
}
type Envs struct {
Public map[string]string `bson:"public" json:"public"`
Private map[string]string `bson:"private" json:"-"`
}
func NewCommand(name string) *Command {
return &Command{
Name: name,
}
}
//following special code is in order to unmarshal the private field Command.Environ.Private,
//so put them in to this file for less confusion
type Environ_p struct {
Private map[string]string `json:"private"`
}
type Command_p struct {
Environ *Environ_p `json:"environ"`
}
type Task_p struct {
Cmd *Command_p `json:"cmd"`
}
type Job_p struct {
Tasks []*Task_p `json:"tasks"`
}