...

Source file src/github.com/datawire/ambassador/v2/pkg/api/envoy/admin/v3/clusters.pb.validate.go

Documentation: github.com/datawire/ambassador/v2/pkg/api/envoy/admin/v3

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/admin/v3/clusters.proto
     3  
     4  package envoy_admin_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  	"github.com/golang/protobuf/ptypes"
    19  
    20  	v3 "github.com/datawire/ambassador/v2/pkg/api/envoy/config/core/v3"
    21  )
    22  
    23  // ensure the imports are used
    24  var (
    25  	_ = bytes.MinRead
    26  	_ = errors.New("")
    27  	_ = fmt.Print
    28  	_ = utf8.UTFMax
    29  	_ = (*regexp.Regexp)(nil)
    30  	_ = (*strings.Reader)(nil)
    31  	_ = net.IPv4len
    32  	_ = time.Duration(0)
    33  	_ = (*url.URL)(nil)
    34  	_ = (*mail.Address)(nil)
    35  	_ = ptypes.DynamicAny{}
    36  
    37  	_ = v3.HealthStatus(0)
    38  )
    39  
    40  // Validate checks the field values on Clusters with the rules defined in the
    41  // proto definition for this message. If any rules are violated, an error is returned.
    42  func (m *Clusters) Validate() error {
    43  	if m == nil {
    44  		return nil
    45  	}
    46  
    47  	for idx, item := range m.GetClusterStatuses() {
    48  		_, _ = idx, item
    49  
    50  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    51  			if err := v.Validate(); err != nil {
    52  				return ClustersValidationError{
    53  					field:  fmt.Sprintf("ClusterStatuses[%v]", idx),
    54  					reason: "embedded message failed validation",
    55  					cause:  err,
    56  				}
    57  			}
    58  		}
    59  
    60  	}
    61  
    62  	return nil
    63  }
    64  
    65  // ClustersValidationError is the validation error returned by
    66  // Clusters.Validate if the designated constraints aren't met.
    67  type ClustersValidationError struct {
    68  	field  string
    69  	reason string
    70  	cause  error
    71  	key    bool
    72  }
    73  
    74  // Field function returns field value.
    75  func (e ClustersValidationError) Field() string { return e.field }
    76  
    77  // Reason function returns reason value.
    78  func (e ClustersValidationError) Reason() string { return e.reason }
    79  
    80  // Cause function returns cause value.
    81  func (e ClustersValidationError) Cause() error { return e.cause }
    82  
    83  // Key function returns key value.
    84  func (e ClustersValidationError) Key() bool { return e.key }
    85  
    86  // ErrorName returns error name.
    87  func (e ClustersValidationError) ErrorName() string { return "ClustersValidationError" }
    88  
    89  // Error satisfies the builtin error interface
    90  func (e ClustersValidationError) Error() string {
    91  	cause := ""
    92  	if e.cause != nil {
    93  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    94  	}
    95  
    96  	key := ""
    97  	if e.key {
    98  		key = "key for "
    99  	}
   100  
   101  	return fmt.Sprintf(
   102  		"invalid %sClusters.%s: %s%s",
   103  		key,
   104  		e.field,
   105  		e.reason,
   106  		cause)
   107  }
   108  
   109  var _ error = ClustersValidationError{}
   110  
   111  var _ interface {
   112  	Field() string
   113  	Reason() string
   114  	Key() bool
   115  	Cause() error
   116  	ErrorName() string
   117  } = ClustersValidationError{}
   118  
   119  // Validate checks the field values on ClusterStatus with the rules defined in
   120  // the proto definition for this message. If any rules are violated, an error
   121  // is returned.
   122  func (m *ClusterStatus) Validate() error {
   123  	if m == nil {
   124  		return nil
   125  	}
   126  
   127  	// no validation rules for Name
   128  
   129  	// no validation rules for AddedViaApi
   130  
   131  	if v, ok := interface{}(m.GetSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
   132  		if err := v.Validate(); err != nil {
   133  			return ClusterStatusValidationError{
   134  				field:  "SuccessRateEjectionThreshold",
   135  				reason: "embedded message failed validation",
   136  				cause:  err,
   137  			}
   138  		}
   139  	}
   140  
   141  	for idx, item := range m.GetHostStatuses() {
   142  		_, _ = idx, item
   143  
   144  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   145  			if err := v.Validate(); err != nil {
   146  				return ClusterStatusValidationError{
   147  					field:  fmt.Sprintf("HostStatuses[%v]", idx),
   148  					reason: "embedded message failed validation",
   149  					cause:  err,
   150  				}
   151  			}
   152  		}
   153  
   154  	}
   155  
   156  	if v, ok := interface{}(m.GetLocalOriginSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
   157  		if err := v.Validate(); err != nil {
   158  			return ClusterStatusValidationError{
   159  				field:  "LocalOriginSuccessRateEjectionThreshold",
   160  				reason: "embedded message failed validation",
   161  				cause:  err,
   162  			}
   163  		}
   164  	}
   165  
   166  	if v, ok := interface{}(m.GetCircuitBreakers()).(interface{ Validate() error }); ok {
   167  		if err := v.Validate(); err != nil {
   168  			return ClusterStatusValidationError{
   169  				field:  "CircuitBreakers",
   170  				reason: "embedded message failed validation",
   171  				cause:  err,
   172  			}
   173  		}
   174  	}
   175  
   176  	return nil
   177  }
   178  
   179  // ClusterStatusValidationError is the validation error returned by
   180  // ClusterStatus.Validate if the designated constraints aren't met.
   181  type ClusterStatusValidationError struct {
   182  	field  string
   183  	reason string
   184  	cause  error
   185  	key    bool
   186  }
   187  
   188  // Field function returns field value.
   189  func (e ClusterStatusValidationError) Field() string { return e.field }
   190  
   191  // Reason function returns reason value.
   192  func (e ClusterStatusValidationError) Reason() string { return e.reason }
   193  
   194  // Cause function returns cause value.
   195  func (e ClusterStatusValidationError) Cause() error { return e.cause }
   196  
   197  // Key function returns key value.
   198  func (e ClusterStatusValidationError) Key() bool { return e.key }
   199  
   200  // ErrorName returns error name.
   201  func (e ClusterStatusValidationError) ErrorName() string { return "ClusterStatusValidationError" }
   202  
   203  // Error satisfies the builtin error interface
   204  func (e ClusterStatusValidationError) Error() string {
   205  	cause := ""
   206  	if e.cause != nil {
   207  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   208  	}
   209  
   210  	key := ""
   211  	if e.key {
   212  		key = "key for "
   213  	}
   214  
   215  	return fmt.Sprintf(
   216  		"invalid %sClusterStatus.%s: %s%s",
   217  		key,
   218  		e.field,
   219  		e.reason,
   220  		cause)
   221  }
   222  
   223  var _ error = ClusterStatusValidationError{}
   224  
   225  var _ interface {
   226  	Field() string
   227  	Reason() string
   228  	Key() bool
   229  	Cause() error
   230  	ErrorName() string
   231  } = ClusterStatusValidationError{}
   232  
   233  // Validate checks the field values on HostStatus with the rules defined in the
   234  // proto definition for this message. If any rules are violated, an error is returned.
   235  func (m *HostStatus) Validate() error {
   236  	if m == nil {
   237  		return nil
   238  	}
   239  
   240  	if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
   241  		if err := v.Validate(); err != nil {
   242  			return HostStatusValidationError{
   243  				field:  "Address",
   244  				reason: "embedded message failed validation",
   245  				cause:  err,
   246  			}
   247  		}
   248  	}
   249  
   250  	for idx, item := range m.GetStats() {
   251  		_, _ = idx, item
   252  
   253  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   254  			if err := v.Validate(); err != nil {
   255  				return HostStatusValidationError{
   256  					field:  fmt.Sprintf("Stats[%v]", idx),
   257  					reason: "embedded message failed validation",
   258  					cause:  err,
   259  				}
   260  			}
   261  		}
   262  
   263  	}
   264  
   265  	if v, ok := interface{}(m.GetHealthStatus()).(interface{ Validate() error }); ok {
   266  		if err := v.Validate(); err != nil {
   267  			return HostStatusValidationError{
   268  				field:  "HealthStatus",
   269  				reason: "embedded message failed validation",
   270  				cause:  err,
   271  			}
   272  		}
   273  	}
   274  
   275  	if v, ok := interface{}(m.GetSuccessRate()).(interface{ Validate() error }); ok {
   276  		if err := v.Validate(); err != nil {
   277  			return HostStatusValidationError{
   278  				field:  "SuccessRate",
   279  				reason: "embedded message failed validation",
   280  				cause:  err,
   281  			}
   282  		}
   283  	}
   284  
   285  	// no validation rules for Weight
   286  
   287  	// no validation rules for Hostname
   288  
   289  	// no validation rules for Priority
   290  
   291  	if v, ok := interface{}(m.GetLocalOriginSuccessRate()).(interface{ Validate() error }); ok {
   292  		if err := v.Validate(); err != nil {
   293  			return HostStatusValidationError{
   294  				field:  "LocalOriginSuccessRate",
   295  				reason: "embedded message failed validation",
   296  				cause:  err,
   297  			}
   298  		}
   299  	}
   300  
   301  	if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
   302  		if err := v.Validate(); err != nil {
   303  			return HostStatusValidationError{
   304  				field:  "Locality",
   305  				reason: "embedded message failed validation",
   306  				cause:  err,
   307  			}
   308  		}
   309  	}
   310  
   311  	return nil
   312  }
   313  
   314  // HostStatusValidationError is the validation error returned by
   315  // HostStatus.Validate if the designated constraints aren't met.
   316  type HostStatusValidationError struct {
   317  	field  string
   318  	reason string
   319  	cause  error
   320  	key    bool
   321  }
   322  
   323  // Field function returns field value.
   324  func (e HostStatusValidationError) Field() string { return e.field }
   325  
   326  // Reason function returns reason value.
   327  func (e HostStatusValidationError) Reason() string { return e.reason }
   328  
   329  // Cause function returns cause value.
   330  func (e HostStatusValidationError) Cause() error { return e.cause }
   331  
   332  // Key function returns key value.
   333  func (e HostStatusValidationError) Key() bool { return e.key }
   334  
   335  // ErrorName returns error name.
   336  func (e HostStatusValidationError) ErrorName() string { return "HostStatusValidationError" }
   337  
   338  // Error satisfies the builtin error interface
   339  func (e HostStatusValidationError) Error() string {
   340  	cause := ""
   341  	if e.cause != nil {
   342  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   343  	}
   344  
   345  	key := ""
   346  	if e.key {
   347  		key = "key for "
   348  	}
   349  
   350  	return fmt.Sprintf(
   351  		"invalid %sHostStatus.%s: %s%s",
   352  		key,
   353  		e.field,
   354  		e.reason,
   355  		cause)
   356  }
   357  
   358  var _ error = HostStatusValidationError{}
   359  
   360  var _ interface {
   361  	Field() string
   362  	Reason() string
   363  	Key() bool
   364  	Cause() error
   365  	ErrorName() string
   366  } = HostStatusValidationError{}
   367  
   368  // Validate checks the field values on HostHealthStatus with the rules defined
   369  // in the proto definition for this message. If any rules are violated, an
   370  // error is returned.
   371  func (m *HostHealthStatus) Validate() error {
   372  	if m == nil {
   373  		return nil
   374  	}
   375  
   376  	// no validation rules for FailedActiveHealthCheck
   377  
   378  	// no validation rules for FailedOutlierCheck
   379  
   380  	// no validation rules for FailedActiveDegradedCheck
   381  
   382  	// no validation rules for PendingDynamicRemoval
   383  
   384  	// no validation rules for PendingActiveHc
   385  
   386  	// no validation rules for EdsHealthStatus
   387  
   388  	return nil
   389  }
   390  
   391  // HostHealthStatusValidationError is the validation error returned by
   392  // HostHealthStatus.Validate if the designated constraints aren't met.
   393  type HostHealthStatusValidationError struct {
   394  	field  string
   395  	reason string
   396  	cause  error
   397  	key    bool
   398  }
   399  
   400  // Field function returns field value.
   401  func (e HostHealthStatusValidationError) Field() string { return e.field }
   402  
   403  // Reason function returns reason value.
   404  func (e HostHealthStatusValidationError) Reason() string { return e.reason }
   405  
   406  // Cause function returns cause value.
   407  func (e HostHealthStatusValidationError) Cause() error { return e.cause }
   408  
   409  // Key function returns key value.
   410  func (e HostHealthStatusValidationError) Key() bool { return e.key }
   411  
   412  // ErrorName returns error name.
   413  func (e HostHealthStatusValidationError) ErrorName() string { return "HostHealthStatusValidationError" }
   414  
   415  // Error satisfies the builtin error interface
   416  func (e HostHealthStatusValidationError) Error() string {
   417  	cause := ""
   418  	if e.cause != nil {
   419  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   420  	}
   421  
   422  	key := ""
   423  	if e.key {
   424  		key = "key for "
   425  	}
   426  
   427  	return fmt.Sprintf(
   428  		"invalid %sHostHealthStatus.%s: %s%s",
   429  		key,
   430  		e.field,
   431  		e.reason,
   432  		cause)
   433  }
   434  
   435  var _ error = HostHealthStatusValidationError{}
   436  
   437  var _ interface {
   438  	Field() string
   439  	Reason() string
   440  	Key() bool
   441  	Cause() error
   442  	ErrorName() string
   443  } = HostHealthStatusValidationError{}
   444  

View as plain text