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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/access_loggers/grpc/v3/als.proto
     3  
     4  package envoy_extensions_access_loggers_grpc_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  	v3 "gitee.com/ks-custle/core-gm/go-control-plane/envoy/config/core/v3"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = bytes.MinRead
    26  	_ = errors.New("")
    27  	_ = fmt.Print
    28  	_ = utf8.UTFMax
    29  	_ = (*regexp.Regexp)(nil)
    30  	_ = (*strings.Reader)(nil)
    31  	_ = net.IPv4len
    32  	_ = time.Duration(0)
    33  	_ = (*url.URL)(nil)
    34  	_ = (*mail.Address)(nil)
    35  	_ = anypb.Any{}
    36  
    37  	_ = v3.ApiVersion(0)
    38  )
    39  
    40  // Validate checks the field values on HttpGrpcAccessLogConfig with the rules
    41  // defined in the proto definition for this message. If any rules are
    42  // violated, an error is returned.
    43  func (m *HttpGrpcAccessLogConfig) Validate() error {
    44  	if m == nil {
    45  		return nil
    46  	}
    47  
    48  	if m.GetCommonConfig() == nil {
    49  		return HttpGrpcAccessLogConfigValidationError{
    50  			field:  "CommonConfig",
    51  			reason: "value is required",
    52  		}
    53  	}
    54  
    55  	if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok {
    56  		if err := v.Validate(); err != nil {
    57  			return HttpGrpcAccessLogConfigValidationError{
    58  				field:  "CommonConfig",
    59  				reason: "embedded message failed validation",
    60  				cause:  err,
    61  			}
    62  		}
    63  	}
    64  
    65  	return nil
    66  }
    67  
    68  // HttpGrpcAccessLogConfigValidationError is the validation error returned by
    69  // HttpGrpcAccessLogConfig.Validate if the designated constraints aren't met.
    70  type HttpGrpcAccessLogConfigValidationError struct {
    71  	field  string
    72  	reason string
    73  	cause  error
    74  	key    bool
    75  }
    76  
    77  // Field function returns field value.
    78  func (e HttpGrpcAccessLogConfigValidationError) Field() string { return e.field }
    79  
    80  // Reason function returns reason value.
    81  func (e HttpGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
    82  
    83  // Cause function returns cause value.
    84  func (e HttpGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
    85  
    86  // Key function returns key value.
    87  func (e HttpGrpcAccessLogConfigValidationError) Key() bool { return e.key }
    88  
    89  // ErrorName returns error name.
    90  func (e HttpGrpcAccessLogConfigValidationError) ErrorName() string {
    91  	return "HttpGrpcAccessLogConfigValidationError"
    92  }
    93  
    94  // Error satisfies the builtin error interface
    95  func (e HttpGrpcAccessLogConfigValidationError) 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 %sHttpGrpcAccessLogConfig.%s: %s%s",
   108  		key,
   109  		e.field,
   110  		e.reason,
   111  		cause)
   112  }
   113  
   114  var _ error = HttpGrpcAccessLogConfigValidationError{}
   115  
   116  var _ interface {
   117  	Field() string
   118  	Reason() string
   119  	Key() bool
   120  	Cause() error
   121  	ErrorName() string
   122  } = HttpGrpcAccessLogConfigValidationError{}
   123  
   124  // Validate checks the field values on TcpGrpcAccessLogConfig with the rules
   125  // defined in the proto definition for this message. If any rules are
   126  // violated, an error is returned.
   127  func (m *TcpGrpcAccessLogConfig) Validate() error {
   128  	if m == nil {
   129  		return nil
   130  	}
   131  
   132  	if m.GetCommonConfig() == nil {
   133  		return TcpGrpcAccessLogConfigValidationError{
   134  			field:  "CommonConfig",
   135  			reason: "value is required",
   136  		}
   137  	}
   138  
   139  	if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok {
   140  		if err := v.Validate(); err != nil {
   141  			return TcpGrpcAccessLogConfigValidationError{
   142  				field:  "CommonConfig",
   143  				reason: "embedded message failed validation",
   144  				cause:  err,
   145  			}
   146  		}
   147  	}
   148  
   149  	return nil
   150  }
   151  
   152  // TcpGrpcAccessLogConfigValidationError is the validation error returned by
   153  // TcpGrpcAccessLogConfig.Validate if the designated constraints aren't met.
   154  type TcpGrpcAccessLogConfigValidationError struct {
   155  	field  string
   156  	reason string
   157  	cause  error
   158  	key    bool
   159  }
   160  
   161  // Field function returns field value.
   162  func (e TcpGrpcAccessLogConfigValidationError) Field() string { return e.field }
   163  
   164  // Reason function returns reason value.
   165  func (e TcpGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
   166  
   167  // Cause function returns cause value.
   168  func (e TcpGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
   169  
   170  // Key function returns key value.
   171  func (e TcpGrpcAccessLogConfigValidationError) Key() bool { return e.key }
   172  
   173  // ErrorName returns error name.
   174  func (e TcpGrpcAccessLogConfigValidationError) ErrorName() string {
   175  	return "TcpGrpcAccessLogConfigValidationError"
   176  }
   177  
   178  // Error satisfies the builtin error interface
   179  func (e TcpGrpcAccessLogConfigValidationError) Error() string {
   180  	cause := ""
   181  	if e.cause != nil {
   182  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   183  	}
   184  
   185  	key := ""
   186  	if e.key {
   187  		key = "key for "
   188  	}
   189  
   190  	return fmt.Sprintf(
   191  		"invalid %sTcpGrpcAccessLogConfig.%s: %s%s",
   192  		key,
   193  		e.field,
   194  		e.reason,
   195  		cause)
   196  }
   197  
   198  var _ error = TcpGrpcAccessLogConfigValidationError{}
   199  
   200  var _ interface {
   201  	Field() string
   202  	Reason() string
   203  	Key() bool
   204  	Cause() error
   205  	ErrorName() string
   206  } = TcpGrpcAccessLogConfigValidationError{}
   207  
   208  // Validate checks the field values on CommonGrpcAccessLogConfig with the rules
   209  // defined in the proto definition for this message. If any rules are
   210  // violated, an error is returned.
   211  func (m *CommonGrpcAccessLogConfig) Validate() error {
   212  	if m == nil {
   213  		return nil
   214  	}
   215  
   216  	if utf8.RuneCountInString(m.GetLogName()) < 1 {
   217  		return CommonGrpcAccessLogConfigValidationError{
   218  			field:  "LogName",
   219  			reason: "value length must be at least 1 runes",
   220  		}
   221  	}
   222  
   223  	if m.GetGrpcService() == nil {
   224  		return CommonGrpcAccessLogConfigValidationError{
   225  			field:  "GrpcService",
   226  			reason: "value is required",
   227  		}
   228  	}
   229  
   230  	if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
   231  		if err := v.Validate(); err != nil {
   232  			return CommonGrpcAccessLogConfigValidationError{
   233  				field:  "GrpcService",
   234  				reason: "embedded message failed validation",
   235  				cause:  err,
   236  			}
   237  		}
   238  	}
   239  
   240  	if _, ok := v3.ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok {
   241  		return CommonGrpcAccessLogConfigValidationError{
   242  			field:  "TransportApiVersion",
   243  			reason: "value must be one of the defined enum values",
   244  		}
   245  	}
   246  
   247  	if d := m.GetBufferFlushInterval(); d != nil {
   248  		dur, err := d.AsDuration(), d.CheckValid()
   249  		if err != nil {
   250  			return CommonGrpcAccessLogConfigValidationError{
   251  				field:  "BufferFlushInterval",
   252  				reason: "value is not a valid duration",
   253  				cause:  err,
   254  			}
   255  		}
   256  
   257  		gt := time.Duration(0*time.Second + 0*time.Nanosecond)
   258  
   259  		if dur <= gt {
   260  			return CommonGrpcAccessLogConfigValidationError{
   261  				field:  "BufferFlushInterval",
   262  				reason: "value must be greater than 0s",
   263  			}
   264  		}
   265  
   266  	}
   267  
   268  	if v, ok := interface{}(m.GetBufferSizeBytes()).(interface{ Validate() error }); ok {
   269  		if err := v.Validate(); err != nil {
   270  			return CommonGrpcAccessLogConfigValidationError{
   271  				field:  "BufferSizeBytes",
   272  				reason: "embedded message failed validation",
   273  				cause:  err,
   274  			}
   275  		}
   276  	}
   277  
   278  	return nil
   279  }
   280  
   281  // CommonGrpcAccessLogConfigValidationError is the validation error returned by
   282  // CommonGrpcAccessLogConfig.Validate if the designated constraints aren't met.
   283  type CommonGrpcAccessLogConfigValidationError struct {
   284  	field  string
   285  	reason string
   286  	cause  error
   287  	key    bool
   288  }
   289  
   290  // Field function returns field value.
   291  func (e CommonGrpcAccessLogConfigValidationError) Field() string { return e.field }
   292  
   293  // Reason function returns reason value.
   294  func (e CommonGrpcAccessLogConfigValidationError) Reason() string { return e.reason }
   295  
   296  // Cause function returns cause value.
   297  func (e CommonGrpcAccessLogConfigValidationError) Cause() error { return e.cause }
   298  
   299  // Key function returns key value.
   300  func (e CommonGrpcAccessLogConfigValidationError) Key() bool { return e.key }
   301  
   302  // ErrorName returns error name.
   303  func (e CommonGrpcAccessLogConfigValidationError) ErrorName() string {
   304  	return "CommonGrpcAccessLogConfigValidationError"
   305  }
   306  
   307  // Error satisfies the builtin error interface
   308  func (e CommonGrpcAccessLogConfigValidationError) Error() string {
   309  	cause := ""
   310  	if e.cause != nil {
   311  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   312  	}
   313  
   314  	key := ""
   315  	if e.key {
   316  		key = "key for "
   317  	}
   318  
   319  	return fmt.Sprintf(
   320  		"invalid %sCommonGrpcAccessLogConfig.%s: %s%s",
   321  		key,
   322  		e.field,
   323  		e.reason,
   324  		cause)
   325  }
   326  
   327  var _ error = CommonGrpcAccessLogConfigValidationError{}
   328  
   329  var _ interface {
   330  	Field() string
   331  	Reason() string
   332  	Key() bool
   333  	Cause() error
   334  	ErrorName() string
   335  } = CommonGrpcAccessLogConfigValidationError{}