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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/annotations/resource.proto
     3  
     4  package envoy_annotations
     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 ResourceAnnotation 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 *ResourceAnnotation) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	// no validation rules for Type
    45  
    46  	return nil
    47  }
    48  
    49  // ResourceAnnotationValidationError is the validation error returned by
    50  // ResourceAnnotation.Validate if the designated constraints aren't met.
    51  type ResourceAnnotationValidationError struct {
    52  	field  string
    53  	reason string
    54  	cause  error
    55  	key    bool
    56  }
    57  
    58  // Field function returns field value.
    59  func (e ResourceAnnotationValidationError) Field() string { return e.field }
    60  
    61  // Reason function returns reason value.
    62  func (e ResourceAnnotationValidationError) Reason() string { return e.reason }
    63  
    64  // Cause function returns cause value.
    65  func (e ResourceAnnotationValidationError) Cause() error { return e.cause }
    66  
    67  // Key function returns key value.
    68  func (e ResourceAnnotationValidationError) Key() bool { return e.key }
    69  
    70  // ErrorName returns error name.
    71  func (e ResourceAnnotationValidationError) ErrorName() string {
    72  	return "ResourceAnnotationValidationError"
    73  }
    74  
    75  // Error satisfies the builtin error interface
    76  func (e ResourceAnnotationValidationError) Error() string {
    77  	cause := ""
    78  	if e.cause != nil {
    79  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    80  	}
    81  
    82  	key := ""
    83  	if e.key {
    84  		key = "key for "
    85  	}
    86  
    87  	return fmt.Sprintf(
    88  		"invalid %sResourceAnnotation.%s: %s%s",
    89  		key,
    90  		e.field,
    91  		e.reason,
    92  		cause)
    93  }
    94  
    95  var _ error = ResourceAnnotationValidationError{}
    96  
    97  var _ interface {
    98  	Field() string
    99  	Reason() string
   100  	Key() bool
   101  	Cause() error
   102  	ErrorName() string
   103  } = ResourceAnnotationValidationError{}