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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/api/v2/discovery.proto
     3  
     4  package envoy_api_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 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  	return nil
   350  }
   351  
   352  // DeltaDiscoveryResponseValidationError is the validation error returned by
   353  // DeltaDiscoveryResponse.Validate if the designated constraints aren't met.
   354  type DeltaDiscoveryResponseValidationError struct {
   355  	field  string
   356  	reason string
   357  	cause  error
   358  	key    bool
   359  }
   360  
   361  // Field function returns field value.
   362  func (e DeltaDiscoveryResponseValidationError) Field() string { return e.field }
   363  
   364  // Reason function returns reason value.
   365  func (e DeltaDiscoveryResponseValidationError) Reason() string { return e.reason }
   366  
   367  // Cause function returns cause value.
   368  func (e DeltaDiscoveryResponseValidationError) Cause() error { return e.cause }
   369  
   370  // Key function returns key value.
   371  func (e DeltaDiscoveryResponseValidationError) Key() bool { return e.key }
   372  
   373  // ErrorName returns error name.
   374  func (e DeltaDiscoveryResponseValidationError) ErrorName() string {
   375  	return "DeltaDiscoveryResponseValidationError"
   376  }
   377  
   378  // Error satisfies the builtin error interface
   379  func (e DeltaDiscoveryResponseValidationError) Error() string {
   380  	cause := ""
   381  	if e.cause != nil {
   382  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   383  	}
   384  
   385  	key := ""
   386  	if e.key {
   387  		key = "key for "
   388  	}
   389  
   390  	return fmt.Sprintf(
   391  		"invalid %sDeltaDiscoveryResponse.%s: %s%s",
   392  		key,
   393  		e.field,
   394  		e.reason,
   395  		cause)
   396  }
   397  
   398  var _ error = DeltaDiscoveryResponseValidationError{}
   399  
   400  var _ interface {
   401  	Field() string
   402  	Reason() string
   403  	Key() bool
   404  	Cause() error
   405  	ErrorName() string
   406  } = DeltaDiscoveryResponseValidationError{}
   407  
   408  // Validate checks the field values on Resource with the rules defined in the
   409  // proto definition for this message. If any rules are violated, an error is returned.
   410  func (m *Resource) Validate() error {
   411  	if m == nil {
   412  		return nil
   413  	}
   414  
   415  	// no validation rules for Name
   416  
   417  	// no validation rules for Version
   418  
   419  	if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok {
   420  		if err := v.Validate(); err != nil {
   421  			return ResourceValidationError{
   422  				field:  "Resource",
   423  				reason: "embedded message failed validation",
   424  				cause:  err,
   425  			}
   426  		}
   427  	}
   428  
   429  	return nil
   430  }
   431  
   432  // ResourceValidationError is the validation error returned by
   433  // Resource.Validate if the designated constraints aren't met.
   434  type ResourceValidationError struct {
   435  	field  string
   436  	reason string
   437  	cause  error
   438  	key    bool
   439  }
   440  
   441  // Field function returns field value.
   442  func (e ResourceValidationError) Field() string { return e.field }
   443  
   444  // Reason function returns reason value.
   445  func (e ResourceValidationError) Reason() string { return e.reason }
   446  
   447  // Cause function returns cause value.
   448  func (e ResourceValidationError) Cause() error { return e.cause }
   449  
   450  // Key function returns key value.
   451  func (e ResourceValidationError) Key() bool { return e.key }
   452  
   453  // ErrorName returns error name.
   454  func (e ResourceValidationError) ErrorName() string { return "ResourceValidationError" }
   455  
   456  // Error satisfies the builtin error interface
   457  func (e ResourceValidationError) Error() string {
   458  	cause := ""
   459  	if e.cause != nil {
   460  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   461  	}
   462  
   463  	key := ""
   464  	if e.key {
   465  		key = "key for "
   466  	}
   467  
   468  	return fmt.Sprintf(
   469  		"invalid %sResource.%s: %s%s",
   470  		key,
   471  		e.field,
   472  		e.reason,
   473  		cause)
   474  }
   475  
   476  var _ error = ResourceValidationError{}
   477  
   478  var _ interface {
   479  	Field() string
   480  	Reason() string
   481  	Key() bool
   482  	Cause() error
   483  	ErrorName() string
   484  } = ResourceValidationError{}