github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/admin/v3/listeners.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v3/listeners.proto
     3  
     4  package envoy_admin_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 Listeners with the rules defined in the
    37  // proto definition for this message. If any rules are violated, an error is returned.
    38  func (m *Listeners) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	for idx, item := range m.GetListenerStatuses() {
    44  		_, _ = idx, item
    45  
    46  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    47  			if err := v.Validate(); err != nil {
    48  				return ListenersValidationError{
    49  					field:  fmt.Sprintf("ListenerStatuses[%v]", idx),
    50  					reason: "embedded message failed validation",
    51  					cause:  err,
    52  				}
    53  			}
    54  		}
    55  
    56  	}
    57  
    58  	return nil
    59  }
    60  
    61  // ListenersValidationError is the validation error returned by
    62  // Listeners.Validate if the designated constraints aren't met.
    63  type ListenersValidationError struct {
    64  	field  string
    65  	reason string
    66  	cause  error
    67  	key    bool
    68  }
    69  
    70  // Field function returns field value.
    71  func (e ListenersValidationError) Field() string { return e.field }
    72  
    73  // Reason function returns reason value.
    74  func (e ListenersValidationError) Reason() string { return e.reason }
    75  
    76  // Cause function returns cause value.
    77  func (e ListenersValidationError) Cause() error { return e.cause }
    78  
    79  // Key function returns key value.
    80  func (e ListenersValidationError) Key() bool { return e.key }
    81  
    82  // ErrorName returns error name.
    83  func (e ListenersValidationError) ErrorName() string { return "ListenersValidationError" }
    84  
    85  // Error satisfies the builtin error interface
    86  func (e ListenersValidationError) Error() string {
    87  	cause := ""
    88  	if e.cause != nil {
    89  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    90  	}
    91  
    92  	key := ""
    93  	if e.key {
    94  		key = "key for "
    95  	}
    96  
    97  	return fmt.Sprintf(
    98  		"invalid %sListeners.%s: %s%s",
    99  		key,
   100  		e.field,
   101  		e.reason,
   102  		cause)
   103  }
   104  
   105  var _ error = ListenersValidationError{}
   106  
   107  var _ interface {
   108  	Field() string
   109  	Reason() string
   110  	Key() bool
   111  	Cause() error
   112  	ErrorName() string
   113  } = ListenersValidationError{}
   114  
   115  // Validate checks the field values on ListenerStatus with the rules defined in
   116  // the proto definition for this message. If any rules are violated, an error
   117  // is returned.
   118  func (m *ListenerStatus) Validate() error {
   119  	if m == nil {
   120  		return nil
   121  	}
   122  
   123  	// no validation rules for Name
   124  
   125  	if v, ok := interface{}(m.GetLocalAddress()).(interface{ Validate() error }); ok {
   126  		if err := v.Validate(); err != nil {
   127  			return ListenerStatusValidationError{
   128  				field:  "LocalAddress",
   129  				reason: "embedded message failed validation",
   130  				cause:  err,
   131  			}
   132  		}
   133  	}
   134  
   135  	return nil
   136  }
   137  
   138  // ListenerStatusValidationError is the validation error returned by
   139  // ListenerStatus.Validate if the designated constraints aren't met.
   140  type ListenerStatusValidationError struct {
   141  	field  string
   142  	reason string
   143  	cause  error
   144  	key    bool
   145  }
   146  
   147  // Field function returns field value.
   148  func (e ListenerStatusValidationError) Field() string { return e.field }
   149  
   150  // Reason function returns reason value.
   151  func (e ListenerStatusValidationError) Reason() string { return e.reason }
   152  
   153  // Cause function returns cause value.
   154  func (e ListenerStatusValidationError) Cause() error { return e.cause }
   155  
   156  // Key function returns key value.
   157  func (e ListenerStatusValidationError) Key() bool { return e.key }
   158  
   159  // ErrorName returns error name.
   160  func (e ListenerStatusValidationError) ErrorName() string { return "ListenerStatusValidationError" }
   161  
   162  // Error satisfies the builtin error interface
   163  func (e ListenerStatusValidationError) Error() string {
   164  	cause := ""
   165  	if e.cause != nil {
   166  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   167  	}
   168  
   169  	key := ""
   170  	if e.key {
   171  		key = "key for "
   172  	}
   173  
   174  	return fmt.Sprintf(
   175  		"invalid %sListenerStatus.%s: %s%s",
   176  		key,
   177  		e.field,
   178  		e.reason,
   179  		cause)
   180  }
   181  
   182  var _ error = ListenerStatusValidationError{}
   183  
   184  var _ interface {
   185  	Field() string
   186  	Reason() string
   187  	Key() bool
   188  	Cause() error
   189  	ErrorName() string
   190  } = ListenerStatusValidationError{}