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

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