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

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