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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/trace/v3/opencensus.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 OpenCensusConfig 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 *OpenCensusConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	if v, ok := interface{}(m.GetTraceConfig()).(interface{ Validate() error }); ok {
    45  		if err := v.Validate(); err != nil {
    46  			return OpenCensusConfigValidationError{
    47  				field:  "TraceConfig",
    48  				reason: "embedded message failed validation",
    49  				cause:  err,
    50  			}
    51  		}
    52  	}
    53  
    54  	// no validation rules for StdoutExporterEnabled
    55  
    56  	// no validation rules for StackdriverExporterEnabled
    57  
    58  	// no validation rules for StackdriverProjectId
    59  
    60  	// no validation rules for StackdriverAddress
    61  
    62  	if v, ok := interface{}(m.GetStackdriverGrpcService()).(interface{ Validate() error }); ok {
    63  		if err := v.Validate(); err != nil {
    64  			return OpenCensusConfigValidationError{
    65  				field:  "StackdriverGrpcService",
    66  				reason: "embedded message failed validation",
    67  				cause:  err,
    68  			}
    69  		}
    70  	}
    71  
    72  	// no validation rules for ZipkinExporterEnabled
    73  
    74  	// no validation rules for ZipkinUrl
    75  
    76  	// no validation rules for OcagentExporterEnabled
    77  
    78  	// no validation rules for OcagentAddress
    79  
    80  	if v, ok := interface{}(m.GetOcagentGrpcService()).(interface{ Validate() error }); ok {
    81  		if err := v.Validate(); err != nil {
    82  			return OpenCensusConfigValidationError{
    83  				field:  "OcagentGrpcService",
    84  				reason: "embedded message failed validation",
    85  				cause:  err,
    86  			}
    87  		}
    88  	}
    89  
    90  	return nil
    91  }
    92  
    93  // OpenCensusConfigValidationError is the validation error returned by
    94  // OpenCensusConfig.Validate if the designated constraints aren't met.
    95  type OpenCensusConfigValidationError struct {
    96  	field  string
    97  	reason string
    98  	cause  error
    99  	key    bool
   100  }
   101  
   102  // Field function returns field value.
   103  func (e OpenCensusConfigValidationError) Field() string { return e.field }
   104  
   105  // Reason function returns reason value.
   106  func (e OpenCensusConfigValidationError) Reason() string { return e.reason }
   107  
   108  // Cause function returns cause value.
   109  func (e OpenCensusConfigValidationError) Cause() error { return e.cause }
   110  
   111  // Key function returns key value.
   112  func (e OpenCensusConfigValidationError) Key() bool { return e.key }
   113  
   114  // ErrorName returns error name.
   115  func (e OpenCensusConfigValidationError) ErrorName() string { return "OpenCensusConfigValidationError" }
   116  
   117  // Error satisfies the builtin error interface
   118  func (e OpenCensusConfigValidationError) Error() string {
   119  	cause := ""
   120  	if e.cause != nil {
   121  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   122  	}
   123  
   124  	key := ""
   125  	if e.key {
   126  		key = "key for "
   127  	}
   128  
   129  	return fmt.Sprintf(
   130  		"invalid %sOpenCensusConfig.%s: %s%s",
   131  		key,
   132  		e.field,
   133  		e.reason,
   134  		cause)
   135  }
   136  
   137  var _ error = OpenCensusConfigValidationError{}
   138  
   139  var _ interface {
   140  	Field() string
   141  	Reason() string
   142  	Key() bool
   143  	Cause() error
   144  	ErrorName() string
   145  } = OpenCensusConfigValidationError{}