This repository has been archived by the owner on May 13, 2022. It is now read-only.
/
deploy.go
52 lines (45 loc) · 1.72 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
package def
import (
"github.com/go-ozzo/ozzo-validation"
"github.com/hyperledger/burrow/deploy/def/rule"
)
type Packages struct {
Address string `mapstructure:"," json:"," yaml:"," toml:","`
BinPath string `mapstructure:"," json:"," yaml:"," toml:","`
ChainURL 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:","`
Signer string `mapstructure:"," json:"," yaml:"," toml:","`
Verbose bool `mapstructure:"," json:"," yaml:"," toml:","`
YAMLPath string `mapstructure:"," json:"," yaml:"," toml:","`
Package *Package
Client
}
func (do *Packages) Validate() error {
return validation.ValidateStruct(do,
validation.Field(&do.Address, rule.Address),
validation.Field(&do.DefaultAmount, rule.Uint64),
validation.Field(&do.DefaultFee, rule.Uint64),
validation.Field(&do.DefaultGas, rule.Uint64),
validation.Field(&do.Package),
)
}
func (do *Packages) Dial() error {
return do.Client.Dial(do.ChainURL, do.Signer)
}
type Package struct {
Account string
Jobs []*Job
}
func (pkg *Package) Validate() error {
return validation.ValidateStruct(pkg,
validation.Field(&pkg.Account, rule.Address),
validation.Field(&pkg.Jobs),
)
}