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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/clusters/aggregate/v3/cluster.proto
     3  
     4  package envoy_extensions_clusters_aggregate_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 ClusterConfig 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 *ClusterConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if len(m.GetClusters()) < 1 {
    45  		return ClusterConfigValidationError{
    46  			field:  "Clusters",
    47  			reason: "value must contain at least 1 item(s)",
    48  		}
    49  	}
    50  
    51  	return nil
    52  }
    53  
    54  // ClusterConfigValidationError is the validation error returned by
    55  // ClusterConfig.Validate if the designated constraints aren't met.
    56  type ClusterConfigValidationError struct {
    57  	field  string
    58  	reason string
    59  	cause  error
    60  	key    bool
    61  }
    62  
    63  // Field function returns field value.
    64  func (e ClusterConfigValidationError) Field() string { return e.field }
    65  
    66  // Reason function returns reason value.
    67  func (e ClusterConfigValidationError) Reason() string { return e.reason }
    68  
    69  // Cause function returns cause value.
    70  func (e ClusterConfigValidationError) Cause() error { return e.cause }
    71  
    72  // Key function returns key value.
    73  func (e ClusterConfigValidationError) Key() bool { return e.key }
    74  
    75  // ErrorName returns error name.
    76  func (e ClusterConfigValidationError) ErrorName() string { return "ClusterConfigValidationError" }
    77  
    78  // Error satisfies the builtin error interface
    79  func (e ClusterConfigValidationError) 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 %sClusterConfig.%s: %s%s",
    92  		key,
    93  		e.field,
    94  		e.reason,
    95  		cause)
    96  }
    97  
    98  var _ error = ClusterConfigValidationError{}
    99  
   100  var _ interface {
   101  	Field() string
   102  	Reason() string
   103  	Key() bool
   104  	Cause() error
   105  	ErrorName() string
   106  } = ClusterConfigValidationError{}