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

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