...
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 *TraceServiceConfig) Validate() error {
40 if m == nil {
41 return nil
42 }
43
44 if m.GetGrpcService() == nil {
45 return TraceServiceConfigValidationError{
46 field: "GrpcService",
47 reason: "value is required",
48 }
49 }
50
51 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
52 if err := v.Validate(); err != nil {
53 return TraceServiceConfigValidationError{
54 field: "GrpcService",
55 reason: "embedded message failed validation",
56 cause: err,
57 }
58 }
59 }
60
61 return nil
62 }
63
64
65
66 type TraceServiceConfigValidationError struct {
67 field string
68 reason string
69 cause error
70 key bool
71 }
72
73
74 func (e TraceServiceConfigValidationError) Field() string { return e.field }
75
76
77 func (e TraceServiceConfigValidationError) Reason() string { return e.reason }
78
79
80 func (e TraceServiceConfigValidationError) Cause() error { return e.cause }
81
82
83 func (e TraceServiceConfigValidationError) Key() bool { return e.key }
84
85
86 func (e TraceServiceConfigValidationError) ErrorName() string {
87 return "TraceServiceConfigValidationError"
88 }
89
90
91 func (e TraceServiceConfigValidationError) Error() string {
92 cause := ""
93 if e.cause != nil {
94 cause = fmt.Sprintf(" | caused by: %v", e.cause)
95 }
96
97 key := ""
98 if e.key {
99 key = "key for "
100 }
101
102 return fmt.Sprintf(
103 "invalid %sTraceServiceConfig.%s: %s%s",
104 key,
105 e.field,
106 e.reason,
107 cause)
108 }
109
110 var _ error = TraceServiceConfigValidationError{}
111
112 var _ interface {
113 Field() string
114 Reason() string
115 Key() bool
116 Cause() error
117 ErrorName() string
118 } = TraceServiceConfigValidationError{}
119
View as plain text