gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/api/v2/scoped_route.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/api/v2/scoped_route.proto 3 4 package envoy_api_v2 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 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 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 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on ScopedRouteConfiguration with the rules 37 // defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *ScopedRouteConfiguration) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if len(m.GetName()) < 1 { 45 return ScopedRouteConfigurationValidationError{ 46 field: "Name", 47 reason: "value length must be at least 1 bytes", 48 } 49 } 50 51 if len(m.GetRouteConfigurationName()) < 1 { 52 return ScopedRouteConfigurationValidationError{ 53 field: "RouteConfigurationName", 54 reason: "value length must be at least 1 bytes", 55 } 56 } 57 58 if m.GetKey() == nil { 59 return ScopedRouteConfigurationValidationError{ 60 field: "Key", 61 reason: "value is required", 62 } 63 } 64 65 if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok { 66 if err := v.Validate(); err != nil { 67 return ScopedRouteConfigurationValidationError{ 68 field: "Key", 69 reason: "embedded message failed validation", 70 cause: err, 71 } 72 } 73 } 74 75 return nil 76 } 77 78 // ScopedRouteConfigurationValidationError is the validation error returned by 79 // ScopedRouteConfiguration.Validate if the designated constraints aren't met. 80 type ScopedRouteConfigurationValidationError struct { 81 field string 82 reason string 83 cause error 84 key bool 85 } 86 87 // Field function returns field value. 88 func (e ScopedRouteConfigurationValidationError) Field() string { return e.field } 89 90 // Reason function returns reason value. 91 func (e ScopedRouteConfigurationValidationError) Reason() string { return e.reason } 92 93 // Cause function returns cause value. 94 func (e ScopedRouteConfigurationValidationError) Cause() error { return e.cause } 95 96 // Key function returns key value. 97 func (e ScopedRouteConfigurationValidationError) Key() bool { return e.key } 98 99 // ErrorName returns error name. 100 func (e ScopedRouteConfigurationValidationError) ErrorName() string { 101 return "ScopedRouteConfigurationValidationError" 102 } 103 104 // Error satisfies the builtin error interface 105 func (e ScopedRouteConfigurationValidationError) Error() string { 106 cause := "" 107 if e.cause != nil { 108 cause = fmt.Sprintf(" | caused by: %v", e.cause) 109 } 110 111 key := "" 112 if e.key { 113 key = "key for " 114 } 115 116 return fmt.Sprintf( 117 "invalid %sScopedRouteConfiguration.%s: %s%s", 118 key, 119 e.field, 120 e.reason, 121 cause) 122 } 123 124 var _ error = ScopedRouteConfigurationValidationError{} 125 126 var _ interface { 127 Field() string 128 Reason() string 129 Key() bool 130 Cause() error 131 ErrorName() string 132 } = ScopedRouteConfigurationValidationError{} 133 134 // Validate checks the field values on ScopedRouteConfiguration_Key with the 135 // rules defined in the proto definition for this message. If any rules are 136 // violated, an error is returned. 137 func (m *ScopedRouteConfiguration_Key) Validate() error { 138 if m == nil { 139 return nil 140 } 141 142 if len(m.GetFragments()) < 1 { 143 return ScopedRouteConfiguration_KeyValidationError{ 144 field: "Fragments", 145 reason: "value must contain at least 1 item(s)", 146 } 147 } 148 149 for idx, item := range m.GetFragments() { 150 _, _ = idx, item 151 152 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 153 if err := v.Validate(); err != nil { 154 return ScopedRouteConfiguration_KeyValidationError{ 155 field: fmt.Sprintf("Fragments[%v]", idx), 156 reason: "embedded message failed validation", 157 cause: err, 158 } 159 } 160 } 161 162 } 163 164 return nil 165 } 166 167 // ScopedRouteConfiguration_KeyValidationError is the validation error returned 168 // by ScopedRouteConfiguration_Key.Validate if the designated constraints 169 // aren't met. 170 type ScopedRouteConfiguration_KeyValidationError struct { 171 field string 172 reason string 173 cause error 174 key bool 175 } 176 177 // Field function returns field value. 178 func (e ScopedRouteConfiguration_KeyValidationError) Field() string { return e.field } 179 180 // Reason function returns reason value. 181 func (e ScopedRouteConfiguration_KeyValidationError) Reason() string { return e.reason } 182 183 // Cause function returns cause value. 184 func (e ScopedRouteConfiguration_KeyValidationError) Cause() error { return e.cause } 185 186 // Key function returns key value. 187 func (e ScopedRouteConfiguration_KeyValidationError) Key() bool { return e.key } 188 189 // ErrorName returns error name. 190 func (e ScopedRouteConfiguration_KeyValidationError) ErrorName() string { 191 return "ScopedRouteConfiguration_KeyValidationError" 192 } 193 194 // Error satisfies the builtin error interface 195 func (e ScopedRouteConfiguration_KeyValidationError) Error() string { 196 cause := "" 197 if e.cause != nil { 198 cause = fmt.Sprintf(" | caused by: %v", e.cause) 199 } 200 201 key := "" 202 if e.key { 203 key = "key for " 204 } 205 206 return fmt.Sprintf( 207 "invalid %sScopedRouteConfiguration_Key.%s: %s%s", 208 key, 209 e.field, 210 e.reason, 211 cause) 212 } 213 214 var _ error = ScopedRouteConfiguration_KeyValidationError{} 215 216 var _ interface { 217 Field() string 218 Reason() string 219 Key() bool 220 Cause() error 221 ErrorName() string 222 } = ScopedRouteConfiguration_KeyValidationError{} 223 224 // Validate checks the field values on ScopedRouteConfiguration_Key_Fragment 225 // with the rules defined in the proto definition for this message. If any 226 // rules are violated, an error is returned. 227 func (m *ScopedRouteConfiguration_Key_Fragment) Validate() error { 228 if m == nil { 229 return nil 230 } 231 232 switch m.Type.(type) { 233 234 case *ScopedRouteConfiguration_Key_Fragment_StringKey: 235 // no validation rules for StringKey 236 237 default: 238 return ScopedRouteConfiguration_Key_FragmentValidationError{ 239 field: "Type", 240 reason: "value is required", 241 } 242 243 } 244 245 return nil 246 } 247 248 // ScopedRouteConfiguration_Key_FragmentValidationError is the validation error 249 // returned by ScopedRouteConfiguration_Key_Fragment.Validate if the 250 // designated constraints aren't met. 251 type ScopedRouteConfiguration_Key_FragmentValidationError struct { 252 field string 253 reason string 254 cause error 255 key bool 256 } 257 258 // Field function returns field value. 259 func (e ScopedRouteConfiguration_Key_FragmentValidationError) Field() string { return e.field } 260 261 // Reason function returns reason value. 262 func (e ScopedRouteConfiguration_Key_FragmentValidationError) Reason() string { return e.reason } 263 264 // Cause function returns cause value. 265 func (e ScopedRouteConfiguration_Key_FragmentValidationError) Cause() error { return e.cause } 266 267 // Key function returns key value. 268 func (e ScopedRouteConfiguration_Key_FragmentValidationError) Key() bool { return e.key } 269 270 // ErrorName returns error name. 271 func (e ScopedRouteConfiguration_Key_FragmentValidationError) ErrorName() string { 272 return "ScopedRouteConfiguration_Key_FragmentValidationError" 273 } 274 275 // Error satisfies the builtin error interface 276 func (e ScopedRouteConfiguration_Key_FragmentValidationError) Error() string { 277 cause := "" 278 if e.cause != nil { 279 cause = fmt.Sprintf(" | caused by: %v", e.cause) 280 } 281 282 key := "" 283 if e.key { 284 key = "key for " 285 } 286 287 return fmt.Sprintf( 288 "invalid %sScopedRouteConfiguration_Key_Fragment.%s: %s%s", 289 key, 290 e.field, 291 e.reason, 292 cause) 293 } 294 295 var _ error = ScopedRouteConfiguration_Key_FragmentValidationError{} 296 297 var _ interface { 298 Field() string 299 Reason() string 300 Key() bool 301 Cause() error 302 ErrorName() string 303 } = ScopedRouteConfiguration_Key_FragmentValidationError{}