"Fossies" - the Fresh Open Source Software Archive

Member "cri-o-1.25.1/vendor/github.com/envoyproxy/go-control-plane/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go" (7 Oct 2022, 62505 Bytes) of package /linux/misc/cri-o-1.25.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Code generated by protoc-gen-validate. DO NOT EDIT.
    2 // source: envoy/config/filter/accesslog/v2/accesslog.proto
    3 
    4 package accesslogv2
    5 
    6 import (
    7     "bytes"
    8     "errors"
    9     "fmt"
   10     "net"
   11     "net/mail"
   12     "net/url"
   13     "regexp"
   14     "sort"
   15     "strings"
   16     "time"
   17     "unicode/utf8"
   18 
   19     "google.golang.org/protobuf/types/known/anypb"
   20 )
   21 
   22 // ensure the imports are used
   23 var (
   24     _ = bytes.MinRead
   25     _ = errors.New("")
   26     _ = fmt.Print
   27     _ = utf8.UTFMax
   28     _ = (*regexp.Regexp)(nil)
   29     _ = (*strings.Reader)(nil)
   30     _ = net.IPv4len
   31     _ = time.Duration(0)
   32     _ = (*url.URL)(nil)
   33     _ = (*mail.Address)(nil)
   34     _ = anypb.Any{}
   35     _ = sort.Sort
   36 )
   37 
   38 // Validate checks the field values on AccessLog with the rules defined in the
   39 // proto definition for this message. If any rules are violated, the first
   40 // error encountered is returned, or nil if there are no violations.
   41 func (m *AccessLog) Validate() error {
   42     return m.validate(false)
   43 }
   44 
   45 // ValidateAll checks the field values on AccessLog with the rules defined in
   46 // the proto definition for this message. If any rules are violated, the
   47 // result is a list of violation errors wrapped in AccessLogMultiError, or nil
   48 // if none found.
   49 func (m *AccessLog) ValidateAll() error {
   50     return m.validate(true)
   51 }
   52 
   53 func (m *AccessLog) validate(all bool) error {
   54     if m == nil {
   55         return nil
   56     }
   57 
   58     var errors []error
   59 
   60     // no validation rules for Name
   61 
   62     if all {
   63         switch v := interface{}(m.GetFilter()).(type) {
   64         case interface{ ValidateAll() error }:
   65             if err := v.ValidateAll(); err != nil {
   66                 errors = append(errors, AccessLogValidationError{
   67                     field:  "Filter",
   68                     reason: "embedded message failed validation",
   69                     cause:  err,
   70                 })
   71             }
   72         case interface{ Validate() error }:
   73             if err := v.Validate(); err != nil {
   74                 errors = append(errors, AccessLogValidationError{
   75                     field:  "Filter",
   76                     reason: "embedded message failed validation",
   77                     cause:  err,
   78                 })
   79             }
   80         }
   81     } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok {
   82         if err := v.Validate(); err != nil {
   83             return AccessLogValidationError{
   84                 field:  "Filter",
   85                 reason: "embedded message failed validation",
   86                 cause:  err,
   87             }
   88         }
   89     }
   90 
   91     switch m.ConfigType.(type) {
   92 
   93     case *AccessLog_Config:
   94 
   95         if all {
   96             switch v := interface{}(m.GetConfig()).(type) {
   97             case interface{ ValidateAll() error }:
   98                 if err := v.ValidateAll(); err != nil {
   99                     errors = append(errors, AccessLogValidationError{
  100                         field:  "Config",
  101                         reason: "embedded message failed validation",
  102                         cause:  err,
  103                     })
  104                 }
  105             case interface{ Validate() error }:
  106                 if err := v.Validate(); err != nil {
  107                     errors = append(errors, AccessLogValidationError{
  108                         field:  "Config",
  109                         reason: "embedded message failed validation",
  110                         cause:  err,
  111                     })
  112                 }
  113             }
  114         } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
  115             if err := v.Validate(); err != nil {
  116                 return AccessLogValidationError{
  117                     field:  "Config",
  118                     reason: "embedded message failed validation",
  119                     cause:  err,
  120                 }
  121             }
  122         }
  123 
  124     case *AccessLog_TypedConfig:
  125 
  126         if all {
  127             switch v := interface{}(m.GetTypedConfig()).(type) {
  128             case interface{ ValidateAll() error }:
  129                 if err := v.ValidateAll(); err != nil {
  130                     errors = append(errors, AccessLogValidationError{
  131                         field:  "TypedConfig",
  132                         reason: "embedded message failed validation",
  133                         cause:  err,
  134                     })
  135                 }
  136             case interface{ Validate() error }:
  137                 if err := v.Validate(); err != nil {
  138                     errors = append(errors, AccessLogValidationError{
  139                         field:  "TypedConfig",
  140                         reason: "embedded message failed validation",
  141                         cause:  err,
  142                     })
  143                 }
  144             }
  145         } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  146             if err := v.Validate(); err != nil {
  147                 return AccessLogValidationError{
  148                     field:  "TypedConfig",
  149                     reason: "embedded message failed validation",
  150                     cause:  err,
  151                 }
  152             }
  153         }
  154 
  155     }
  156 
  157     if len(errors) > 0 {
  158         return AccessLogMultiError(errors)
  159     }
  160 
  161     return nil
  162 }
  163 
  164 // AccessLogMultiError is an error wrapping multiple validation errors returned
  165 // by AccessLog.ValidateAll() if the designated constraints aren't met.
  166 type AccessLogMultiError []error
  167 
  168 // Error returns a concatenation of all the error messages it wraps.
  169 func (m AccessLogMultiError) Error() string {
  170     var msgs []string
  171     for _, err := range m {
  172         msgs = append(msgs, err.Error())
  173     }
  174     return strings.Join(msgs, "; ")
  175 }
  176 
  177 // AllErrors returns a list of validation violation errors.
  178 func (m AccessLogMultiError) AllErrors() []error { return m }
  179 
  180 // AccessLogValidationError is the validation error returned by
  181 // AccessLog.Validate if the designated constraints aren't met.
  182 type AccessLogValidationError struct {
  183     field  string
  184     reason string
  185     cause  error
  186     key    bool
  187 }
  188 
  189 // Field function returns field value.
  190 func (e AccessLogValidationError) Field() string { return e.field }
  191 
  192 // Reason function returns reason value.
  193 func (e AccessLogValidationError) Reason() string { return e.reason }
  194 
  195 // Cause function returns cause value.
  196 func (e AccessLogValidationError) Cause() error { return e.cause }
  197 
  198 // Key function returns key value.
  199 func (e AccessLogValidationError) Key() bool { return e.key }
  200 
  201 // ErrorName returns error name.
  202 func (e AccessLogValidationError) ErrorName() string { return "AccessLogValidationError" }
  203 
  204 // Error satisfies the builtin error interface
  205 func (e AccessLogValidationError) Error() string {
  206     cause := ""
  207     if e.cause != nil {
  208         cause = fmt.Sprintf(" | caused by: %v", e.cause)
  209     }
  210 
  211     key := ""
  212     if e.key {
  213         key = "key for "
  214     }
  215 
  216     return fmt.Sprintf(
  217         "invalid %sAccessLog.%s: %s%s",
  218         key,
  219         e.field,
  220         e.reason,
  221         cause)
  222 }
  223 
  224 var _ error = AccessLogValidationError{}
  225 
  226 var _ interface {
  227     Field() string
  228     Reason() string
  229     Key() bool
  230     Cause() error
  231     ErrorName() string
  232 } = AccessLogValidationError{}
  233 
  234 // Validate checks the field values on AccessLogFilter with the rules defined
  235 // in the proto definition for this message. If any rules are violated, the
  236 // first error encountered is returned, or nil if there are no violations.
  237 func (m *AccessLogFilter) Validate() error {
  238     return m.validate(false)
  239 }
  240 
  241 // ValidateAll checks the field values on AccessLogFilter with the rules
  242 // defined in the proto definition for this message. If any rules are
  243 // violated, the result is a list of violation errors wrapped in
  244 // AccessLogFilterMultiError, or nil if none found.
  245 func (m *AccessLogFilter) ValidateAll() error {
  246     return m.validate(true)
  247 }
  248 
  249 func (m *AccessLogFilter) validate(all bool) error {
  250     if m == nil {
  251         return nil
  252     }
  253 
  254     var errors []error
  255 
  256     switch m.FilterSpecifier.(type) {
  257 
  258     case *AccessLogFilter_StatusCodeFilter:
  259 
  260         if all {
  261             switch v := interface{}(m.GetStatusCodeFilter()).(type) {
  262             case interface{ ValidateAll() error }:
  263                 if err := v.ValidateAll(); err != nil {
  264                     errors = append(errors, AccessLogFilterValidationError{
  265                         field:  "StatusCodeFilter",
  266                         reason: "embedded message failed validation",
  267                         cause:  err,
  268                     })
  269                 }
  270             case interface{ Validate() error }:
  271                 if err := v.Validate(); err != nil {
  272                     errors = append(errors, AccessLogFilterValidationError{
  273                         field:  "StatusCodeFilter",
  274                         reason: "embedded message failed validation",
  275                         cause:  err,
  276                     })
  277                 }
  278             }
  279         } else if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok {
  280             if err := v.Validate(); err != nil {
  281                 return AccessLogFilterValidationError{
  282                     field:  "StatusCodeFilter",
  283                     reason: "embedded message failed validation",
  284                     cause:  err,
  285                 }
  286             }
  287         }
  288 
  289     case *AccessLogFilter_DurationFilter:
  290 
  291         if all {
  292             switch v := interface{}(m.GetDurationFilter()).(type) {
  293             case interface{ ValidateAll() error }:
  294                 if err := v.ValidateAll(); err != nil {
  295                     errors = append(errors, AccessLogFilterValidationError{
  296                         field:  "DurationFilter",
  297                         reason: "embedded message failed validation",
  298                         cause:  err,
  299                     })
  300                 }
  301             case interface{ Validate() error }:
  302                 if err := v.Validate(); err != nil {
  303                     errors = append(errors, AccessLogFilterValidationError{
  304                         field:  "DurationFilter",
  305                         reason: "embedded message failed validation",
  306                         cause:  err,
  307                     })
  308                 }
  309             }
  310         } else if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok {
  311             if err := v.Validate(); err != nil {
  312                 return AccessLogFilterValidationError{
  313                     field:  "DurationFilter",
  314                     reason: "embedded message failed validation",
  315                     cause:  err,
  316                 }
  317             }
  318         }
  319 
  320     case *AccessLogFilter_NotHealthCheckFilter:
  321 
  322         if all {
  323             switch v := interface{}(m.GetNotHealthCheckFilter()).(type) {
  324             case interface{ ValidateAll() error }:
  325                 if err := v.ValidateAll(); err != nil {
  326                     errors = append(errors, AccessLogFilterValidationError{
  327                         field:  "NotHealthCheckFilter",
  328                         reason: "embedded message failed validation",
  329                         cause:  err,
  330                     })
  331                 }
  332             case interface{ Validate() error }:
  333                 if err := v.Validate(); err != nil {
  334                     errors = append(errors, AccessLogFilterValidationError{
  335                         field:  "NotHealthCheckFilter",
  336                         reason: "embedded message failed validation",
  337                         cause:  err,
  338                     })
  339                 }
  340             }
  341         } else if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok {
  342             if err := v.Validate(); err != nil {
  343                 return AccessLogFilterValidationError{
  344                     field:  "NotHealthCheckFilter",
  345                     reason: "embedded message failed validation",
  346                     cause:  err,
  347                 }
  348             }
  349         }
  350 
  351     case *AccessLogFilter_TraceableFilter:
  352 
  353         if all {
  354             switch v := interface{}(m.GetTraceableFilter()).(type) {
  355             case interface{ ValidateAll() error }:
  356                 if err := v.ValidateAll(); err != nil {
  357                     errors = append(errors, AccessLogFilterValidationError{
  358                         field:  "TraceableFilter",
  359                         reason: "embedded message failed validation",
  360                         cause:  err,
  361                     })
  362                 }
  363             case interface{ Validate() error }:
  364                 if err := v.Validate(); err != nil {
  365                     errors = append(errors, AccessLogFilterValidationError{
  366                         field:  "TraceableFilter",
  367                         reason: "embedded message failed validation",
  368                         cause:  err,
  369                     })
  370                 }
  371             }
  372         } else if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok {
  373             if err := v.Validate(); err != nil {
  374                 return AccessLogFilterValidationError{
  375                     field:  "TraceableFilter",
  376                     reason: "embedded message failed validation",
  377                     cause:  err,
  378                 }
  379             }
  380         }
  381 
  382     case *AccessLogFilter_RuntimeFilter:
  383 
  384         if all {
  385             switch v := interface{}(m.GetRuntimeFilter()).(type) {
  386             case interface{ ValidateAll() error }:
  387                 if err := v.ValidateAll(); err != nil {
  388                     errors = append(errors, AccessLogFilterValidationError{
  389                         field:  "RuntimeFilter",
  390                         reason: "embedded message failed validation",
  391                         cause:  err,
  392                     })
  393                 }
  394             case interface{ Validate() error }:
  395                 if err := v.Validate(); err != nil {
  396                     errors = append(errors, AccessLogFilterValidationError{
  397                         field:  "RuntimeFilter",
  398                         reason: "embedded message failed validation",
  399                         cause:  err,
  400                     })
  401                 }
  402             }
  403         } else if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok {
  404             if err := v.Validate(); err != nil {
  405                 return AccessLogFilterValidationError{
  406                     field:  "RuntimeFilter",
  407                     reason: "embedded message failed validation",
  408                     cause:  err,
  409                 }
  410             }
  411         }
  412 
  413     case *AccessLogFilter_AndFilter:
  414 
  415         if all {
  416             switch v := interface{}(m.GetAndFilter()).(type) {
  417             case interface{ ValidateAll() error }:
  418                 if err := v.ValidateAll(); err != nil {
  419                     errors = append(errors, AccessLogFilterValidationError{
  420                         field:  "AndFilter",
  421                         reason: "embedded message failed validation",
  422                         cause:  err,
  423                     })
  424                 }
  425             case interface{ Validate() error }:
  426                 if err := v.Validate(); err != nil {
  427                     errors = append(errors, AccessLogFilterValidationError{
  428                         field:  "AndFilter",
  429                         reason: "embedded message failed validation",
  430                         cause:  err,
  431                     })
  432                 }
  433             }
  434         } else if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok {
  435             if err := v.Validate(); err != nil {
  436                 return AccessLogFilterValidationError{
  437                     field:  "AndFilter",
  438                     reason: "embedded message failed validation",
  439                     cause:  err,
  440                 }
  441             }
  442         }
  443 
  444     case *AccessLogFilter_OrFilter:
  445 
  446         if all {
  447             switch v := interface{}(m.GetOrFilter()).(type) {
  448             case interface{ ValidateAll() error }:
  449                 if err := v.ValidateAll(); err != nil {
  450                     errors = append(errors, AccessLogFilterValidationError{
  451                         field:  "OrFilter",
  452                         reason: "embedded message failed validation",
  453                         cause:  err,
  454                     })
  455                 }
  456             case interface{ Validate() error }:
  457                 if err := v.Validate(); err != nil {
  458                     errors = append(errors, AccessLogFilterValidationError{
  459                         field:  "OrFilter",
  460                         reason: "embedded message failed validation",
  461                         cause:  err,
  462                     })
  463                 }
  464             }
  465         } else if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok {
  466             if err := v.Validate(); err != nil {
  467                 return AccessLogFilterValidationError{
  468                     field:  "OrFilter",
  469                     reason: "embedded message failed validation",
  470                     cause:  err,
  471                 }
  472             }
  473         }
  474 
  475     case *AccessLogFilter_HeaderFilter:
  476 
  477         if all {
  478             switch v := interface{}(m.GetHeaderFilter()).(type) {
  479             case interface{ ValidateAll() error }:
  480                 if err := v.ValidateAll(); err != nil {
  481                     errors = append(errors, AccessLogFilterValidationError{
  482                         field:  "HeaderFilter",
  483                         reason: "embedded message failed validation",
  484                         cause:  err,
  485                     })
  486                 }
  487             case interface{ Validate() error }:
  488                 if err := v.Validate(); err != nil {
  489                     errors = append(errors, AccessLogFilterValidationError{
  490                         field:  "HeaderFilter",
  491                         reason: "embedded message failed validation",
  492                         cause:  err,
  493                     })
  494                 }
  495             }
  496         } else if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok {
  497             if err := v.Validate(); err != nil {
  498                 return AccessLogFilterValidationError{
  499                     field:  "HeaderFilter",
  500                     reason: "embedded message failed validation",
  501                     cause:  err,
  502                 }
  503             }
  504         }
  505 
  506     case *AccessLogFilter_ResponseFlagFilter:
  507 
  508         if all {
  509             switch v := interface{}(m.GetResponseFlagFilter()).(type) {
  510             case interface{ ValidateAll() error }:
  511                 if err := v.ValidateAll(); err != nil {
  512                     errors = append(errors, AccessLogFilterValidationError{
  513                         field:  "ResponseFlagFilter",
  514                         reason: "embedded message failed validation",
  515                         cause:  err,
  516                     })
  517                 }
  518             case interface{ Validate() error }:
  519                 if err := v.Validate(); err != nil {
  520                     errors = append(errors, AccessLogFilterValidationError{
  521                         field:  "ResponseFlagFilter",
  522                         reason: "embedded message failed validation",
  523                         cause:  err,
  524                     })
  525                 }
  526             }
  527         } else if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok {
  528             if err := v.Validate(); err != nil {
  529                 return AccessLogFilterValidationError{
  530                     field:  "ResponseFlagFilter",
  531                     reason: "embedded message failed validation",
  532                     cause:  err,
  533                 }
  534             }
  535         }
  536 
  537     case *AccessLogFilter_GrpcStatusFilter:
  538 
  539         if all {
  540             switch v := interface{}(m.GetGrpcStatusFilter()).(type) {
  541             case interface{ ValidateAll() error }:
  542                 if err := v.ValidateAll(); err != nil {
  543                     errors = append(errors, AccessLogFilterValidationError{
  544                         field:  "GrpcStatusFilter",
  545                         reason: "embedded message failed validation",
  546                         cause:  err,
  547                     })
  548                 }
  549             case interface{ Validate() error }:
  550                 if err := v.Validate(); err != nil {
  551                     errors = append(errors, AccessLogFilterValidationError{
  552                         field:  "GrpcStatusFilter",
  553                         reason: "embedded message failed validation",
  554                         cause:  err,
  555                     })
  556                 }
  557             }
  558         } else if v, ok := interface{}(m.GetGrpcStatusFilter()).(interface{ Validate() error }); ok {
  559             if err := v.Validate(); err != nil {
  560                 return AccessLogFilterValidationError{
  561                     field:  "GrpcStatusFilter",
  562                     reason: "embedded message failed validation",
  563                     cause:  err,
  564                 }
  565             }
  566         }
  567 
  568     case *AccessLogFilter_ExtensionFilter:
  569 
  570         if all {
  571             switch v := interface{}(m.GetExtensionFilter()).(type) {
  572             case interface{ ValidateAll() error }:
  573                 if err := v.ValidateAll(); err != nil {
  574                     errors = append(errors, AccessLogFilterValidationError{
  575                         field:  "ExtensionFilter",
  576                         reason: "embedded message failed validation",
  577                         cause:  err,
  578                     })
  579                 }
  580             case interface{ Validate() error }:
  581                 if err := v.Validate(); err != nil {
  582                     errors = append(errors, AccessLogFilterValidationError{
  583                         field:  "ExtensionFilter",
  584                         reason: "embedded message failed validation",
  585                         cause:  err,
  586                     })
  587                 }
  588             }
  589         } else if v, ok := interface{}(m.GetExtensionFilter()).(interface{ Validate() error }); ok {
  590             if err := v.Validate(); err != nil {
  591                 return AccessLogFilterValidationError{
  592                     field:  "ExtensionFilter",
  593                     reason: "embedded message failed validation",
  594                     cause:  err,
  595                 }
  596             }
  597         }
  598 
  599     default:
  600         err := AccessLogFilterValidationError{
  601             field:  "FilterSpecifier",
  602             reason: "value is required",
  603         }
  604         if !all {
  605             return err
  606         }
  607         errors = append(errors, err)
  608 
  609     }
  610 
  611     if len(errors) > 0 {
  612         return AccessLogFilterMultiError(errors)
  613     }
  614 
  615     return nil
  616 }
  617 
  618 // AccessLogFilterMultiError is an error wrapping multiple validation errors
  619 // returned by AccessLogFilter.ValidateAll() if the designated constraints
  620 // aren't met.
  621 type AccessLogFilterMultiError []error
  622 
  623 // Error returns a concatenation of all the error messages it wraps.
  624 func (m AccessLogFilterMultiError) Error() string {
  625     var msgs []string
  626     for _, err := range m {
  627         msgs = append(msgs, err.Error())
  628     }
  629     return strings.Join(msgs, "; ")
  630 }
  631 
  632 // AllErrors returns a list of validation violation errors.
  633 func (m AccessLogFilterMultiError) AllErrors() []error { return m }
  634 
  635 // AccessLogFilterValidationError is the validation error returned by
  636 // AccessLogFilter.Validate if the designated constraints aren't met.
  637 type AccessLogFilterValidationError struct {
  638     field  string
  639     reason string
  640     cause  error
  641     key    bool
  642 }
  643 
  644 // Field function returns field value.
  645 func (e AccessLogFilterValidationError) Field() string { return e.field }
  646 
  647 // Reason function returns reason value.
  648 func (e AccessLogFilterValidationError) Reason() string { return e.reason }
  649 
  650 // Cause function returns cause value.
  651 func (e AccessLogFilterValidationError) Cause() error { return e.cause }
  652 
  653 // Key function returns key value.
  654 func (e AccessLogFilterValidationError) Key() bool { return e.key }
  655 
  656 // ErrorName returns error name.
  657 func (e AccessLogFilterValidationError) ErrorName() string { return "AccessLogFilterValidationError" }
  658 
  659 // Error satisfies the builtin error interface
  660 func (e AccessLogFilterValidationError) Error() string {
  661     cause := ""
  662     if e.cause != nil {
  663         cause = fmt.Sprintf(" | caused by: %v", e.cause)
  664     }
  665 
  666     key := ""
  667     if e.key {
  668         key = "key for "
  669     }
  670 
  671     return fmt.Sprintf(
  672         "invalid %sAccessLogFilter.%s: %s%s",
  673         key,
  674         e.field,
  675         e.reason,
  676         cause)
  677 }
  678 
  679 var _ error = AccessLogFilterValidationError{}
  680 
  681 var _ interface {
  682     Field() string
  683     Reason() string
  684     Key() bool
  685     Cause() error
  686     ErrorName() string
  687 } = AccessLogFilterValidationError{}
  688 
  689 // Validate checks the field values on ComparisonFilter with the rules defined
  690 // in the proto definition for this message. If any rules are violated, the
  691 // first error encountered is returned, or nil if there are no violations.
  692 func (m *ComparisonFilter) Validate() error {
  693     return m.validate(false)
  694 }
  695 
  696 // ValidateAll checks the field values on ComparisonFilter with the rules
  697 // defined in the proto definition for this message. If any rules are
  698 // violated, the result is a list of violation errors wrapped in
  699 // ComparisonFilterMultiError, or nil if none found.
  700 func (m *ComparisonFilter) ValidateAll() error {
  701     return m.validate(true)
  702 }
  703 
  704 func (m *ComparisonFilter) validate(all bool) error {
  705     if m == nil {
  706         return nil
  707     }
  708 
  709     var errors []error
  710 
  711     if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
  712         err := ComparisonFilterValidationError{
  713             field:  "Op",
  714             reason: "value must be one of the defined enum values",
  715         }
  716         if !all {
  717             return err
  718         }
  719         errors = append(errors, err)
  720     }
  721 
  722     if all {
  723         switch v := interface{}(m.GetValue()).(type) {
  724         case interface{ ValidateAll() error }:
  725             if err := v.ValidateAll(); err != nil {
  726                 errors = append(errors, ComparisonFilterValidationError{
  727                     field:  "Value",
  728                     reason: "embedded message failed validation",
  729                     cause:  err,
  730                 })
  731             }
  732         case interface{ Validate() error }:
  733             if err := v.Validate(); err != nil {
  734                 errors = append(errors, ComparisonFilterValidationError{
  735                     field:  "Value",
  736                     reason: "embedded message failed validation",
  737                     cause:  err,
  738                 })
  739             }
  740         }
  741     } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
  742         if err := v.Validate(); err != nil {
  743             return ComparisonFilterValidationError{
  744                 field:  "Value",
  745                 reason: "embedded message failed validation",
  746                 cause:  err,
  747             }
  748         }
  749     }
  750 
  751     if len(errors) > 0 {
  752         return ComparisonFilterMultiError(errors)
  753     }
  754 
  755     return nil
  756 }
  757 
  758 // ComparisonFilterMultiError is an error wrapping multiple validation errors
  759 // returned by ComparisonFilter.ValidateAll() if the designated constraints
  760 // aren't met.
  761 type ComparisonFilterMultiError []error
  762 
  763 // Error returns a concatenation of all the error messages it wraps.
  764 func (m ComparisonFilterMultiError) Error() string {
  765     var msgs []string
  766     for _, err := range m {
  767         msgs = append(msgs, err.Error())
  768     }
  769     return strings.Join(msgs, "; ")
  770 }
  771 
  772 // AllErrors returns a list of validation violation errors.
  773 func (m ComparisonFilterMultiError) AllErrors() []error { return m }
  774 
  775 // ComparisonFilterValidationError is the validation error returned by
  776 // ComparisonFilter.Validate if the designated constraints aren't met.
  777 type ComparisonFilterValidationError struct {
  778     field  string
  779     reason string
  780     cause  error
  781     key    bool
  782 }
  783 
  784 // Field function returns field value.
  785 func (e ComparisonFilterValidationError) Field() string { return e.field }
  786 
  787 // Reason function returns reason value.
  788 func (e ComparisonFilterValidationError) Reason() string { return e.reason }
  789 
  790 // Cause function returns cause value.
  791 func (e ComparisonFilterValidationError) Cause() error { return e.cause }
  792 
  793 // Key function returns key value.
  794 func (e ComparisonFilterValidationError) Key() bool { return e.key }
  795 
  796 // ErrorName returns error name.
  797 func (e ComparisonFilterValidationError) ErrorName() string { return "ComparisonFilterValidationError" }
  798 
  799 // Error satisfies the builtin error interface
  800 func (e ComparisonFilterValidationError) Error() string {
  801     cause := ""
  802     if e.cause != nil {
  803         cause = fmt.Sprintf(" | caused by: %v", e.cause)
  804     }
  805 
  806     key := ""
  807     if e.key {
  808         key = "key for "
  809     }
  810 
  811     return fmt.Sprintf(
  812         "invalid %sComparisonFilter.%s: %s%s",
  813         key,
  814         e.field,
  815         e.reason,
  816         cause)
  817 }
  818 
  819 var _ error = ComparisonFilterValidationError{}
  820 
  821 var _ interface {
  822     Field() string
  823     Reason() string
  824     Key() bool
  825     Cause() error
  826     ErrorName() string
  827 } = ComparisonFilterValidationError{}
  828 
  829 // Validate checks the field values on StatusCodeFilter with the rules defined
  830 // in the proto definition for this message. If any rules are violated, the
  831 // first error encountered is returned, or nil if there are no violations.
  832 func (m *StatusCodeFilter) Validate() error {
  833     return m.validate(false)
  834 }
  835 
  836 // ValidateAll checks the field values on StatusCodeFilter with the rules
  837 // defined in the proto definition for this message. If any rules are
  838 // violated, the result is a list of violation errors wrapped in
  839 // StatusCodeFilterMultiError, or nil if none found.
  840 func (m *StatusCodeFilter) ValidateAll() error {
  841     return m.validate(true)
  842 }
  843 
  844 func (m *StatusCodeFilter) validate(all bool) error {
  845     if m == nil {
  846         return nil
  847     }
  848 
  849     var errors []error
  850 
  851     if m.GetComparison() == nil {
  852         err := StatusCodeFilterValidationError{
  853             field:  "Comparison",
  854             reason: "value is required",
  855         }
  856         if !all {
  857             return err
  858         }
  859         errors = append(errors, err)
  860     }
  861 
  862     if all {
  863         switch v := interface{}(m.GetComparison()).(type) {
  864         case interface{ ValidateAll() error }:
  865             if err := v.ValidateAll(); err != nil {
  866                 errors = append(errors, StatusCodeFilterValidationError{
  867                     field:  "Comparison",
  868                     reason: "embedded message failed validation",
  869                     cause:  err,
  870                 })
  871             }
  872         case interface{ Validate() error }:
  873             if err := v.Validate(); err != nil {
  874                 errors = append(errors, StatusCodeFilterValidationError{
  875                     field:  "Comparison",
  876                     reason: "embedded message failed validation",
  877                     cause:  err,
  878                 })
  879             }
  880         }
  881     } else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
  882         if err := v.Validate(); err != nil {
  883             return StatusCodeFilterValidationError{
  884                 field:  "Comparison",
  885                 reason: "embedded message failed validation",
  886                 cause:  err,
  887             }
  888         }
  889     }
  890 
  891     if len(errors) > 0 {
  892         return StatusCodeFilterMultiError(errors)
  893     }
  894 
  895     return nil
  896 }
  897 
  898 // StatusCodeFilterMultiError is an error wrapping multiple validation errors
  899 // returned by StatusCodeFilter.ValidateAll() if the designated constraints
  900 // aren't met.
  901 type StatusCodeFilterMultiError []error
  902 
  903 // Error returns a concatenation of all the error messages it wraps.
  904 func (m StatusCodeFilterMultiError) Error() string {
  905     var msgs []string
  906     for _, err := range m {
  907         msgs = append(msgs, err.Error())
  908     }
  909     return strings.Join(msgs, "; ")
  910 }
  911 
  912 // AllErrors returns a list of validation violation errors.
  913 func (m StatusCodeFilterMultiError) AllErrors() []error { return m }
  914 
  915 // StatusCodeFilterValidationError is the validation error returned by
  916 // StatusCodeFilter.Validate if the designated constraints aren't met.
  917 type StatusCodeFilterValidationError struct {
  918     field  string
  919     reason string
  920     cause  error
  921     key    bool
  922 }
  923 
  924 // Field function returns field value.
  925 func (e StatusCodeFilterValidationError) Field() string { return e.field }
  926 
  927 // Reason function returns reason value.
  928 func (e StatusCodeFilterValidationError) Reason() string { return e.reason }
  929 
  930 // Cause function returns cause value.
  931 func (e StatusCodeFilterValidationError) Cause() error { return e.cause }
  932 
  933 // Key function returns key value.
  934 func (e StatusCodeFilterValidationError) Key() bool { return e.key }
  935 
  936 // ErrorName returns error name.
  937 func (e StatusCodeFilterValidationError) ErrorName() string { return "StatusCodeFilterValidationError" }
  938 
  939 // Error satisfies the builtin error interface
  940 func (e StatusCodeFilterValidationError) Error() string {
  941     cause := ""
  942     if e.cause != nil {
  943         cause = fmt.Sprintf(" | caused by: %v", e.cause)
  944     }
  945 
  946     key := ""
  947     if e.key {
  948         key = "key for "
  949     }
  950 
  951     return fmt.Sprintf(
  952         "invalid %sStatusCodeFilter.%s: %s%s",
  953         key,
  954         e.field,
  955         e.reason,
  956         cause)
  957 }
  958 
  959 var _ error = StatusCodeFilterValidationError{}
  960 
  961 var _ interface {
  962     Field() string
  963     Reason() string
  964     Key() bool
  965     Cause() error
  966     ErrorName() string
  967 } = StatusCodeFilterValidationError{}
  968 
  969 // Validate checks the field values on DurationFilter with the rules defined in
  970 // the proto definition for this message. If any rules are violated, the first
  971 // error encountered is returned, or nil if there are no violations.
  972 func (m *DurationFilter) Validate() error {
  973     return m.validate(false)
  974 }
  975 
  976 // ValidateAll checks the field values on DurationFilter with the rules defined
  977 // in the proto definition for this message. If any rules are violated, the
  978 // result is a list of violation errors wrapped in DurationFilterMultiError,
  979 // or nil if none found.
  980 func (m *DurationFilter) ValidateAll() error {
  981     return m.validate(true)
  982 }
  983 
  984 func (m *DurationFilter) validate(all bool) error {
  985     if m == nil {
  986         return nil
  987     }
  988 
  989     var errors []error
  990 
  991     if m.GetComparison() == nil {
  992         err := DurationFilterValidationError{
  993             field:  "Comparison",
  994             reason: "value is required",
  995         }
  996         if !all {
  997             return err
  998         }
  999         errors = append(errors, err)
 1000     }
 1001 
 1002     if all {
 1003         switch v := interface{}(m.GetComparison()).(type) {
 1004         case interface{ ValidateAll() error }:
 1005             if err := v.ValidateAll(); err != nil {
 1006                 errors = append(errors, DurationFilterValidationError{
 1007                     field:  "Comparison",
 1008                     reason: "embedded message failed validation",
 1009                     cause:  err,
 1010                 })
 1011             }
 1012         case interface{ Validate() error }:
 1013             if err := v.Validate(); err != nil {
 1014                 errors = append(errors, DurationFilterValidationError{
 1015                     field:  "Comparison",
 1016                     reason: "embedded message failed validation",
 1017                     cause:  err,
 1018                 })
 1019             }
 1020         }
 1021     } else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
 1022         if err := v.Validate(); err != nil {
 1023             return DurationFilterValidationError{
 1024                 field:  "Comparison",
 1025                 reason: "embedded message failed validation",
 1026                 cause:  err,
 1027             }
 1028         }
 1029     }
 1030 
 1031     if len(errors) > 0 {
 1032         return DurationFilterMultiError(errors)
 1033     }
 1034 
 1035     return nil
 1036 }
 1037 
 1038 // DurationFilterMultiError is an error wrapping multiple validation errors
 1039 // returned by DurationFilter.ValidateAll() if the designated constraints
 1040 // aren't met.
 1041 type DurationFilterMultiError []error
 1042 
 1043 // Error returns a concatenation of all the error messages it wraps.
 1044 func (m DurationFilterMultiError) Error() string {
 1045     var msgs []string
 1046     for _, err := range m {
 1047         msgs = append(msgs, err.Error())
 1048     }
 1049     return strings.Join(msgs, "; ")
 1050 }
 1051 
 1052 // AllErrors returns a list of validation violation errors.
 1053 func (m DurationFilterMultiError) AllErrors() []error { return m }
 1054 
 1055 // DurationFilterValidationError is the validation error returned by
 1056 // DurationFilter.Validate if the designated constraints aren't met.
 1057 type DurationFilterValidationError struct {
 1058     field  string
 1059     reason string
 1060     cause  error
 1061     key    bool
 1062 }
 1063 
 1064 // Field function returns field value.
 1065 func (e DurationFilterValidationError) Field() string { return e.field }
 1066 
 1067 // Reason function returns reason value.
 1068 func (e DurationFilterValidationError) Reason() string { return e.reason }
 1069 
 1070 // Cause function returns cause value.
 1071 func (e DurationFilterValidationError) Cause() error { return e.cause }
 1072 
 1073 // Key function returns key value.
 1074 func (e DurationFilterValidationError) Key() bool { return e.key }
 1075 
 1076 // ErrorName returns error name.
 1077 func (e DurationFilterValidationError) ErrorName() string { return "DurationFilterValidationError" }
 1078 
 1079 // Error satisfies the builtin error interface
 1080 func (e DurationFilterValidationError) Error() string {
 1081     cause := ""
 1082     if e.cause != nil {
 1083         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1084     }
 1085 
 1086     key := ""
 1087     if e.key {
 1088         key = "key for "
 1089     }
 1090 
 1091     return fmt.Sprintf(
 1092         "invalid %sDurationFilter.%s: %s%s",
 1093         key,
 1094         e.field,
 1095         e.reason,
 1096         cause)
 1097 }
 1098 
 1099 var _ error = DurationFilterValidationError{}
 1100 
 1101 var _ interface {
 1102     Field() string
 1103     Reason() string
 1104     Key() bool
 1105     Cause() error
 1106     ErrorName() string
 1107 } = DurationFilterValidationError{}
 1108 
 1109 // Validate checks the field values on NotHealthCheckFilter with the rules
 1110 // defined in the proto definition for this message. If any rules are
 1111 // violated, the first error encountered is returned, or nil if there are no violations.
 1112 func (m *NotHealthCheckFilter) Validate() error {
 1113     return m.validate(false)
 1114 }
 1115 
 1116 // ValidateAll checks the field values on NotHealthCheckFilter with the rules
 1117 // defined in the proto definition for this message. If any rules are
 1118 // violated, the result is a list of violation errors wrapped in
 1119 // NotHealthCheckFilterMultiError, or nil if none found.
 1120 func (m *NotHealthCheckFilter) ValidateAll() error {
 1121     return m.validate(true)
 1122 }
 1123 
 1124 func (m *NotHealthCheckFilter) validate(all bool) error {
 1125     if m == nil {
 1126         return nil
 1127     }
 1128 
 1129     var errors []error
 1130 
 1131     if len(errors) > 0 {
 1132         return NotHealthCheckFilterMultiError(errors)
 1133     }
 1134 
 1135     return nil
 1136 }
 1137 
 1138 // NotHealthCheckFilterMultiError is an error wrapping multiple validation
 1139 // errors returned by NotHealthCheckFilter.ValidateAll() if the designated
 1140 // constraints aren't met.
 1141 type NotHealthCheckFilterMultiError []error
 1142 
 1143 // Error returns a concatenation of all the error messages it wraps.
 1144 func (m NotHealthCheckFilterMultiError) Error() string {
 1145     var msgs []string
 1146     for _, err := range m {
 1147         msgs = append(msgs, err.Error())
 1148     }
 1149     return strings.Join(msgs, "; ")
 1150 }
 1151 
 1152 // AllErrors returns a list of validation violation errors.
 1153 func (m NotHealthCheckFilterMultiError) AllErrors() []error { return m }
 1154 
 1155 // NotHealthCheckFilterValidationError is the validation error returned by
 1156 // NotHealthCheckFilter.Validate if the designated constraints aren't met.
 1157 type NotHealthCheckFilterValidationError struct {
 1158     field  string
 1159     reason string
 1160     cause  error
 1161     key    bool
 1162 }
 1163 
 1164 // Field function returns field value.
 1165 func (e NotHealthCheckFilterValidationError) Field() string { return e.field }
 1166 
 1167 // Reason function returns reason value.
 1168 func (e NotHealthCheckFilterValidationError) Reason() string { return e.reason }
 1169 
 1170 // Cause function returns cause value.
 1171 func (e NotHealthCheckFilterValidationError) Cause() error { return e.cause }
 1172 
 1173 // Key function returns key value.
 1174 func (e NotHealthCheckFilterValidationError) Key() bool { return e.key }
 1175 
 1176 // ErrorName returns error name.
 1177 func (e NotHealthCheckFilterValidationError) ErrorName() string {
 1178     return "NotHealthCheckFilterValidationError"
 1179 }
 1180 
 1181 // Error satisfies the builtin error interface
 1182 func (e NotHealthCheckFilterValidationError) Error() string {
 1183     cause := ""
 1184     if e.cause != nil {
 1185         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1186     }
 1187 
 1188     key := ""
 1189     if e.key {
 1190         key = "key for "
 1191     }
 1192 
 1193     return fmt.Sprintf(
 1194         "invalid %sNotHealthCheckFilter.%s: %s%s",
 1195         key,
 1196         e.field,
 1197         e.reason,
 1198         cause)
 1199 }
 1200 
 1201 var _ error = NotHealthCheckFilterValidationError{}
 1202 
 1203 var _ interface {
 1204     Field() string
 1205     Reason() string
 1206     Key() bool
 1207     Cause() error
 1208     ErrorName() string
 1209 } = NotHealthCheckFilterValidationError{}
 1210 
 1211 // Validate checks the field values on TraceableFilter with the rules defined
 1212 // in the proto definition for this message. If any rules are violated, the
 1213 // first error encountered is returned, or nil if there are no violations.
 1214 func (m *TraceableFilter) Validate() error {
 1215     return m.validate(false)
 1216 }
 1217 
 1218 // ValidateAll checks the field values on TraceableFilter with the rules
 1219 // defined in the proto definition for this message. If any rules are
 1220 // violated, the result is a list of violation errors wrapped in
 1221 // TraceableFilterMultiError, or nil if none found.
 1222 func (m *TraceableFilter) ValidateAll() error {
 1223     return m.validate(true)
 1224 }
 1225 
 1226 func (m *TraceableFilter) validate(all bool) error {
 1227     if m == nil {
 1228         return nil
 1229     }
 1230 
 1231     var errors []error
 1232 
 1233     if len(errors) > 0 {
 1234         return TraceableFilterMultiError(errors)
 1235     }
 1236 
 1237     return nil
 1238 }
 1239 
 1240 // TraceableFilterMultiError is an error wrapping multiple validation errors
 1241 // returned by TraceableFilter.ValidateAll() if the designated constraints
 1242 // aren't met.
 1243 type TraceableFilterMultiError []error
 1244 
 1245 // Error returns a concatenation of all the error messages it wraps.
 1246 func (m TraceableFilterMultiError) Error() string {
 1247     var msgs []string
 1248     for _, err := range m {
 1249         msgs = append(msgs, err.Error())
 1250     }
 1251     return strings.Join(msgs, "; ")
 1252 }
 1253 
 1254 // AllErrors returns a list of validation violation errors.
 1255 func (m TraceableFilterMultiError) AllErrors() []error { return m }
 1256 
 1257 // TraceableFilterValidationError is the validation error returned by
 1258 // TraceableFilter.Validate if the designated constraints aren't met.
 1259 type TraceableFilterValidationError struct {
 1260     field  string
 1261     reason string
 1262     cause  error
 1263     key    bool
 1264 }
 1265 
 1266 // Field function returns field value.
 1267 func (e TraceableFilterValidationError) Field() string { return e.field }
 1268 
 1269 // Reason function returns reason value.
 1270 func (e TraceableFilterValidationError) Reason() string { return e.reason }
 1271 
 1272 // Cause function returns cause value.
 1273 func (e TraceableFilterValidationError) Cause() error { return e.cause }
 1274 
 1275 // Key function returns key value.
 1276 func (e TraceableFilterValidationError) Key() bool { return e.key }
 1277 
 1278 // ErrorName returns error name.
 1279 func (e TraceableFilterValidationError) ErrorName() string { return "TraceableFilterValidationError" }
 1280 
 1281 // Error satisfies the builtin error interface
 1282 func (e TraceableFilterValidationError) Error() string {
 1283     cause := ""
 1284     if e.cause != nil {
 1285         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1286     }
 1287 
 1288     key := ""
 1289     if e.key {
 1290         key = "key for "
 1291     }
 1292 
 1293     return fmt.Sprintf(
 1294         "invalid %sTraceableFilter.%s: %s%s",
 1295         key,
 1296         e.field,
 1297         e.reason,
 1298         cause)
 1299 }
 1300 
 1301 var _ error = TraceableFilterValidationError{}
 1302 
 1303 var _ interface {
 1304     Field() string
 1305     Reason() string
 1306     Key() bool
 1307     Cause() error
 1308     ErrorName() string
 1309 } = TraceableFilterValidationError{}
 1310 
 1311 // Validate checks the field values on RuntimeFilter with the rules defined in
 1312 // the proto definition for this message. If any rules are violated, the first
 1313 // error encountered is returned, or nil if there are no violations.
 1314 func (m *RuntimeFilter) Validate() error {
 1315     return m.validate(false)
 1316 }
 1317 
 1318 // ValidateAll checks the field values on RuntimeFilter with the rules defined
 1319 // in the proto definition for this message. If any rules are violated, the
 1320 // result is a list of violation errors wrapped in RuntimeFilterMultiError, or
 1321 // nil if none found.
 1322 func (m *RuntimeFilter) ValidateAll() error {
 1323     return m.validate(true)
 1324 }
 1325 
 1326 func (m *RuntimeFilter) validate(all bool) error {
 1327     if m == nil {
 1328         return nil
 1329     }
 1330 
 1331     var errors []error
 1332 
 1333     if len(m.GetRuntimeKey()) < 1 {
 1334         err := RuntimeFilterValidationError{
 1335             field:  "RuntimeKey",
 1336             reason: "value length must be at least 1 bytes",
 1337         }
 1338         if !all {
 1339             return err
 1340         }
 1341         errors = append(errors, err)
 1342     }
 1343 
 1344     if all {
 1345         switch v := interface{}(m.GetPercentSampled()).(type) {
 1346         case interface{ ValidateAll() error }:
 1347             if err := v.ValidateAll(); err != nil {
 1348                 errors = append(errors, RuntimeFilterValidationError{
 1349                     field:  "PercentSampled",
 1350                     reason: "embedded message failed validation",
 1351                     cause:  err,
 1352                 })
 1353             }
 1354         case interface{ Validate() error }:
 1355             if err := v.Validate(); err != nil {
 1356                 errors = append(errors, RuntimeFilterValidationError{
 1357                     field:  "PercentSampled",
 1358                     reason: "embedded message failed validation",
 1359                     cause:  err,
 1360                 })
 1361             }
 1362         }
 1363     } else if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok {
 1364         if err := v.Validate(); err != nil {
 1365             return RuntimeFilterValidationError{
 1366                 field:  "PercentSampled",
 1367                 reason: "embedded message failed validation",
 1368                 cause:  err,
 1369             }
 1370         }
 1371     }
 1372 
 1373     // no validation rules for UseIndependentRandomness
 1374 
 1375     if len(errors) > 0 {
 1376         return RuntimeFilterMultiError(errors)
 1377     }
 1378 
 1379     return nil
 1380 }
 1381 
 1382 // RuntimeFilterMultiError is an error wrapping multiple validation errors
 1383 // returned by RuntimeFilter.ValidateAll() if the designated constraints
 1384 // aren't met.
 1385 type RuntimeFilterMultiError []error
 1386 
 1387 // Error returns a concatenation of all the error messages it wraps.
 1388 func (m RuntimeFilterMultiError) Error() string {
 1389     var msgs []string
 1390     for _, err := range m {
 1391         msgs = append(msgs, err.Error())
 1392     }
 1393     return strings.Join(msgs, "; ")
 1394 }
 1395 
 1396 // AllErrors returns a list of validation violation errors.
 1397 func (m RuntimeFilterMultiError) AllErrors() []error { return m }
 1398 
 1399 // RuntimeFilterValidationError is the validation error returned by
 1400 // RuntimeFilter.Validate if the designated constraints aren't met.
 1401 type RuntimeFilterValidationError struct {
 1402     field  string
 1403     reason string
 1404     cause  error
 1405     key    bool
 1406 }
 1407 
 1408 // Field function returns field value.
 1409 func (e RuntimeFilterValidationError) Field() string { return e.field }
 1410 
 1411 // Reason function returns reason value.
 1412 func (e RuntimeFilterValidationError) Reason() string { return e.reason }
 1413 
 1414 // Cause function returns cause value.
 1415 func (e RuntimeFilterValidationError) Cause() error { return e.cause }
 1416 
 1417 // Key function returns key value.
 1418 func (e RuntimeFilterValidationError) Key() bool { return e.key }
 1419 
 1420 // ErrorName returns error name.
 1421 func (e RuntimeFilterValidationError) ErrorName() string { return "RuntimeFilterValidationError" }
 1422 
 1423 // Error satisfies the builtin error interface
 1424 func (e RuntimeFilterValidationError) Error() string {
 1425     cause := ""
 1426     if e.cause != nil {
 1427         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1428     }
 1429 
 1430     key := ""
 1431     if e.key {
 1432         key = "key for "
 1433     }
 1434 
 1435     return fmt.Sprintf(
 1436         "invalid %sRuntimeFilter.%s: %s%s",
 1437         key,
 1438         e.field,
 1439         e.reason,
 1440         cause)
 1441 }
 1442 
 1443 var _ error = RuntimeFilterValidationError{}
 1444 
 1445 var _ interface {
 1446     Field() string
 1447     Reason() string
 1448     Key() bool
 1449     Cause() error
 1450     ErrorName() string
 1451 } = RuntimeFilterValidationError{}
 1452 
 1453 // Validate checks the field values on AndFilter with the rules defined in the
 1454 // proto definition for this message. If any rules are violated, the first
 1455 // error encountered is returned, or nil if there are no violations.
 1456 func (m *AndFilter) Validate() error {
 1457     return m.validate(false)
 1458 }
 1459 
 1460 // ValidateAll checks the field values on AndFilter with the rules defined in
 1461 // the proto definition for this message. If any rules are violated, the
 1462 // result is a list of violation errors wrapped in AndFilterMultiError, or nil
 1463 // if none found.
 1464 func (m *AndFilter) ValidateAll() error {
 1465     return m.validate(true)
 1466 }
 1467 
 1468 func (m *AndFilter) validate(all bool) error {
 1469     if m == nil {
 1470         return nil
 1471     }
 1472 
 1473     var errors []error
 1474 
 1475     if len(m.GetFilters()) < 2 {
 1476         err := AndFilterValidationError{
 1477             field:  "Filters",
 1478             reason: "value must contain at least 2 item(s)",
 1479         }
 1480         if !all {
 1481             return err
 1482         }
 1483         errors = append(errors, err)
 1484     }
 1485 
 1486     for idx, item := range m.GetFilters() {
 1487         _, _ = idx, item
 1488 
 1489         if all {
 1490             switch v := interface{}(item).(type) {
 1491             case interface{ ValidateAll() error }:
 1492                 if err := v.ValidateAll(); err != nil {
 1493                     errors = append(errors, AndFilterValidationError{
 1494                         field:  fmt.Sprintf("Filters[%v]", idx),
 1495                         reason: "embedded message failed validation",
 1496                         cause:  err,
 1497                     })
 1498                 }
 1499             case interface{ Validate() error }:
 1500                 if err := v.Validate(); err != nil {
 1501                     errors = append(errors, AndFilterValidationError{
 1502                         field:  fmt.Sprintf("Filters[%v]", idx),
 1503                         reason: "embedded message failed validation",
 1504                         cause:  err,
 1505                     })
 1506                 }
 1507             }
 1508         } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
 1509             if err := v.Validate(); err != nil {
 1510                 return AndFilterValidationError{
 1511                     field:  fmt.Sprintf("Filters[%v]", idx),
 1512                     reason: "embedded message failed validation",
 1513                     cause:  err,
 1514                 }
 1515             }
 1516         }
 1517 
 1518     }
 1519 
 1520     if len(errors) > 0 {
 1521         return AndFilterMultiError(errors)
 1522     }
 1523 
 1524     return nil
 1525 }
 1526 
 1527 // AndFilterMultiError is an error wrapping multiple validation errors returned
 1528 // by AndFilter.ValidateAll() if the designated constraints aren't met.
 1529 type AndFilterMultiError []error
 1530 
 1531 // Error returns a concatenation of all the error messages it wraps.
 1532 func (m AndFilterMultiError) Error() string {
 1533     var msgs []string
 1534     for _, err := range m {
 1535         msgs = append(msgs, err.Error())
 1536     }
 1537     return strings.Join(msgs, "; ")
 1538 }
 1539 
 1540 // AllErrors returns a list of validation violation errors.
 1541 func (m AndFilterMultiError) AllErrors() []error { return m }
 1542 
 1543 // AndFilterValidationError is the validation error returned by
 1544 // AndFilter.Validate if the designated constraints aren't met.
 1545 type AndFilterValidationError struct {
 1546     field  string
 1547     reason string
 1548     cause  error
 1549     key    bool
 1550 }
 1551 
 1552 // Field function returns field value.
 1553 func (e AndFilterValidationError) Field() string { return e.field }
 1554 
 1555 // Reason function returns reason value.
 1556 func (e AndFilterValidationError) Reason() string { return e.reason }
 1557 
 1558 // Cause function returns cause value.
 1559 func (e AndFilterValidationError) Cause() error { return e.cause }
 1560 
 1561 // Key function returns key value.
 1562 func (e AndFilterValidationError) Key() bool { return e.key }
 1563 
 1564 // ErrorName returns error name.
 1565 func (e AndFilterValidationError) ErrorName() string { return "AndFilterValidationError" }
 1566 
 1567 // Error satisfies the builtin error interface
 1568 func (e AndFilterValidationError) Error() string {
 1569     cause := ""
 1570     if e.cause != nil {
 1571         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1572     }
 1573 
 1574     key := ""
 1575     if e.key {
 1576         key = "key for "
 1577     }
 1578 
 1579     return fmt.Sprintf(
 1580         "invalid %sAndFilter.%s: %s%s",
 1581         key,
 1582         e.field,
 1583         e.reason,
 1584         cause)
 1585 }
 1586 
 1587 var _ error = AndFilterValidationError{}
 1588 
 1589 var _ interface {
 1590     Field() string
 1591     Reason() string
 1592     Key() bool
 1593     Cause() error
 1594     ErrorName() string
 1595 } = AndFilterValidationError{}
 1596 
 1597 // Validate checks the field values on OrFilter with the rules defined in the
 1598 // proto definition for this message. If any rules are violated, the first
 1599 // error encountered is returned, or nil if there are no violations.
 1600 func (m *OrFilter) Validate() error {
 1601     return m.validate(false)
 1602 }
 1603 
 1604 // ValidateAll checks the field values on OrFilter with the rules defined in
 1605 // the proto definition for this message. If any rules are violated, the
 1606 // result is a list of violation errors wrapped in OrFilterMultiError, or nil
 1607 // if none found.
 1608 func (m *OrFilter) ValidateAll() error {
 1609     return m.validate(true)
 1610 }
 1611 
 1612 func (m *OrFilter) validate(all bool) error {
 1613     if m == nil {
 1614         return nil
 1615     }
 1616 
 1617     var errors []error
 1618 
 1619     if len(m.GetFilters()) < 2 {
 1620         err := OrFilterValidationError{
 1621             field:  "Filters",
 1622             reason: "value must contain at least 2 item(s)",
 1623         }
 1624         if !all {
 1625             return err
 1626         }
 1627         errors = append(errors, err)
 1628     }
 1629 
 1630     for idx, item := range m.GetFilters() {
 1631         _, _ = idx, item
 1632 
 1633         if all {
 1634             switch v := interface{}(item).(type) {
 1635             case interface{ ValidateAll() error }:
 1636                 if err := v.ValidateAll(); err != nil {
 1637                     errors = append(errors, OrFilterValidationError{
 1638                         field:  fmt.Sprintf("Filters[%v]", idx),
 1639                         reason: "embedded message failed validation",
 1640                         cause:  err,
 1641                     })
 1642                 }
 1643             case interface{ Validate() error }:
 1644                 if err := v.Validate(); err != nil {
 1645                     errors = append(errors, OrFilterValidationError{
 1646                         field:  fmt.Sprintf("Filters[%v]", idx),
 1647                         reason: "embedded message failed validation",
 1648                         cause:  err,
 1649                     })
 1650                 }
 1651             }
 1652         } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
 1653             if err := v.Validate(); err != nil {
 1654                 return OrFilterValidationError{
 1655                     field:  fmt.Sprintf("Filters[%v]", idx),
 1656                     reason: "embedded message failed validation",
 1657                     cause:  err,
 1658                 }
 1659             }
 1660         }
 1661 
 1662     }
 1663 
 1664     if len(errors) > 0 {
 1665         return OrFilterMultiError(errors)
 1666     }
 1667 
 1668     return nil
 1669 }
 1670 
 1671 // OrFilterMultiError is an error wrapping multiple validation errors returned
 1672 // by OrFilter.ValidateAll() if the designated constraints aren't met.
 1673 type OrFilterMultiError []error
 1674 
 1675 // Error returns a concatenation of all the error messages it wraps.
 1676 func (m OrFilterMultiError) Error() string {
 1677     var msgs []string
 1678     for _, err := range m {
 1679         msgs = append(msgs, err.Error())
 1680     }
 1681     return strings.Join(msgs, "; ")
 1682 }
 1683 
 1684 // AllErrors returns a list of validation violation errors.
 1685 func (m OrFilterMultiError) AllErrors() []error { return m }
 1686 
 1687 // OrFilterValidationError is the validation error returned by
 1688 // OrFilter.Validate if the designated constraints aren't met.
 1689 type OrFilterValidationError struct {
 1690     field  string
 1691     reason string
 1692     cause  error
 1693     key    bool
 1694 }
 1695 
 1696 // Field function returns field value.
 1697 func (e OrFilterValidationError) Field() string { return e.field }
 1698 
 1699 // Reason function returns reason value.
 1700 func (e OrFilterValidationError) Reason() string { return e.reason }
 1701 
 1702 // Cause function returns cause value.
 1703 func (e OrFilterValidationError) Cause() error { return e.cause }
 1704 
 1705 // Key function returns key value.
 1706 func (e OrFilterValidationError) Key() bool { return e.key }
 1707 
 1708 // ErrorName returns error name.
 1709 func (e OrFilterValidationError) ErrorName() string { return "OrFilterValidationError" }
 1710 
 1711 // Error satisfies the builtin error interface
 1712 func (e OrFilterValidationError) Error() string {
 1713     cause := ""
 1714     if e.cause != nil {
 1715         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1716     }
 1717 
 1718     key := ""
 1719     if e.key {
 1720         key = "key for "
 1721     }
 1722 
 1723     return fmt.Sprintf(
 1724         "invalid %sOrFilter.%s: %s%s",
 1725         key,
 1726         e.field,
 1727         e.reason,
 1728         cause)
 1729 }
 1730 
 1731 var _ error = OrFilterValidationError{}
 1732 
 1733 var _ interface {
 1734     Field() string
 1735     Reason() string
 1736     Key() bool
 1737     Cause() error
 1738     ErrorName() string
 1739 } = OrFilterValidationError{}
 1740 
 1741 // Validate checks the field values on HeaderFilter with the rules defined in
 1742 // the proto definition for this message. If any rules are violated, the first
 1743 // error encountered is returned, or nil if there are no violations.
 1744 func (m *HeaderFilter) Validate() error {
 1745     return m.validate(false)
 1746 }
 1747 
 1748 // ValidateAll checks the field values on HeaderFilter with the rules defined
 1749 // in the proto definition for this message. If any rules are violated, the
 1750 // result is a list of violation errors wrapped in HeaderFilterMultiError, or
 1751 // nil if none found.
 1752 func (m *HeaderFilter) ValidateAll() error {
 1753     return m.validate(true)
 1754 }
 1755 
 1756 func (m *HeaderFilter) validate(all bool) error {
 1757     if m == nil {
 1758         return nil
 1759     }
 1760 
 1761     var errors []error
 1762 
 1763     if m.GetHeader() == nil {
 1764         err := HeaderFilterValidationError{
 1765             field:  "Header",
 1766             reason: "value is required",
 1767         }
 1768         if !all {
 1769             return err
 1770         }
 1771         errors = append(errors, err)
 1772     }
 1773 
 1774     if all {
 1775         switch v := interface{}(m.GetHeader()).(type) {
 1776         case interface{ ValidateAll() error }:
 1777             if err := v.ValidateAll(); err != nil {
 1778                 errors = append(errors, HeaderFilterValidationError{
 1779                     field:  "Header",
 1780                     reason: "embedded message failed validation",
 1781                     cause:  err,
 1782                 })
 1783             }
 1784         case interface{ Validate() error }:
 1785             if err := v.Validate(); err != nil {
 1786                 errors = append(errors, HeaderFilterValidationError{
 1787                     field:  "Header",
 1788                     reason: "embedded message failed validation",
 1789                     cause:  err,
 1790                 })
 1791             }
 1792         }
 1793     } else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
 1794         if err := v.Validate(); err != nil {
 1795             return HeaderFilterValidationError{
 1796                 field:  "Header",
 1797                 reason: "embedded message failed validation",
 1798                 cause:  err,
 1799             }
 1800         }
 1801     }
 1802 
 1803     if len(errors) > 0 {
 1804         return HeaderFilterMultiError(errors)
 1805     }
 1806 
 1807     return nil
 1808 }
 1809 
 1810 // HeaderFilterMultiError is an error wrapping multiple validation errors
 1811 // returned by HeaderFilter.ValidateAll() if the designated constraints aren't met.
 1812 type HeaderFilterMultiError []error
 1813 
 1814 // Error returns a concatenation of all the error messages it wraps.
 1815 func (m HeaderFilterMultiError) Error() string {
 1816     var msgs []string
 1817     for _, err := range m {
 1818         msgs = append(msgs, err.Error())
 1819     }
 1820     return strings.Join(msgs, "; ")
 1821 }
 1822 
 1823 // AllErrors returns a list of validation violation errors.
 1824 func (m HeaderFilterMultiError) AllErrors() []error { return m }
 1825 
 1826 // HeaderFilterValidationError is the validation error returned by
 1827 // HeaderFilter.Validate if the designated constraints aren't met.
 1828 type HeaderFilterValidationError struct {
 1829     field  string
 1830     reason string
 1831     cause  error
 1832     key    bool
 1833 }
 1834 
 1835 // Field function returns field value.
 1836 func (e HeaderFilterValidationError) Field() string { return e.field }
 1837 
 1838 // Reason function returns reason value.
 1839 func (e HeaderFilterValidationError) Reason() string { return e.reason }
 1840 
 1841 // Cause function returns cause value.
 1842 func (e HeaderFilterValidationError) Cause() error { return e.cause }
 1843 
 1844 // Key function returns key value.
 1845 func (e HeaderFilterValidationError) Key() bool { return e.key }
 1846 
 1847 // ErrorName returns error name.
 1848 func (e HeaderFilterValidationError) ErrorName() string { return "HeaderFilterValidationError" }
 1849 
 1850 // Error satisfies the builtin error interface
 1851 func (e HeaderFilterValidationError) Error() string {
 1852     cause := ""
 1853     if e.cause != nil {
 1854         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1855     }
 1856 
 1857     key := ""
 1858     if e.key {
 1859         key = "key for "
 1860     }
 1861 
 1862     return fmt.Sprintf(
 1863         "invalid %sHeaderFilter.%s: %s%s",
 1864         key,
 1865         e.field,
 1866         e.reason,
 1867         cause)
 1868 }
 1869 
 1870 var _ error = HeaderFilterValidationError{}
 1871 
 1872 var _ interface {
 1873     Field() string
 1874     Reason() string
 1875     Key() bool
 1876     Cause() error
 1877     ErrorName() string
 1878 } = HeaderFilterValidationError{}
 1879 
 1880 // Validate checks the field values on ResponseFlagFilter with the rules
 1881 // defined in the proto definition for this message. If any rules are
 1882 // violated, the first error encountered is returned, or nil if there are no violations.
 1883 func (m *ResponseFlagFilter) Validate() error {
 1884     return m.validate(false)
 1885 }
 1886 
 1887 // ValidateAll checks the field values on ResponseFlagFilter with the rules
 1888 // defined in the proto definition for this message. If any rules are
 1889 // violated, the result is a list of violation errors wrapped in
 1890 // ResponseFlagFilterMultiError, or nil if none found.
 1891 func (m *ResponseFlagFilter) ValidateAll() error {
 1892     return m.validate(true)
 1893 }
 1894 
 1895 func (m *ResponseFlagFilter) validate(all bool) error {
 1896     if m == nil {
 1897         return nil
 1898     }
 1899 
 1900     var errors []error
 1901 
 1902     for idx, item := range m.GetFlags() {
 1903         _, _ = idx, item
 1904 
 1905         if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
 1906             err := ResponseFlagFilterValidationError{
 1907                 field:  fmt.Sprintf("Flags[%v]", idx),
 1908                 reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI IH DPE]",
 1909             }
 1910             if !all {
 1911                 return err
 1912             }
 1913             errors = append(errors, err)
 1914         }
 1915 
 1916     }
 1917 
 1918     if len(errors) > 0 {
 1919         return ResponseFlagFilterMultiError(errors)
 1920     }
 1921 
 1922     return nil
 1923 }
 1924 
 1925 // ResponseFlagFilterMultiError is an error wrapping multiple validation errors
 1926 // returned by ResponseFlagFilter.ValidateAll() if the designated constraints
 1927 // aren't met.
 1928 type ResponseFlagFilterMultiError []error
 1929 
 1930 // Error returns a concatenation of all the error messages it wraps.
 1931 func (m ResponseFlagFilterMultiError) Error() string {
 1932     var msgs []string
 1933     for _, err := range m {
 1934         msgs = append(msgs, err.Error())
 1935     }
 1936     return strings.Join(msgs, "; ")
 1937 }
 1938 
 1939 // AllErrors returns a list of validation violation errors.
 1940 func (m ResponseFlagFilterMultiError) AllErrors() []error { return m }
 1941 
 1942 // ResponseFlagFilterValidationError is the validation error returned by
 1943 // ResponseFlagFilter.Validate if the designated constraints aren't met.
 1944 type ResponseFlagFilterValidationError struct {
 1945     field  string
 1946     reason string
 1947     cause  error
 1948     key    bool
 1949 }
 1950 
 1951 // Field function returns field value.
 1952 func (e ResponseFlagFilterValidationError) Field() string { return e.field }
 1953 
 1954 // Reason function returns reason value.
 1955 func (e ResponseFlagFilterValidationError) Reason() string { return e.reason }
 1956 
 1957 // Cause function returns cause value.
 1958 func (e ResponseFlagFilterValidationError) Cause() error { return e.cause }
 1959 
 1960 // Key function returns key value.
 1961 func (e ResponseFlagFilterValidationError) Key() bool { return e.key }
 1962 
 1963 // ErrorName returns error name.
 1964 func (e ResponseFlagFilterValidationError) ErrorName() string {
 1965     return "ResponseFlagFilterValidationError"
 1966 }
 1967 
 1968 // Error satisfies the builtin error interface
 1969 func (e ResponseFlagFilterValidationError) Error() string {
 1970     cause := ""
 1971     if e.cause != nil {
 1972         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 1973     }
 1974 
 1975     key := ""
 1976     if e.key {
 1977         key = "key for "
 1978     }
 1979 
 1980     return fmt.Sprintf(
 1981         "invalid %sResponseFlagFilter.%s: %s%s",
 1982         key,
 1983         e.field,
 1984         e.reason,
 1985         cause)
 1986 }
 1987 
 1988 var _ error = ResponseFlagFilterValidationError{}
 1989 
 1990 var _ interface {
 1991     Field() string
 1992     Reason() string
 1993     Key() bool
 1994     Cause() error
 1995     ErrorName() string
 1996 } = ResponseFlagFilterValidationError{}
 1997 
 1998 var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{
 1999     "LH":   {},
 2000     "UH":   {},
 2001     "UT":   {},
 2002     "LR":   {},
 2003     "UR":   {},
 2004     "UF":   {},
 2005     "UC":   {},
 2006     "UO":   {},
 2007     "NR":   {},
 2008     "DI":   {},
 2009     "FI":   {},
 2010     "RL":   {},
 2011     "UAEX": {},
 2012     "RLSE": {},
 2013     "DC":   {},
 2014     "URX":  {},
 2015     "SI":   {},
 2016     "IH":   {},
 2017     "DPE":  {},
 2018 }
 2019 
 2020 // Validate checks the field values on GrpcStatusFilter with the rules defined
 2021 // in the proto definition for this message. If any rules are violated, the
 2022 // first error encountered is returned, or nil if there are no violations.
 2023 func (m *GrpcStatusFilter) Validate() error {
 2024     return m.validate(false)
 2025 }
 2026 
 2027 // ValidateAll checks the field values on GrpcStatusFilter with the rules
 2028 // defined in the proto definition for this message. If any rules are
 2029 // violated, the result is a list of violation errors wrapped in
 2030 // GrpcStatusFilterMultiError, or nil if none found.
 2031 func (m *GrpcStatusFilter) ValidateAll() error {
 2032     return m.validate(true)
 2033 }
 2034 
 2035 func (m *GrpcStatusFilter) validate(all bool) error {
 2036     if m == nil {
 2037         return nil
 2038     }
 2039 
 2040     var errors []error
 2041 
 2042     for idx, item := range m.GetStatuses() {
 2043         _, _ = idx, item
 2044 
 2045         if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
 2046             err := GrpcStatusFilterValidationError{
 2047                 field:  fmt.Sprintf("Statuses[%v]", idx),
 2048                 reason: "value must be one of the defined enum values",
 2049             }
 2050             if !all {
 2051                 return err
 2052             }
 2053             errors = append(errors, err)
 2054         }
 2055 
 2056     }
 2057 
 2058     // no validation rules for Exclude
 2059 
 2060     if len(errors) > 0 {
 2061         return GrpcStatusFilterMultiError(errors)
 2062     }
 2063 
 2064     return nil
 2065 }
 2066 
 2067 // GrpcStatusFilterMultiError is an error wrapping multiple validation errors
 2068 // returned by GrpcStatusFilter.ValidateAll() if the designated constraints
 2069 // aren't met.
 2070 type GrpcStatusFilterMultiError []error
 2071 
 2072 // Error returns a concatenation of all the error messages it wraps.
 2073 func (m GrpcStatusFilterMultiError) Error() string {
 2074     var msgs []string
 2075     for _, err := range m {
 2076         msgs = append(msgs, err.Error())
 2077     }
 2078     return strings.Join(msgs, "; ")
 2079 }
 2080 
 2081 // AllErrors returns a list of validation violation errors.
 2082 func (m GrpcStatusFilterMultiError) AllErrors() []error { return m }
 2083 
 2084 // GrpcStatusFilterValidationError is the validation error returned by
 2085 // GrpcStatusFilter.Validate if the designated constraints aren't met.
 2086 type GrpcStatusFilterValidationError struct {
 2087     field  string
 2088     reason string
 2089     cause  error
 2090     key    bool
 2091 }
 2092 
 2093 // Field function returns field value.
 2094 func (e GrpcStatusFilterValidationError) Field() string { return e.field }
 2095 
 2096 // Reason function returns reason value.
 2097 func (e GrpcStatusFilterValidationError) Reason() string { return e.reason }
 2098 
 2099 // Cause function returns cause value.
 2100 func (e GrpcStatusFilterValidationError) Cause() error { return e.cause }
 2101 
 2102 // Key function returns key value.
 2103 func (e GrpcStatusFilterValidationError) Key() bool { return e.key }
 2104 
 2105 // ErrorName returns error name.
 2106 func (e GrpcStatusFilterValidationError) ErrorName() string { return "GrpcStatusFilterValidationError" }
 2107 
 2108 // Error satisfies the builtin error interface
 2109 func (e GrpcStatusFilterValidationError) Error() string {
 2110     cause := ""
 2111     if e.cause != nil {
 2112         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 2113     }
 2114 
 2115     key := ""
 2116     if e.key {
 2117         key = "key for "
 2118     }
 2119 
 2120     return fmt.Sprintf(
 2121         "invalid %sGrpcStatusFilter.%s: %s%s",
 2122         key,
 2123         e.field,
 2124         e.reason,
 2125         cause)
 2126 }
 2127 
 2128 var _ error = GrpcStatusFilterValidationError{}
 2129 
 2130 var _ interface {
 2131     Field() string
 2132     Reason() string
 2133     Key() bool
 2134     Cause() error
 2135     ErrorName() string
 2136 } = GrpcStatusFilterValidationError{}
 2137 
 2138 // Validate checks the field values on ExtensionFilter with the rules defined
 2139 // in the proto definition for this message. If any rules are violated, the
 2140 // first error encountered is returned, or nil if there are no violations.
 2141 func (m *ExtensionFilter) Validate() error {
 2142     return m.validate(false)
 2143 }
 2144 
 2145 // ValidateAll checks the field values on ExtensionFilter with the rules
 2146 // defined in the proto definition for this message. If any rules are
 2147 // violated, the result is a list of violation errors wrapped in
 2148 // ExtensionFilterMultiError, or nil if none found.
 2149 func (m *ExtensionFilter) ValidateAll() error {
 2150     return m.validate(true)
 2151 }
 2152 
 2153 func (m *ExtensionFilter) validate(all bool) error {
 2154     if m == nil {
 2155         return nil
 2156     }
 2157 
 2158     var errors []error
 2159 
 2160     // no validation rules for Name
 2161 
 2162     switch m.ConfigType.(type) {
 2163 
 2164     case *ExtensionFilter_Config:
 2165 
 2166         if all {
 2167             switch v := interface{}(m.GetConfig()).(type) {
 2168             case interface{ ValidateAll() error }:
 2169                 if err := v.ValidateAll(); err != nil {
 2170                     errors = append(errors, ExtensionFilterValidationError{
 2171                         field:  "Config",
 2172                         reason: "embedded message failed validation",
 2173                         cause:  err,
 2174                     })
 2175                 }
 2176             case interface{ Validate() error }:
 2177                 if err := v.Validate(); err != nil {
 2178                     errors = append(errors, ExtensionFilterValidationError{
 2179                         field:  "Config",
 2180                         reason: "embedded message failed validation",
 2181                         cause:  err,
 2182                     })
 2183                 }
 2184             }
 2185         } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
 2186             if err := v.Validate(); err != nil {
 2187                 return ExtensionFilterValidationError{
 2188                     field:  "Config",
 2189                     reason: "embedded message failed validation",
 2190                     cause:  err,
 2191                 }
 2192             }
 2193         }
 2194 
 2195     case *ExtensionFilter_TypedConfig:
 2196 
 2197         if all {
 2198             switch v := interface{}(m.GetTypedConfig()).(type) {
 2199             case interface{ ValidateAll() error }:
 2200                 if err := v.ValidateAll(); err != nil {
 2201                     errors = append(errors, ExtensionFilterValidationError{
 2202                         field:  "TypedConfig",
 2203                         reason: "embedded message failed validation",
 2204                         cause:  err,
 2205                     })
 2206                 }
 2207             case interface{ Validate() error }:
 2208                 if err := v.Validate(); err != nil {
 2209                     errors = append(errors, ExtensionFilterValidationError{
 2210                         field:  "TypedConfig",
 2211                         reason: "embedded message failed validation",
 2212                         cause:  err,
 2213                     })
 2214                 }
 2215             }
 2216         } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
 2217             if err := v.Validate(); err != nil {
 2218                 return ExtensionFilterValidationError{
 2219                     field:  "TypedConfig",
 2220                     reason: "embedded message failed validation",
 2221                     cause:  err,
 2222                 }
 2223             }
 2224         }
 2225 
 2226     }
 2227 
 2228     if len(errors) > 0 {
 2229         return ExtensionFilterMultiError(errors)
 2230     }
 2231 
 2232     return nil
 2233 }
 2234 
 2235 // ExtensionFilterMultiError is an error wrapping multiple validation errors
 2236 // returned by ExtensionFilter.ValidateAll() if the designated constraints
 2237 // aren't met.
 2238 type ExtensionFilterMultiError []error
 2239 
 2240 // Error returns a concatenation of all the error messages it wraps.
 2241 func (m ExtensionFilterMultiError) Error() string {
 2242     var msgs []string
 2243     for _, err := range m {
 2244         msgs = append(msgs, err.Error())
 2245     }
 2246     return strings.Join(msgs, "; ")
 2247 }
 2248 
 2249 // AllErrors returns a list of validation violation errors.
 2250 func (m ExtensionFilterMultiError) AllErrors() []error { return m }
 2251 
 2252 // ExtensionFilterValidationError is the validation error returned by
 2253 // ExtensionFilter.Validate if the designated constraints aren't met.
 2254 type ExtensionFilterValidationError struct {
 2255     field  string
 2256     reason string
 2257     cause  error
 2258     key    bool
 2259 }
 2260 
 2261 // Field function returns field value.
 2262 func (e ExtensionFilterValidationError) Field() string { return e.field }
 2263 
 2264 // Reason function returns reason value.
 2265 func (e ExtensionFilterValidationError) Reason() string { return e.reason }
 2266 
 2267 // Cause function returns cause value.
 2268 func (e ExtensionFilterValidationError) Cause() error { return e.cause }
 2269 
 2270 // Key function returns key value.
 2271 func (e ExtensionFilterValidationError) Key() bool { return e.key }
 2272 
 2273 // ErrorName returns error name.
 2274 func (e ExtensionFilterValidationError) ErrorName() string { return "ExtensionFilterValidationError" }
 2275 
 2276 // Error satisfies the builtin error interface
 2277 func (e ExtensionFilterValidationError) Error() string {
 2278     cause := ""
 2279     if e.cause != nil {
 2280         cause = fmt.Sprintf(" | caused by: %v", e.cause)
 2281     }
 2282 
 2283     key := ""
 2284     if e.key {
 2285         key = "key for "
 2286     }
 2287 
 2288     return fmt.Sprintf(
 2289         "invalid %sExtensionFilter.%s: %s%s",
 2290         key,
 2291         e.field,
 2292         e.reason,
 2293         cause)
 2294 }
 2295 
 2296 var _ error = ExtensionFilterValidationError{}
 2297 
 2298 var _ interface {
 2299     Field() string
 2300     Reason() string
 2301     Key() bool
 2302     Cause() error
 2303     ErrorName() string
 2304 } = ExtensionFilterValidationError{}