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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/route/v3/route.proto
     3  
     4  package envoy_config_route_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 RouteConfiguration 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 *RouteConfiguration) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	// no validation rules for Name
    45  
    46  	for idx, item := range m.GetVirtualHosts() {
    47  		_, _ = idx, item
    48  
    49  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    50  			if err := v.Validate(); err != nil {
    51  				return RouteConfigurationValidationError{
    52  					field:  fmt.Sprintf("VirtualHosts[%v]", idx),
    53  					reason: "embedded message failed validation",
    54  					cause:  err,
    55  				}
    56  			}
    57  		}
    58  
    59  	}
    60  
    61  	if v, ok := interface{}(m.GetVhds()).(interface{ Validate() error }); ok {
    62  		if err := v.Validate(); err != nil {
    63  			return RouteConfigurationValidationError{
    64  				field:  "Vhds",
    65  				reason: "embedded message failed validation",
    66  				cause:  err,
    67  			}
    68  		}
    69  	}
    70  
    71  	for idx, item := range m.GetInternalOnlyHeaders() {
    72  		_, _ = idx, item
    73  
    74  		if !_RouteConfiguration_InternalOnlyHeaders_Pattern.MatchString(item) {
    75  			return RouteConfigurationValidationError{
    76  				field:  fmt.Sprintf("InternalOnlyHeaders[%v]", idx),
    77  				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
    78  			}
    79  		}
    80  
    81  	}
    82  
    83  	if len(m.GetResponseHeadersToAdd()) > 1000 {
    84  		return RouteConfigurationValidationError{
    85  			field:  "ResponseHeadersToAdd",
    86  			reason: "value must contain no more than 1000 item(s)",
    87  		}
    88  	}
    89  
    90  	for idx, item := range m.GetResponseHeadersToAdd() {
    91  		_, _ = idx, item
    92  
    93  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    94  			if err := v.Validate(); err != nil {
    95  				return RouteConfigurationValidationError{
    96  					field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
    97  					reason: "embedded message failed validation",
    98  					cause:  err,
    99  				}
   100  			}
   101  		}
   102  
   103  	}
   104  
   105  	for idx, item := range m.GetResponseHeadersToRemove() {
   106  		_, _ = idx, item
   107  
   108  		if !_RouteConfiguration_ResponseHeadersToRemove_Pattern.MatchString(item) {
   109  			return RouteConfigurationValidationError{
   110  				field:  fmt.Sprintf("ResponseHeadersToRemove[%v]", idx),
   111  				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   112  			}
   113  		}
   114  
   115  	}
   116  
   117  	if len(m.GetRequestHeadersToAdd()) > 1000 {
   118  		return RouteConfigurationValidationError{
   119  			field:  "RequestHeadersToAdd",
   120  			reason: "value must contain no more than 1000 item(s)",
   121  		}
   122  	}
   123  
   124  	for idx, item := range m.GetRequestHeadersToAdd() {
   125  		_, _ = idx, item
   126  
   127  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   128  			if err := v.Validate(); err != nil {
   129  				return RouteConfigurationValidationError{
   130  					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
   131  					reason: "embedded message failed validation",
   132  					cause:  err,
   133  				}
   134  			}
   135  		}
   136  
   137  	}
   138  
   139  	for idx, item := range m.GetRequestHeadersToRemove() {
   140  		_, _ = idx, item
   141  
   142  		if !_RouteConfiguration_RequestHeadersToRemove_Pattern.MatchString(item) {
   143  			return RouteConfigurationValidationError{
   144  				field:  fmt.Sprintf("RequestHeadersToRemove[%v]", idx),
   145  				reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
   146  			}
   147  		}
   148  
   149  	}
   150  
   151  	// no validation rules for MostSpecificHeaderMutationsWins
   152  
   153  	if v, ok := interface{}(m.GetValidateClusters()).(interface{ Validate() error }); ok {
   154  		if err := v.Validate(); err != nil {
   155  			return RouteConfigurationValidationError{
   156  				field:  "ValidateClusters",
   157  				reason: "embedded message failed validation",
   158  				cause:  err,
   159  			}
   160  		}
   161  	}
   162  
   163  	if v, ok := interface{}(m.GetMaxDirectResponseBodySizeBytes()).(interface{ Validate() error }); ok {
   164  		if err := v.Validate(); err != nil {
   165  			return RouteConfigurationValidationError{
   166  				field:  "MaxDirectResponseBodySizeBytes",
   167  				reason: "embedded message failed validation",
   168  				cause:  err,
   169  			}
   170  		}
   171  	}
   172  
   173  	for idx, item := range m.GetClusterSpecifierPlugins() {
   174  		_, _ = idx, item
   175  
   176  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   177  			if err := v.Validate(); err != nil {
   178  				return RouteConfigurationValidationError{
   179  					field:  fmt.Sprintf("ClusterSpecifierPlugins[%v]", idx),
   180  					reason: "embedded message failed validation",
   181  					cause:  err,
   182  				}
   183  			}
   184  		}
   185  
   186  	}
   187  
   188  	return nil
   189  }
   190  
   191  // RouteConfigurationValidationError is the validation error returned by
   192  // RouteConfiguration.Validate if the designated constraints aren't met.
   193  type RouteConfigurationValidationError struct {
   194  	field  string
   195  	reason string
   196  	cause  error
   197  	key    bool
   198  }
   199  
   200  // Field function returns field value.
   201  func (e RouteConfigurationValidationError) Field() string { return e.field }
   202  
   203  // Reason function returns reason value.
   204  func (e RouteConfigurationValidationError) Reason() string { return e.reason }
   205  
   206  // Cause function returns cause value.
   207  func (e RouteConfigurationValidationError) Cause() error { return e.cause }
   208  
   209  // Key function returns key value.
   210  func (e RouteConfigurationValidationError) Key() bool { return e.key }
   211  
   212  // ErrorName returns error name.
   213  func (e RouteConfigurationValidationError) ErrorName() string {
   214  	return "RouteConfigurationValidationError"
   215  }
   216  
   217  // Error satisfies the builtin error interface
   218  func (e RouteConfigurationValidationError) Error() string {
   219  	cause := ""
   220  	if e.cause != nil {
   221  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   222  	}
   223  
   224  	key := ""
   225  	if e.key {
   226  		key = "key for "
   227  	}
   228  
   229  	return fmt.Sprintf(
   230  		"invalid %sRouteConfiguration.%s: %s%s",
   231  		key,
   232  		e.field,
   233  		e.reason,
   234  		cause)
   235  }
   236  
   237  var _ error = RouteConfigurationValidationError{}
   238  
   239  var _ interface {
   240  	Field() string
   241  	Reason() string
   242  	Key() bool
   243  	Cause() error
   244  	ErrorName() string
   245  } = RouteConfigurationValidationError{}
   246  
   247  var _RouteConfiguration_InternalOnlyHeaders_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   248  
   249  var _RouteConfiguration_ResponseHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   250  
   251  var _RouteConfiguration_RequestHeadersToRemove_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
   252  
   253  // Validate checks the field values on ClusterSpecifierPlugin with the rules
   254  // defined in the proto definition for this message. If any rules are
   255  // violated, an error is returned.
   256  func (m *ClusterSpecifierPlugin) Validate() error {
   257  	if m == nil {
   258  		return nil
   259  	}
   260  
   261  	if v, ok := interface{}(m.GetExtension()).(interface{ Validate() error }); ok {
   262  		if err := v.Validate(); err != nil {
   263  			return ClusterSpecifierPluginValidationError{
   264  				field:  "Extension",
   265  				reason: "embedded message failed validation",
   266  				cause:  err,
   267  			}
   268  		}
   269  	}
   270  
   271  	return nil
   272  }
   273  
   274  // ClusterSpecifierPluginValidationError is the validation error returned by
   275  // ClusterSpecifierPlugin.Validate if the designated constraints aren't met.
   276  type ClusterSpecifierPluginValidationError struct {
   277  	field  string
   278  	reason string
   279  	cause  error
   280  	key    bool
   281  }
   282  
   283  // Field function returns field value.
   284  func (e ClusterSpecifierPluginValidationError) Field() string { return e.field }
   285  
   286  // Reason function returns reason value.
   287  func (e ClusterSpecifierPluginValidationError) Reason() string { return e.reason }
   288  
   289  // Cause function returns cause value.
   290  func (e ClusterSpecifierPluginValidationError) Cause() error { return e.cause }
   291  
   292  // Key function returns key value.
   293  func (e ClusterSpecifierPluginValidationError) Key() bool { return e.key }
   294  
   295  // ErrorName returns error name.
   296  func (e ClusterSpecifierPluginValidationError) ErrorName() string {
   297  	return "ClusterSpecifierPluginValidationError"
   298  }
   299  
   300  // Error satisfies the builtin error interface
   301  func (e ClusterSpecifierPluginValidationError) Error() string {
   302  	cause := ""
   303  	if e.cause != nil {
   304  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   305  	}
   306  
   307  	key := ""
   308  	if e.key {
   309  		key = "key for "
   310  	}
   311  
   312  	return fmt.Sprintf(
   313  		"invalid %sClusterSpecifierPlugin.%s: %s%s",
   314  		key,
   315  		e.field,
   316  		e.reason,
   317  		cause)
   318  }
   319  
   320  var _ error = ClusterSpecifierPluginValidationError{}
   321  
   322  var _ interface {
   323  	Field() string
   324  	Reason() string
   325  	Key() bool
   326  	Cause() error
   327  	ErrorName() string
   328  } = ClusterSpecifierPluginValidationError{}
   329  
   330  // Validate checks the field values on Vhds with the rules defined in the proto
   331  // definition for this message. If any rules are violated, an error is returned.
   332  func (m *Vhds) Validate() error {
   333  	if m == nil {
   334  		return nil
   335  	}
   336  
   337  	if m.GetConfigSource() == nil {
   338  		return VhdsValidationError{
   339  			field:  "ConfigSource",
   340  			reason: "value is required",
   341  		}
   342  	}
   343  
   344  	if v, ok := interface{}(m.GetConfigSource()).(interface{ Validate() error }); ok {
   345  		if err := v.Validate(); err != nil {
   346  			return VhdsValidationError{
   347  				field:  "ConfigSource",
   348  				reason: "embedded message failed validation",
   349  				cause:  err,
   350  			}
   351  		}
   352  	}
   353  
   354  	return nil
   355  }
   356  
   357  // VhdsValidationError is the validation error returned by Vhds.Validate if the
   358  // designated constraints aren't met.
   359  type VhdsValidationError struct {
   360  	field  string
   361  	reason string
   362  	cause  error
   363  	key    bool
   364  }
   365  
   366  // Field function returns field value.
   367  func (e VhdsValidationError) Field() string { return e.field }
   368  
   369  // Reason function returns reason value.
   370  func (e VhdsValidationError) Reason() string { return e.reason }
   371  
   372  // Cause function returns cause value.
   373  func (e VhdsValidationError) Cause() error { return e.cause }
   374  
   375  // Key function returns key value.
   376  func (e VhdsValidationError) Key() bool { return e.key }
   377  
   378  // ErrorName returns error name.
   379  func (e VhdsValidationError) ErrorName() string { return "VhdsValidationError" }
   380  
   381  // Error satisfies the builtin error interface
   382  func (e VhdsValidationError) Error() string {
   383  	cause := ""
   384  	if e.cause != nil {
   385  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   386  	}
   387  
   388  	key := ""
   389  	if e.key {
   390  		key = "key for "
   391  	}
   392  
   393  	return fmt.Sprintf(
   394  		"invalid %sVhds.%s: %s%s",
   395  		key,
   396  		e.field,
   397  		e.reason,
   398  		cause)
   399  }
   400  
   401  var _ error = VhdsValidationError{}
   402  
   403  var _ interface {
   404  	Field() string
   405  	Reason() string
   406  	Key() bool
   407  	Cause() error
   408  	ErrorName() string
   409  } = VhdsValidationError{}