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