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

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