...
1
2
3
4 package envoy_extensions_clusters_aggregate_v3
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "strings"
15 "time"
16 "unicode/utf8"
17
18 "github.com/golang/protobuf/ptypes"
19 )
20
21
22 var (
23 _ = bytes.MinRead
24 _ = errors.New("")
25 _ = fmt.Print
26 _ = utf8.UTFMax
27 _ = (*regexp.Regexp)(nil)
28 _ = (*strings.Reader)(nil)
29 _ = net.IPv4len
30 _ = time.Duration(0)
31 _ = (*url.URL)(nil)
32 _ = (*mail.Address)(nil)
33 _ = ptypes.DynamicAny{}
34 )
35
36
37
38
39 func (m *ClusterConfig) Validate() error {
40 if m == nil {
41 return nil
42 }
43
44 if len(m.GetClusters()) < 1 {
45 return ClusterConfigValidationError{
46 field: "Clusters",
47 reason: "value must contain at least 1 item(s)",
48 }
49 }
50
51 return nil
52 }
53
54
55
56 type ClusterConfigValidationError struct {
57 field string
58 reason string
59 cause error
60 key bool
61 }
62
63
64 func (e ClusterConfigValidationError) Field() string { return e.field }
65
66
67 func (e ClusterConfigValidationError) Reason() string { return e.reason }
68
69
70 func (e ClusterConfigValidationError) Cause() error { return e.cause }
71
72
73 func (e ClusterConfigValidationError) Key() bool { return e.key }
74
75
76 func (e ClusterConfigValidationError) ErrorName() string { return "ClusterConfigValidationError" }
77
78
79 func (e ClusterConfigValidationError) Error() string {
80 cause := ""
81 if e.cause != nil {
82 cause = fmt.Sprintf(" | caused by: %v", e.cause)
83 }
84
85 key := ""
86 if e.key {
87 key = "key for "
88 }
89
90 return fmt.Sprintf(
91 "invalid %sClusterConfig.%s: %s%s",
92 key,
93 e.field,
94 e.reason,
95 cause)
96 }
97
98 var _ error = ClusterConfigValidationError{}
99
100 var _ interface {
101 Field() string
102 Reason() string
103 Key() bool
104 Cause() error
105 ErrorName() string
106 } = ClusterConfigValidationError{}
107
View as plain text