...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/envoy/admin/v2alpha/mutex_stats.pb.validate.go

Documentation: github.com/emissary-ingress/emissary/v3/pkg/api/envoy/admin/v2alpha

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

View as plain text