gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/go-control-plane/envoy/extensions/formatter/metadata/v3/metadata.pb.validate.go (about)

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