...

Source file src/github.com/datawire/ambassador/v2/pkg/api/envoy/config/trace/v4alpha/http_tracer.pb.validate.go

Documentation: github.com/datawire/ambassador/v2/pkg/api/envoy/config/trace/v4alpha

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/trace/v4alpha/http_tracer.proto
     3  
     4  package envoy_config_trace_v4alpha
     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  	"github.com/golang/protobuf/ptypes"
    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  	_ = ptypes.DynamicAny{}
    34  )
    35  
    36  // Validate checks the field values on Tracing with the rules defined in the
    37  // proto definition for this message. If any rules are violated, an error is returned.
    38  func (m *Tracing) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
    44  		if err := v.Validate(); err != nil {
    45  			return TracingValidationError{
    46  				field:  "Http",
    47  				reason: "embedded message failed validation",
    48  				cause:  err,
    49  			}
    50  		}
    51  	}
    52  
    53  	return nil
    54  }
    55  
    56  // TracingValidationError is the validation error returned by Tracing.Validate
    57  // if the designated constraints aren't met.
    58  type TracingValidationError struct {
    59  	field  string
    60  	reason string
    61  	cause  error
    62  	key    bool
    63  }
    64  
    65  // Field function returns field value.
    66  func (e TracingValidationError) Field() string { return e.field }
    67  
    68  // Reason function returns reason value.
    69  func (e TracingValidationError) Reason() string { return e.reason }
    70  
    71  // Cause function returns cause value.
    72  func (e TracingValidationError) Cause() error { return e.cause }
    73  
    74  // Key function returns key value.
    75  func (e TracingValidationError) Key() bool { return e.key }
    76  
    77  // ErrorName returns error name.
    78  func (e TracingValidationError) ErrorName() string { return "TracingValidationError" }
    79  
    80  // Error satisfies the builtin error interface
    81  func (e TracingValidationError) Error() string {
    82  	cause := ""
    83  	if e.cause != nil {
    84  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    85  	}
    86  
    87  	key := ""
    88  	if e.key {
    89  		key = "key for "
    90  	}
    91  
    92  	return fmt.Sprintf(
    93  		"invalid %sTracing.%s: %s%s",
    94  		key,
    95  		e.field,
    96  		e.reason,
    97  		cause)
    98  }
    99  
   100  var _ error = TracingValidationError{}
   101  
   102  var _ interface {
   103  	Field() string
   104  	Reason() string
   105  	Key() bool
   106  	Cause() error
   107  	ErrorName() string
   108  } = TracingValidationError{}
   109  
   110  // Validate checks the field values on Tracing_Http with the rules defined in
   111  // the proto definition for this message. If any rules are violated, an error
   112  // is returned.
   113  func (m *Tracing_Http) Validate() error {
   114  	if m == nil {
   115  		return nil
   116  	}
   117  
   118  	if utf8.RuneCountInString(m.GetName()) < 1 {
   119  		return Tracing_HttpValidationError{
   120  			field:  "Name",
   121  			reason: "value length must be at least 1 runes",
   122  		}
   123  	}
   124  
   125  	switch m.ConfigType.(type) {
   126  
   127  	case *Tracing_Http_TypedConfig:
   128  
   129  		if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
   130  			if err := v.Validate(); err != nil {
   131  				return Tracing_HttpValidationError{
   132  					field:  "TypedConfig",
   133  					reason: "embedded message failed validation",
   134  					cause:  err,
   135  				}
   136  			}
   137  		}
   138  
   139  	}
   140  
   141  	return nil
   142  }
   143  
   144  // Tracing_HttpValidationError is the validation error returned by
   145  // Tracing_Http.Validate if the designated constraints aren't met.
   146  type Tracing_HttpValidationError struct {
   147  	field  string
   148  	reason string
   149  	cause  error
   150  	key    bool
   151  }
   152  
   153  // Field function returns field value.
   154  func (e Tracing_HttpValidationError) Field() string { return e.field }
   155  
   156  // Reason function returns reason value.
   157  func (e Tracing_HttpValidationError) Reason() string { return e.reason }
   158  
   159  // Cause function returns cause value.
   160  func (e Tracing_HttpValidationError) Cause() error { return e.cause }
   161  
   162  // Key function returns key value.
   163  func (e Tracing_HttpValidationError) Key() bool { return e.key }
   164  
   165  // ErrorName returns error name.
   166  func (e Tracing_HttpValidationError) ErrorName() string { return "Tracing_HttpValidationError" }
   167  
   168  // Error satisfies the builtin error interface
   169  func (e Tracing_HttpValidationError) Error() string {
   170  	cause := ""
   171  	if e.cause != nil {
   172  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   173  	}
   174  
   175  	key := ""
   176  	if e.key {
   177  		key = "key for "
   178  	}
   179  
   180  	return fmt.Sprintf(
   181  		"invalid %sTracing_Http.%s: %s%s",
   182  		key,
   183  		e.field,
   184  		e.reason,
   185  		cause)
   186  }
   187  
   188  var _ error = Tracing_HttpValidationError{}
   189  
   190  var _ interface {
   191  	Field() string
   192  	Reason() string
   193  	Key() bool
   194  	Cause() error
   195  	ErrorName() string
   196  } = Tracing_HttpValidationError{}
   197  

View as plain text