forked from hyperledger-archives/burrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.go
54 lines (48 loc) · 2.17 KB
/
deploy.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
50
51
52
53
54
package def
import (
validation "github.com/go-ozzo/ozzo-validation"
"github.com/hyperledger/burrow/deploy/def/rule"
)
const DefaultOutputFile = "deploy.output.json"
type DeployArgs struct {
Chain string `mapstructure:"," json:"," yaml:"," toml:","`
KeysService string `mapstructure:"," json:"," yaml:"," toml:","`
MempoolSign bool `mapstructure:"," json:"," yaml:"," toml:","`
Timeout int `mapstructure:"," json:"," yaml:"," toml:","`
Address string `mapstructure:"," json:"," yaml:"," toml:","`
BinPath string `mapstructure:"," json:"," yaml:"," toml:","`
CurrentOutput string `mapstructure:"," json:"," yaml:"," toml:","`
Debug bool `mapstructure:"," json:"," yaml:"," toml:","`
DefaultAmount string `mapstructure:"," json:"," yaml:"," toml:","`
DefaultFee string `mapstructure:"," json:"," yaml:"," toml:","`
DefaultGas string `mapstructure:"," json:"," yaml:"," toml:","`
DefaultOutput string `mapstructure:"," json:"," yaml:"," toml:","`
DefaultSets []string `mapstructure:"," json:"," yaml:"," toml:","`
Path string `mapstructure:"," json:"," yaml:"," toml:","`
Verbose bool `mapstructure:"," json:"," yaml:"," toml:","`
Jobs int `mapstructure:"," json:"," yaml:"," toml:","`
ProposeVerify bool `mapstructure:"," json:"," yaml:"," toml:","`
ProposeVote bool `mapstructure:"," json:"," yaml:"," toml:","`
ProposeCreate bool `mapstructure:"," json:"," yaml:"," toml:","`
}
func (args *DeployArgs) Validate() error {
return validation.ValidateStruct(args,
validation.Field(&args.DefaultAmount, rule.Uint64),
validation.Field(&args.DefaultFee, rule.Uint64),
validation.Field(&args.DefaultGas, rule.Uint64),
)
}
type Playbook struct {
Filename string
Account string
Jobs []*Job
Path string `mapstructure:"-" json:"-" yaml:"-" toml:"-"`
BinPath string `mapstructure:"-" json:"-" yaml:"-" toml:"-"`
// If we're in a proposal or meta job, reference our parent script
Parent *Playbook `mapstructure:"-" json:"-" yaml:"-" toml:"-"`
}
func (pkg *Playbook) Validate() error {
return validation.ValidateStruct(pkg,
validation.Field(&pkg.Jobs),
)
}