github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/wasm/v3/wasm.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/extensions/wasm/v3/wasm.proto
     3  
     4  package envoy_extensions_wasm_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 CapabilityRestrictionConfig with the
    37  // rules defined in the proto definition for this message. If any rules are
    38  // violated, an error is returned.
    39  func (m *CapabilityRestrictionConfig) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	for key, val := range m.GetAllowedCapabilities() {
    45  		_ = val
    46  
    47  		// no validation rules for AllowedCapabilities[key]
    48  
    49  		if v, ok := interface{}(val).(interface{ Validate() error }); ok {
    50  			if err := v.Validate(); err != nil {
    51  				return CapabilityRestrictionConfigValidationError{
    52  					field:  fmt.Sprintf("AllowedCapabilities[%v]", key),
    53  					reason: "embedded message failed validation",
    54  					cause:  err,
    55  				}
    56  			}
    57  		}
    58  
    59  	}
    60  
    61  	return nil
    62  }
    63  
    64  // CapabilityRestrictionConfigValidationError is the validation error returned
    65  // by CapabilityRestrictionConfig.Validate if the designated constraints
    66  // aren't met.
    67  type CapabilityRestrictionConfigValidationError struct {
    68  	field  string
    69  	reason string
    70  	cause  error
    71  	key    bool
    72  }
    73  
    74  // Field function returns field value.
    75  func (e CapabilityRestrictionConfigValidationError) Field() string { return e.field }
    76  
    77  // Reason function returns reason value.
    78  func (e CapabilityRestrictionConfigValidationError) Reason() string { return e.reason }
    79  
    80  // Cause function returns cause value.
    81  func (e CapabilityRestrictionConfigValidationError) Cause() error { return e.cause }
    82  
    83  // Key function returns key value.
    84  func (e CapabilityRestrictionConfigValidationError) Key() bool { return e.key }
    85  
    86  // ErrorName returns error name.
    87  func (e CapabilityRestrictionConfigValidationError) ErrorName() string {
    88  	return "CapabilityRestrictionConfigValidationError"
    89  }
    90  
    91  // Error satisfies the builtin error interface
    92  func (e CapabilityRestrictionConfigValidationError) Error() string {
    93  	cause := ""
    94  	if e.cause != nil {
    95  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    96  	}
    97  
    98  	key := ""
    99  	if e.key {
   100  		key = "key for "
   101  	}
   102  
   103  	return fmt.Sprintf(
   104  		"invalid %sCapabilityRestrictionConfig.%s: %s%s",
   105  		key,
   106  		e.field,
   107  		e.reason,
   108  		cause)
   109  }
   110  
   111  var _ error = CapabilityRestrictionConfigValidationError{}
   112  
   113  var _ interface {
   114  	Field() string
   115  	Reason() string
   116  	Key() bool
   117  	Cause() error
   118  	ErrorName() string
   119  } = CapabilityRestrictionConfigValidationError{}
   120  
   121  // Validate checks the field values on SanitizationConfig with the rules
   122  // defined in the proto definition for this message. If any rules are
   123  // violated, an error is returned.
   124  func (m *SanitizationConfig) Validate() error {
   125  	if m == nil {
   126  		return nil
   127  	}
   128  
   129  	return nil
   130  }
   131  
   132  // SanitizationConfigValidationError is the validation error returned by
   133  // SanitizationConfig.Validate if the designated constraints aren't met.
   134  type SanitizationConfigValidationError struct {
   135  	field  string
   136  	reason string
   137  	cause  error
   138  	key    bool
   139  }
   140  
   141  // Field function returns field value.
   142  func (e SanitizationConfigValidationError) Field() string { return e.field }
   143  
   144  // Reason function returns reason value.
   145  func (e SanitizationConfigValidationError) Reason() string { return e.reason }
   146  
   147  // Cause function returns cause value.
   148  func (e SanitizationConfigValidationError) Cause() error { return e.cause }
   149  
   150  // Key function returns key value.
   151  func (e SanitizationConfigValidationError) Key() bool { return e.key }
   152  
   153  // ErrorName returns error name.
   154  func (e SanitizationConfigValidationError) ErrorName() string {
   155  	return "SanitizationConfigValidationError"
   156  }
   157  
   158  // Error satisfies the builtin error interface
   159  func (e SanitizationConfigValidationError) Error() string {
   160  	cause := ""
   161  	if e.cause != nil {
   162  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   163  	}
   164  
   165  	key := ""
   166  	if e.key {
   167  		key = "key for "
   168  	}
   169  
   170  	return fmt.Sprintf(
   171  		"invalid %sSanitizationConfig.%s: %s%s",
   172  		key,
   173  		e.field,
   174  		e.reason,
   175  		cause)
   176  }
   177  
   178  var _ error = SanitizationConfigValidationError{}
   179  
   180  var _ interface {
   181  	Field() string
   182  	Reason() string
   183  	Key() bool
   184  	Cause() error
   185  	ErrorName() string
   186  } = SanitizationConfigValidationError{}
   187  
   188  // Validate checks the field values on VmConfig with the rules defined in the
   189  // proto definition for this message. If any rules are violated, an error is returned.
   190  func (m *VmConfig) Validate() error {
   191  	if m == nil {
   192  		return nil
   193  	}
   194  
   195  	// no validation rules for VmId
   196  
   197  	if utf8.RuneCountInString(m.GetRuntime()) < 1 {
   198  		return VmConfigValidationError{
   199  			field:  "Runtime",
   200  			reason: "value length must be at least 1 runes",
   201  		}
   202  	}
   203  
   204  	if v, ok := interface{}(m.GetCode()).(interface{ Validate() error }); ok {
   205  		if err := v.Validate(); err != nil {
   206  			return VmConfigValidationError{
   207  				field:  "Code",
   208  				reason: "embedded message failed validation",
   209  				cause:  err,
   210  			}
   211  		}
   212  	}
   213  
   214  	if v, ok := interface{}(m.GetConfiguration()).(interface{ Validate() error }); ok {
   215  		if err := v.Validate(); err != nil {
   216  			return VmConfigValidationError{
   217  				field:  "Configuration",
   218  				reason: "embedded message failed validation",
   219  				cause:  err,
   220  			}
   221  		}
   222  	}
   223  
   224  	// no validation rules for AllowPrecompiled
   225  
   226  	// no validation rules for NackOnCodeCacheMiss
   227  
   228  	if v, ok := interface{}(m.GetEnvironmentVariables()).(interface{ Validate() error }); ok {
   229  		if err := v.Validate(); err != nil {
   230  			return VmConfigValidationError{
   231  				field:  "EnvironmentVariables",
   232  				reason: "embedded message failed validation",
   233  				cause:  err,
   234  			}
   235  		}
   236  	}
   237  
   238  	return nil
   239  }
   240  
   241  // VmConfigValidationError is the validation error returned by
   242  // VmConfig.Validate if the designated constraints aren't met.
   243  type VmConfigValidationError struct {
   244  	field  string
   245  	reason string
   246  	cause  error
   247  	key    bool
   248  }
   249  
   250  // Field function returns field value.
   251  func (e VmConfigValidationError) Field() string { return e.field }
   252  
   253  // Reason function returns reason value.
   254  func (e VmConfigValidationError) Reason() string { return e.reason }
   255  
   256  // Cause function returns cause value.
   257  func (e VmConfigValidationError) Cause() error { return e.cause }
   258  
   259  // Key function returns key value.
   260  func (e VmConfigValidationError) Key() bool { return e.key }
   261  
   262  // ErrorName returns error name.
   263  func (e VmConfigValidationError) ErrorName() string { return "VmConfigValidationError" }
   264  
   265  // Error satisfies the builtin error interface
   266  func (e VmConfigValidationError) Error() string {
   267  	cause := ""
   268  	if e.cause != nil {
   269  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   270  	}
   271  
   272  	key := ""
   273  	if e.key {
   274  		key = "key for "
   275  	}
   276  
   277  	return fmt.Sprintf(
   278  		"invalid %sVmConfig.%s: %s%s",
   279  		key,
   280  		e.field,
   281  		e.reason,
   282  		cause)
   283  }
   284  
   285  var _ error = VmConfigValidationError{}
   286  
   287  var _ interface {
   288  	Field() string
   289  	Reason() string
   290  	Key() bool
   291  	Cause() error
   292  	ErrorName() string
   293  } = VmConfigValidationError{}
   294  
   295  // Validate checks the field values on EnvironmentVariables with the rules
   296  // defined in the proto definition for this message. If any rules are
   297  // violated, an error is returned.
   298  func (m *EnvironmentVariables) Validate() error {
   299  	if m == nil {
   300  		return nil
   301  	}
   302  
   303  	// no validation rules for KeyValues
   304  
   305  	return nil
   306  }
   307  
   308  // EnvironmentVariablesValidationError is the validation error returned by
   309  // EnvironmentVariables.Validate if the designated constraints aren't met.
   310  type EnvironmentVariablesValidationError struct {
   311  	field  string
   312  	reason string
   313  	cause  error
   314  	key    bool
   315  }
   316  
   317  // Field function returns field value.
   318  func (e EnvironmentVariablesValidationError) Field() string { return e.field }
   319  
   320  // Reason function returns reason value.
   321  func (e EnvironmentVariablesValidationError) Reason() string { return e.reason }
   322  
   323  // Cause function returns cause value.
   324  func (e EnvironmentVariablesValidationError) Cause() error { return e.cause }
   325  
   326  // Key function returns key value.
   327  func (e EnvironmentVariablesValidationError) Key() bool { return e.key }
   328  
   329  // ErrorName returns error name.
   330  func (e EnvironmentVariablesValidationError) ErrorName() string {
   331  	return "EnvironmentVariablesValidationError"
   332  }
   333  
   334  // Error satisfies the builtin error interface
   335  func (e EnvironmentVariablesValidationError) Error() string {
   336  	cause := ""
   337  	if e.cause != nil {
   338  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   339  	}
   340  
   341  	key := ""
   342  	if e.key {
   343  		key = "key for "
   344  	}
   345  
   346  	return fmt.Sprintf(
   347  		"invalid %sEnvironmentVariables.%s: %s%s",
   348  		key,
   349  		e.field,
   350  		e.reason,
   351  		cause)
   352  }
   353  
   354  var _ error = EnvironmentVariablesValidationError{}
   355  
   356  var _ interface {
   357  	Field() string
   358  	Reason() string
   359  	Key() bool
   360  	Cause() error
   361  	ErrorName() string
   362  } = EnvironmentVariablesValidationError{}
   363  
   364  // Validate checks the field values on PluginConfig with the rules defined in
   365  // the proto definition for this message. If any rules are violated, an error
   366  // is returned.
   367  func (m *PluginConfig) Validate() error {
   368  	if m == nil {
   369  		return nil
   370  	}
   371  
   372  	// no validation rules for Name
   373  
   374  	// no validation rules for RootId
   375  
   376  	if v, ok := interface{}(m.GetConfiguration()).(interface{ Validate() error }); ok {
   377  		if err := v.Validate(); err != nil {
   378  			return PluginConfigValidationError{
   379  				field:  "Configuration",
   380  				reason: "embedded message failed validation",
   381  				cause:  err,
   382  			}
   383  		}
   384  	}
   385  
   386  	// no validation rules for FailOpen
   387  
   388  	if v, ok := interface{}(m.GetCapabilityRestrictionConfig()).(interface{ Validate() error }); ok {
   389  		if err := v.Validate(); err != nil {
   390  			return PluginConfigValidationError{
   391  				field:  "CapabilityRestrictionConfig",
   392  				reason: "embedded message failed validation",
   393  				cause:  err,
   394  			}
   395  		}
   396  	}
   397  
   398  	switch m.Vm.(type) {
   399  
   400  	case *PluginConfig_VmConfig:
   401  
   402  		if v, ok := interface{}(m.GetVmConfig()).(interface{ Validate() error }); ok {
   403  			if err := v.Validate(); err != nil {
   404  				return PluginConfigValidationError{
   405  					field:  "VmConfig",
   406  					reason: "embedded message failed validation",
   407  					cause:  err,
   408  				}
   409  			}
   410  		}
   411  
   412  	}
   413  
   414  	return nil
   415  }
   416  
   417  // PluginConfigValidationError is the validation error returned by
   418  // PluginConfig.Validate if the designated constraints aren't met.
   419  type PluginConfigValidationError struct {
   420  	field  string
   421  	reason string
   422  	cause  error
   423  	key    bool
   424  }
   425  
   426  // Field function returns field value.
   427  func (e PluginConfigValidationError) Field() string { return e.field }
   428  
   429  // Reason function returns reason value.
   430  func (e PluginConfigValidationError) Reason() string { return e.reason }
   431  
   432  // Cause function returns cause value.
   433  func (e PluginConfigValidationError) Cause() error { return e.cause }
   434  
   435  // Key function returns key value.
   436  func (e PluginConfigValidationError) Key() bool { return e.key }
   437  
   438  // ErrorName returns error name.
   439  func (e PluginConfigValidationError) ErrorName() string { return "PluginConfigValidationError" }
   440  
   441  // Error satisfies the builtin error interface
   442  func (e PluginConfigValidationError) Error() string {
   443  	cause := ""
   444  	if e.cause != nil {
   445  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   446  	}
   447  
   448  	key := ""
   449  	if e.key {
   450  		key = "key for "
   451  	}
   452  
   453  	return fmt.Sprintf(
   454  		"invalid %sPluginConfig.%s: %s%s",
   455  		key,
   456  		e.field,
   457  		e.reason,
   458  		cause)
   459  }
   460  
   461  var _ error = PluginConfigValidationError{}
   462  
   463  var _ interface {
   464  	Field() string
   465  	Reason() string
   466  	Key() bool
   467  	Cause() error
   468  	ErrorName() string
   469  } = PluginConfigValidationError{}
   470  
   471  // Validate checks the field values on WasmService with the rules defined in
   472  // the proto definition for this message. If any rules are violated, an error
   473  // is returned.
   474  func (m *WasmService) Validate() error {
   475  	if m == nil {
   476  		return nil
   477  	}
   478  
   479  	if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
   480  		if err := v.Validate(); err != nil {
   481  			return WasmServiceValidationError{
   482  				field:  "Config",
   483  				reason: "embedded message failed validation",
   484  				cause:  err,
   485  			}
   486  		}
   487  	}
   488  
   489  	// no validation rules for Singleton
   490  
   491  	return nil
   492  }
   493  
   494  // WasmServiceValidationError is the validation error returned by
   495  // WasmService.Validate if the designated constraints aren't met.
   496  type WasmServiceValidationError struct {
   497  	field  string
   498  	reason string
   499  	cause  error
   500  	key    bool
   501  }
   502  
   503  // Field function returns field value.
   504  func (e WasmServiceValidationError) Field() string { return e.field }
   505  
   506  // Reason function returns reason value.
   507  func (e WasmServiceValidationError) Reason() string { return e.reason }
   508  
   509  // Cause function returns cause value.
   510  func (e WasmServiceValidationError) Cause() error { return e.cause }
   511  
   512  // Key function returns key value.
   513  func (e WasmServiceValidationError) Key() bool { return e.key }
   514  
   515  // ErrorName returns error name.
   516  func (e WasmServiceValidationError) ErrorName() string { return "WasmServiceValidationError" }
   517  
   518  // Error satisfies the builtin error interface
   519  func (e WasmServiceValidationError) Error() string {
   520  	cause := ""
   521  	if e.cause != nil {
   522  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   523  	}
   524  
   525  	key := ""
   526  	if e.key {
   527  		key = "key for "
   528  	}
   529  
   530  	return fmt.Sprintf(
   531  		"invalid %sWasmService.%s: %s%s",
   532  		key,
   533  		e.field,
   534  		e.reason,
   535  		cause)
   536  }
   537  
   538  var _ error = WasmServiceValidationError{}
   539  
   540  var _ interface {
   541  	Field() string
   542  	Reason() string
   543  	Key() bool
   544  	Cause() error
   545  	ErrorName() string
   546  } = WasmServiceValidationError{}