github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/watchdog/v3alpha/abort_action.pb.validate.go (about)

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