github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/trace/v3/skywalking.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/trace/v3/skywalking.proto
     3  
     4  package envoy_config_trace_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 SkyWalkingConfig 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 *SkyWalkingConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if m.GetGrpcService() == nil {
    45  		return SkyWalkingConfigValidationError{
    46  			field:  "GrpcService",
    47  			reason: "value is required",
    48  		}
    49  	}
    50  
    51  	if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
    52  		if err := v.Validate(); err != nil {
    53  			return SkyWalkingConfigValidationError{
    54  				field:  "GrpcService",
    55  				reason: "embedded message failed validation",
    56  				cause:  err,
    57  			}
    58  		}
    59  	}
    60  
    61  	if v, ok := interface{}(m.GetClientConfig()).(interface{ Validate() error }); ok {
    62  		if err := v.Validate(); err != nil {
    63  			return SkyWalkingConfigValidationError{
    64  				field:  "ClientConfig",
    65  				reason: "embedded message failed validation",
    66  				cause:  err,
    67  			}
    68  		}
    69  	}
    70  
    71  	return nil
    72  }
    73  
    74  // SkyWalkingConfigValidationError is the validation error returned by
    75  // SkyWalkingConfig.Validate if the designated constraints aren't met.
    76  type SkyWalkingConfigValidationError struct {
    77  	field  string
    78  	reason string
    79  	cause  error
    80  	key    bool
    81  }
    82  
    83  // Field function returns field value.
    84  func (e SkyWalkingConfigValidationError) Field() string { return e.field }
    85  
    86  // Reason function returns reason value.
    87  func (e SkyWalkingConfigValidationError) Reason() string { return e.reason }
    88  
    89  // Cause function returns cause value.
    90  func (e SkyWalkingConfigValidationError) Cause() error { return e.cause }
    91  
    92  // Key function returns key value.
    93  func (e SkyWalkingConfigValidationError) Key() bool { return e.key }
    94  
    95  // ErrorName returns error name.
    96  func (e SkyWalkingConfigValidationError) ErrorName() string { return "SkyWalkingConfigValidationError" }
    97  
    98  // Error satisfies the builtin error interface
    99  func (e SkyWalkingConfigValidationError) Error() string {
   100  	cause := ""
   101  	if e.cause != nil {
   102  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   103  	}
   104  
   105  	key := ""
   106  	if e.key {
   107  		key = "key for "
   108  	}
   109  
   110  	return fmt.Sprintf(
   111  		"invalid %sSkyWalkingConfig.%s: %s%s",
   112  		key,
   113  		e.field,
   114  		e.reason,
   115  		cause)
   116  }
   117  
   118  var _ error = SkyWalkingConfigValidationError{}
   119  
   120  var _ interface {
   121  	Field() string
   122  	Reason() string
   123  	Key() bool
   124  	Cause() error
   125  	ErrorName() string
   126  } = SkyWalkingConfigValidationError{}
   127  
   128  // Validate checks the field values on ClientConfig with the rules defined in
   129  // the proto definition for this message. If any rules are violated, an error
   130  // is returned.
   131  func (m *ClientConfig) Validate() error {
   132  	if m == nil {
   133  		return nil
   134  	}
   135  
   136  	// no validation rules for ServiceName
   137  
   138  	// no validation rules for InstanceName
   139  
   140  	if v, ok := interface{}(m.GetMaxCacheSize()).(interface{ Validate() error }); ok {
   141  		if err := v.Validate(); err != nil {
   142  			return ClientConfigValidationError{
   143  				field:  "MaxCacheSize",
   144  				reason: "embedded message failed validation",
   145  				cause:  err,
   146  			}
   147  		}
   148  	}
   149  
   150  	switch m.BackendTokenSpecifier.(type) {
   151  
   152  	case *ClientConfig_BackendToken:
   153  		// no validation rules for BackendToken
   154  
   155  	}
   156  
   157  	return nil
   158  }
   159  
   160  // ClientConfigValidationError is the validation error returned by
   161  // ClientConfig.Validate if the designated constraints aren't met.
   162  type ClientConfigValidationError struct {
   163  	field  string
   164  	reason string
   165  	cause  error
   166  	key    bool
   167  }
   168  
   169  // Field function returns field value.
   170  func (e ClientConfigValidationError) Field() string { return e.field }
   171  
   172  // Reason function returns reason value.
   173  func (e ClientConfigValidationError) Reason() string { return e.reason }
   174  
   175  // Cause function returns cause value.
   176  func (e ClientConfigValidationError) Cause() error { return e.cause }
   177  
   178  // Key function returns key value.
   179  func (e ClientConfigValidationError) Key() bool { return e.key }
   180  
   181  // ErrorName returns error name.
   182  func (e ClientConfigValidationError) ErrorName() string { return "ClientConfigValidationError" }
   183  
   184  // Error satisfies the builtin error interface
   185  func (e ClientConfigValidationError) Error() string {
   186  	cause := ""
   187  	if e.cause != nil {
   188  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   189  	}
   190  
   191  	key := ""
   192  	if e.key {
   193  		key = "key for "
   194  	}
   195  
   196  	return fmt.Sprintf(
   197  		"invalid %sClientConfig.%s: %s%s",
   198  		key,
   199  		e.field,
   200  		e.reason,
   201  		cause)
   202  }
   203  
   204  var _ error = ClientConfigValidationError{}
   205  
   206  var _ interface {
   207  	Field() string
   208  	Reason() string
   209  	Key() bool
   210  	Cause() error
   211  	ErrorName() string
   212  } = ClientConfigValidationError{}