...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/envoy/service/discovery/v2/sds.pb.validate.go

Documentation: github.com/emissary-ingress/emissary/v3/pkg/api/envoy/service/discovery/v2

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/discovery/v2/sds.proto
     3  
     4  package discoveryv2
     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 SdsDummy 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 *SdsDummy) Validate() error {
    42  	return m.validate(false)
    43  }
    44  
    45  // ValidateAll checks the field values on SdsDummy 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 SdsDummyMultiError, or nil
    48  // if none found.
    49  func (m *SdsDummy) ValidateAll() error {
    50  	return m.validate(true)
    51  }
    52  
    53  func (m *SdsDummy) validate(all bool) error {
    54  	if m == nil {
    55  		return nil
    56  	}
    57  
    58  	var errors []error
    59  
    60  	if len(errors) > 0 {
    61  		return SdsDummyMultiError(errors)
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  // SdsDummyMultiError is an error wrapping multiple validation errors returned
    68  // by SdsDummy.ValidateAll() if the designated constraints aren't met.
    69  type SdsDummyMultiError []error
    70  
    71  // Error returns a concatenation of all the error messages it wraps.
    72  func (m SdsDummyMultiError) Error() string {
    73  	var msgs []string
    74  	for _, err := range m {
    75  		msgs = append(msgs, err.Error())
    76  	}
    77  	return strings.Join(msgs, "; ")
    78  }
    79  
    80  // AllErrors returns a list of validation violation errors.
    81  func (m SdsDummyMultiError) AllErrors() []error { return m }
    82  
    83  // SdsDummyValidationError is the validation error returned by
    84  // SdsDummy.Validate if the designated constraints aren't met.
    85  type SdsDummyValidationError struct {
    86  	field  string
    87  	reason string
    88  	cause  error
    89  	key    bool
    90  }
    91  
    92  // Field function returns field value.
    93  func (e SdsDummyValidationError) Field() string { return e.field }
    94  
    95  // Reason function returns reason value.
    96  func (e SdsDummyValidationError) Reason() string { return e.reason }
    97  
    98  // Cause function returns cause value.
    99  func (e SdsDummyValidationError) Cause() error { return e.cause }
   100  
   101  // Key function returns key value.
   102  func (e SdsDummyValidationError) Key() bool { return e.key }
   103  
   104  // ErrorName returns error name.
   105  func (e SdsDummyValidationError) ErrorName() string { return "SdsDummyValidationError" }
   106  
   107  // Error satisfies the builtin error interface
   108  func (e SdsDummyValidationError) Error() string {
   109  	cause := ""
   110  	if e.cause != nil {
   111  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   112  	}
   113  
   114  	key := ""
   115  	if e.key {
   116  		key = "key for "
   117  	}
   118  
   119  	return fmt.Sprintf(
   120  		"invalid %sSdsDummy.%s: %s%s",
   121  		key,
   122  		e.field,
   123  		e.reason,
   124  		cause)
   125  }
   126  
   127  var _ error = SdsDummyValidationError{}
   128  
   129  var _ interface {
   130  	Field() string
   131  	Reason() string
   132  	Key() bool
   133  	Cause() error
   134  	ErrorName() string
   135  } = SdsDummyValidationError{}
   136  

View as plain text