-
Notifications
You must be signed in to change notification settings - Fork 1
/
configuration_template.validator.pb.go
59 lines (54 loc) · 2.38 KB
/
configuration_template.validator.pb.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
55
56
57
58
59
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: configuration_template.proto
package collector_center
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
regexp "regexp"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
var _regex_ConfigurationTemplate_Id = regexp.MustCompile(`[0-9a-f]{24}`)
var _regex_ConfigurationTemplate_TimeRange = regexp.MustCompile(`[0-9]{2}:[0-9]{2}-[0-9]{2}:[0-9]{2}`)
func (this *ConfigurationTemplate) Validate() error {
if !_regex_ConfigurationTemplate_Id.MatchString(this.Id) {
return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`value '%v' must be a string conforming to regex "[0-9a-f]{24}"`, this.Id))
}
if !(len(this.Name) > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("Name", fmt.Errorf(`value '%v' must have a length greater than '0'`, this.Name))
}
if this.Kwargs != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Kwargs); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Kwargs", err)
}
}
if this.Env != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Env); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Env", err)
}
}
if this.Script != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Script); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Script", err)
}
}
if this.TargetRange != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TargetRange); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("TargetRange", err)
}
}
if !(this.Interval > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("Interval", fmt.Errorf(`value '%v' must be greater than '0'`, this.Interval))
}
if !_regex_ConfigurationTemplate_TimeRange.MatchString(this.TimeRange) {
return github_com_mwitkow_go_proto_validators.FieldError("TimeRange", fmt.Errorf(`value '%v' must be a string conforming to regex "[0-9]{2}:[0-9]{2}-[0-9]{2}:[0-9]{2}"`, this.TimeRange))
}
return nil
}