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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/request_id/uuid/v3/uuid.proto
     3  
     4  package envoy_extensions_request_id_uuid_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 UuidRequestIdConfig with the rules
    37  // defined in the proto definition for this message. If any rules are
    38  // violated, an error is returned.
    39  func (m *UuidRequestIdConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetPackTraceReason()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return UuidRequestIdConfigValidationError{
    47  				field:  "PackTraceReason",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	if v, ok := interface{}(m.GetUseRequestIdForTraceSampling()).(interface{ Validate() error }); ok {
    55  		if err := v.Validate(); err != nil {
    56  			return UuidRequestIdConfigValidationError{
    57  				field:  "UseRequestIdForTraceSampling",
    58  				reason: "embedded message failed validation",
    59  				cause:  err,
    60  			}
    61  		}
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  // UuidRequestIdConfigValidationError is the validation error returned by
    68  // UuidRequestIdConfig.Validate if the designated constraints aren't met.
    69  type UuidRequestIdConfigValidationError struct {
    70  	field  string
    71  	reason string
    72  	cause  error
    73  	key    bool
    74  }
    75  
    76  // Field function returns field value.
    77  func (e UuidRequestIdConfigValidationError) Field() string { return e.field }
    78  
    79  // Reason function returns reason value.
    80  func (e UuidRequestIdConfigValidationError) Reason() string { return e.reason }
    81  
    82  // Cause function returns cause value.
    83  func (e UuidRequestIdConfigValidationError) Cause() error { return e.cause }
    84  
    85  // Key function returns key value.
    86  func (e UuidRequestIdConfigValidationError) Key() bool { return e.key }
    87  
    88  // ErrorName returns error name.
    89  func (e UuidRequestIdConfigValidationError) ErrorName() string {
    90  	return "UuidRequestIdConfigValidationError"
    91  }
    92  
    93  // Error satisfies the builtin error interface
    94  func (e UuidRequestIdConfigValidationError) Error() string {
    95  	cause := ""
    96  	if e.cause != nil {
    97  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    98  	}
    99  
   100  	key := ""
   101  	if e.key {
   102  		key = "key for "
   103  	}
   104  
   105  	return fmt.Sprintf(
   106  		"invalid %sUuidRequestIdConfig.%s: %s%s",
   107  		key,
   108  		e.field,
   109  		e.reason,
   110  		cause)
   111  }
   112  
   113  var _ error = UuidRequestIdConfigValidationError{}
   114  
   115  var _ interface {
   116  	Field() string
   117  	Reason() string
   118  	Key() bool
   119  	Cause() error
   120  	ErrorName() string
   121  } = UuidRequestIdConfigValidationError{}