...
1
2
3
4 package envoy_config_trace_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 *OpenCensusConfig) Validate() error {
40 if m == nil {
41 return nil
42 }
43
44 if v, ok := interface{}(m.GetTraceConfig()).(interface{ Validate() error }); ok {
45 if err := v.Validate(); err != nil {
46 return OpenCensusConfigValidationError{
47 field: "TraceConfig",
48 reason: "embedded message failed validation",
49 cause: err,
50 }
51 }
52 }
53
54
55
56
57
58
59
60
61
62 if v, ok := interface{}(m.GetStackdriverGrpcService()).(interface{ Validate() error }); ok {
63 if err := v.Validate(); err != nil {
64 return OpenCensusConfigValidationError{
65 field: "StackdriverGrpcService",
66 reason: "embedded message failed validation",
67 cause: err,
68 }
69 }
70 }
71
72
73
74
75
76
77
78
79
80 if v, ok := interface{}(m.GetOcagentGrpcService()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return OpenCensusConfigValidationError{
83 field: "OcagentGrpcService",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 return nil
91 }
92
93
94
95 type OpenCensusConfigValidationError struct {
96 field string
97 reason string
98 cause error
99 key bool
100 }
101
102
103 func (e OpenCensusConfigValidationError) Field() string { return e.field }
104
105
106 func (e OpenCensusConfigValidationError) Reason() string { return e.reason }
107
108
109 func (e OpenCensusConfigValidationError) Cause() error { return e.cause }
110
111
112 func (e OpenCensusConfigValidationError) Key() bool { return e.key }
113
114
115 func (e OpenCensusConfigValidationError) ErrorName() string { return "OpenCensusConfigValidationError" }
116
117
118 func (e OpenCensusConfigValidationError) Error() string {
119 cause := ""
120 if e.cause != nil {
121 cause = fmt.Sprintf(" | caused by: %v", e.cause)
122 }
123
124 key := ""
125 if e.key {
126 key = "key for "
127 }
128
129 return fmt.Sprintf(
130 "invalid %sOpenCensusConfig.%s: %s%s",
131 key,
132 e.field,
133 e.reason,
134 cause)
135 }
136
137 var _ error = OpenCensusConfigValidationError{}
138
139 var _ interface {
140 Field() string
141 Reason() string
142 Key() bool
143 Cause() error
144 ErrorName() string
145 } = OpenCensusConfigValidationError{}
146
View as plain text