github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/data/core/v2alpha/health_check_event.pb.validate.go (about)

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