github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/service/accesslog/v2/als.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/accesslog/v2/als.proto
     3  
     4  package envoy_service_accesslog_v2
     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 StreamAccessLogsResponse with the rules
    37  // defined in the proto definition for this message. If any rules are
    38  // violated, an error is returned.
    39  func (m *StreamAccessLogsResponse) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	return nil
    45  }
    46  
    47  // StreamAccessLogsResponseValidationError is the validation error returned by
    48  // StreamAccessLogsResponse.Validate if the designated constraints aren't met.
    49  type StreamAccessLogsResponseValidationError struct {
    50  	field  string
    51  	reason string
    52  	cause  error
    53  	key    bool
    54  }
    55  
    56  // Field function returns field value.
    57  func (e StreamAccessLogsResponseValidationError) Field() string { return e.field }
    58  
    59  // Reason function returns reason value.
    60  func (e StreamAccessLogsResponseValidationError) Reason() string { return e.reason }
    61  
    62  // Cause function returns cause value.
    63  func (e StreamAccessLogsResponseValidationError) Cause() error { return e.cause }
    64  
    65  // Key function returns key value.
    66  func (e StreamAccessLogsResponseValidationError) Key() bool { return e.key }
    67  
    68  // ErrorName returns error name.
    69  func (e StreamAccessLogsResponseValidationError) ErrorName() string {
    70  	return "StreamAccessLogsResponseValidationError"
    71  }
    72  
    73  // Error satisfies the builtin error interface
    74  func (e StreamAccessLogsResponseValidationError) Error() string {
    75  	cause := ""
    76  	if e.cause != nil {
    77  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    78  	}
    79  
    80  	key := ""
    81  	if e.key {
    82  		key = "key for "
    83  	}
    84  
    85  	return fmt.Sprintf(
    86  		"invalid %sStreamAccessLogsResponse.%s: %s%s",
    87  		key,
    88  		e.field,
    89  		e.reason,
    90  		cause)
    91  }
    92  
    93  var _ error = StreamAccessLogsResponseValidationError{}
    94  
    95  var _ interface {
    96  	Field() string
    97  	Reason() string
    98  	Key() bool
    99  	Cause() error
   100  	ErrorName() string
   101  } = StreamAccessLogsResponseValidationError{}
   102  
   103  // Validate checks the field values on StreamAccessLogsMessage with the rules
   104  // defined in the proto definition for this message. If any rules are
   105  // violated, an error is returned.
   106  func (m *StreamAccessLogsMessage) Validate() error {
   107  	if m == nil {
   108  		return nil
   109  	}
   110  
   111  	if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
   112  		if err := v.Validate(); err != nil {
   113  			return StreamAccessLogsMessageValidationError{
   114  				field:  "Identifier",
   115  				reason: "embedded message failed validation",
   116  				cause:  err,
   117  			}
   118  		}
   119  	}
   120  
   121  	switch m.LogEntries.(type) {
   122  
   123  	case *StreamAccessLogsMessage_HttpLogs:
   124  
   125  		if v, ok := interface{}(m.GetHttpLogs()).(interface{ Validate() error }); ok {
   126  			if err := v.Validate(); err != nil {
   127  				return StreamAccessLogsMessageValidationError{
   128  					field:  "HttpLogs",
   129  					reason: "embedded message failed validation",
   130  					cause:  err,
   131  				}
   132  			}
   133  		}
   134  
   135  	case *StreamAccessLogsMessage_TcpLogs:
   136  
   137  		if v, ok := interface{}(m.GetTcpLogs()).(interface{ Validate() error }); ok {
   138  			if err := v.Validate(); err != nil {
   139  				return StreamAccessLogsMessageValidationError{
   140  					field:  "TcpLogs",
   141  					reason: "embedded message failed validation",
   142  					cause:  err,
   143  				}
   144  			}
   145  		}
   146  
   147  	default:
   148  		return StreamAccessLogsMessageValidationError{
   149  			field:  "LogEntries",
   150  			reason: "value is required",
   151  		}
   152  
   153  	}
   154  
   155  	return nil
   156  }
   157  
   158  // StreamAccessLogsMessageValidationError is the validation error returned by
   159  // StreamAccessLogsMessage.Validate if the designated constraints aren't met.
   160  type StreamAccessLogsMessageValidationError struct {
   161  	field  string
   162  	reason string
   163  	cause  error
   164  	key    bool
   165  }
   166  
   167  // Field function returns field value.
   168  func (e StreamAccessLogsMessageValidationError) Field() string { return e.field }
   169  
   170  // Reason function returns reason value.
   171  func (e StreamAccessLogsMessageValidationError) Reason() string { return e.reason }
   172  
   173  // Cause function returns cause value.
   174  func (e StreamAccessLogsMessageValidationError) Cause() error { return e.cause }
   175  
   176  // Key function returns key value.
   177  func (e StreamAccessLogsMessageValidationError) Key() bool { return e.key }
   178  
   179  // ErrorName returns error name.
   180  func (e StreamAccessLogsMessageValidationError) ErrorName() string {
   181  	return "StreamAccessLogsMessageValidationError"
   182  }
   183  
   184  // Error satisfies the builtin error interface
   185  func (e StreamAccessLogsMessageValidationError) 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 %sStreamAccessLogsMessage.%s: %s%s",
   198  		key,
   199  		e.field,
   200  		e.reason,
   201  		cause)
   202  }
   203  
   204  var _ error = StreamAccessLogsMessageValidationError{}
   205  
   206  var _ interface {
   207  	Field() string
   208  	Reason() string
   209  	Key() bool
   210  	Cause() error
   211  	ErrorName() string
   212  } = StreamAccessLogsMessageValidationError{}
   213  
   214  // Validate checks the field values on StreamAccessLogsMessage_Identifier with
   215  // the rules defined in the proto definition for this message. If any rules
   216  // are violated, an error is returned.
   217  func (m *StreamAccessLogsMessage_Identifier) Validate() error {
   218  	if m == nil {
   219  		return nil
   220  	}
   221  
   222  	if m.GetNode() == nil {
   223  		return StreamAccessLogsMessage_IdentifierValidationError{
   224  			field:  "Node",
   225  			reason: "value is required",
   226  		}
   227  	}
   228  
   229  	if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
   230  		if err := v.Validate(); err != nil {
   231  			return StreamAccessLogsMessage_IdentifierValidationError{
   232  				field:  "Node",
   233  				reason: "embedded message failed validation",
   234  				cause:  err,
   235  			}
   236  		}
   237  	}
   238  
   239  	if len(m.GetLogName()) < 1 {
   240  		return StreamAccessLogsMessage_IdentifierValidationError{
   241  			field:  "LogName",
   242  			reason: "value length must be at least 1 bytes",
   243  		}
   244  	}
   245  
   246  	return nil
   247  }
   248  
   249  // StreamAccessLogsMessage_IdentifierValidationError is the validation error
   250  // returned by StreamAccessLogsMessage_Identifier.Validate if the designated
   251  // constraints aren't met.
   252  type StreamAccessLogsMessage_IdentifierValidationError struct {
   253  	field  string
   254  	reason string
   255  	cause  error
   256  	key    bool
   257  }
   258  
   259  // Field function returns field value.
   260  func (e StreamAccessLogsMessage_IdentifierValidationError) Field() string { return e.field }
   261  
   262  // Reason function returns reason value.
   263  func (e StreamAccessLogsMessage_IdentifierValidationError) Reason() string { return e.reason }
   264  
   265  // Cause function returns cause value.
   266  func (e StreamAccessLogsMessage_IdentifierValidationError) Cause() error { return e.cause }
   267  
   268  // Key function returns key value.
   269  func (e StreamAccessLogsMessage_IdentifierValidationError) Key() bool { return e.key }
   270  
   271  // ErrorName returns error name.
   272  func (e StreamAccessLogsMessage_IdentifierValidationError) ErrorName() string {
   273  	return "StreamAccessLogsMessage_IdentifierValidationError"
   274  }
   275  
   276  // Error satisfies the builtin error interface
   277  func (e StreamAccessLogsMessage_IdentifierValidationError) Error() string {
   278  	cause := ""
   279  	if e.cause != nil {
   280  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   281  	}
   282  
   283  	key := ""
   284  	if e.key {
   285  		key = "key for "
   286  	}
   287  
   288  	return fmt.Sprintf(
   289  		"invalid %sStreamAccessLogsMessage_Identifier.%s: %s%s",
   290  		key,
   291  		e.field,
   292  		e.reason,
   293  		cause)
   294  }
   295  
   296  var _ error = StreamAccessLogsMessage_IdentifierValidationError{}
   297  
   298  var _ interface {
   299  	Field() string
   300  	Reason() string
   301  	Key() bool
   302  	Cause() error
   303  	ErrorName() string
   304  } = StreamAccessLogsMessage_IdentifierValidationError{}
   305  
   306  // Validate checks the field values on
   307  // StreamAccessLogsMessage_HTTPAccessLogEntries with the rules defined in the
   308  // proto definition for this message. If any rules are violated, an error is returned.
   309  func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) Validate() error {
   310  	if m == nil {
   311  		return nil
   312  	}
   313  
   314  	if len(m.GetLogEntry()) < 1 {
   315  		return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
   316  			field:  "LogEntry",
   317  			reason: "value must contain at least 1 item(s)",
   318  		}
   319  	}
   320  
   321  	for idx, item := range m.GetLogEntry() {
   322  		_, _ = idx, item
   323  
   324  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   325  			if err := v.Validate(); err != nil {
   326  				return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
   327  					field:  fmt.Sprintf("LogEntry[%v]", idx),
   328  					reason: "embedded message failed validation",
   329  					cause:  err,
   330  				}
   331  			}
   332  		}
   333  
   334  	}
   335  
   336  	return nil
   337  }
   338  
   339  // StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError is the
   340  // validation error returned by
   341  // StreamAccessLogsMessage_HTTPAccessLogEntries.Validate if the designated
   342  // constraints aren't met.
   343  type StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError struct {
   344  	field  string
   345  	reason string
   346  	cause  error
   347  	key    bool
   348  }
   349  
   350  // Field function returns field value.
   351  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Field() string { return e.field }
   352  
   353  // Reason function returns reason value.
   354  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Reason() string { return e.reason }
   355  
   356  // Cause function returns cause value.
   357  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Cause() error { return e.cause }
   358  
   359  // Key function returns key value.
   360  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Key() bool { return e.key }
   361  
   362  // ErrorName returns error name.
   363  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) ErrorName() string {
   364  	return "StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError"
   365  }
   366  
   367  // Error satisfies the builtin error interface
   368  func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Error() string {
   369  	cause := ""
   370  	if e.cause != nil {
   371  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   372  	}
   373  
   374  	key := ""
   375  	if e.key {
   376  		key = "key for "
   377  	}
   378  
   379  	return fmt.Sprintf(
   380  		"invalid %sStreamAccessLogsMessage_HTTPAccessLogEntries.%s: %s%s",
   381  		key,
   382  		e.field,
   383  		e.reason,
   384  		cause)
   385  }
   386  
   387  var _ error = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
   388  
   389  var _ interface {
   390  	Field() string
   391  	Reason() string
   392  	Key() bool
   393  	Cause() error
   394  	ErrorName() string
   395  } = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
   396  
   397  // Validate checks the field values on
   398  // StreamAccessLogsMessage_TCPAccessLogEntries with the rules defined in the
   399  // proto definition for this message. If any rules are violated, an error is returned.
   400  func (m *StreamAccessLogsMessage_TCPAccessLogEntries) Validate() error {
   401  	if m == nil {
   402  		return nil
   403  	}
   404  
   405  	if len(m.GetLogEntry()) < 1 {
   406  		return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
   407  			field:  "LogEntry",
   408  			reason: "value must contain at least 1 item(s)",
   409  		}
   410  	}
   411  
   412  	for idx, item := range m.GetLogEntry() {
   413  		_, _ = idx, item
   414  
   415  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   416  			if err := v.Validate(); err != nil {
   417  				return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
   418  					field:  fmt.Sprintf("LogEntry[%v]", idx),
   419  					reason: "embedded message failed validation",
   420  					cause:  err,
   421  				}
   422  			}
   423  		}
   424  
   425  	}
   426  
   427  	return nil
   428  }
   429  
   430  // StreamAccessLogsMessage_TCPAccessLogEntriesValidationError is the validation
   431  // error returned by StreamAccessLogsMessage_TCPAccessLogEntries.Validate if
   432  // the designated constraints aren't met.
   433  type StreamAccessLogsMessage_TCPAccessLogEntriesValidationError struct {
   434  	field  string
   435  	reason string
   436  	cause  error
   437  	key    bool
   438  }
   439  
   440  // Field function returns field value.
   441  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Field() string { return e.field }
   442  
   443  // Reason function returns reason value.
   444  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Reason() string { return e.reason }
   445  
   446  // Cause function returns cause value.
   447  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Cause() error { return e.cause }
   448  
   449  // Key function returns key value.
   450  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Key() bool { return e.key }
   451  
   452  // ErrorName returns error name.
   453  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) ErrorName() string {
   454  	return "StreamAccessLogsMessage_TCPAccessLogEntriesValidationError"
   455  }
   456  
   457  // Error satisfies the builtin error interface
   458  func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Error() string {
   459  	cause := ""
   460  	if e.cause != nil {
   461  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   462  	}
   463  
   464  	key := ""
   465  	if e.key {
   466  		key = "key for "
   467  	}
   468  
   469  	return fmt.Sprintf(
   470  		"invalid %sStreamAccessLogsMessage_TCPAccessLogEntries.%s: %s%s",
   471  		key,
   472  		e.field,
   473  		e.reason,
   474  		cause)
   475  }
   476  
   477  var _ error = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}
   478  
   479  var _ interface {
   480  	Field() string
   481  	Reason() string
   482  	Key() bool
   483  	Cause() error
   484  	ErrorName() string
   485  } = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}