-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcreate.go
More file actions
35 lines (33 loc) · 733 Bytes
/
create.go
File metadata and controls
35 lines (33 loc) · 733 Bytes
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
package main
import (
"github.com/BurntSushi/toml"
"github.com/crosbymichael/boss/api/v1"
"github.com/crosbymichael/boss/cmd"
"github.com/urfave/cli"
)
var createCommand = cli.Command{
Name: "create",
Usage: "create a container",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "update",
Usage: "create or update",
},
},
Action: func(clix *cli.Context) error {
var container cmd.Container
if _, err := toml.DecodeFile(clix.Args().First(), &container); err != nil {
return err
}
agent, err := Agent(clix)
if err != nil {
return err
}
defer agent.Close()
_, err = agent.Create(Context(), &v1.CreateRequest{
Container: container.Proto(),
Update: clix.Bool("update"),
})
return err
},
}