...

Source file src/github.com/datawire/ambassador/v2/pkg/api/envoy/service/ratelimit/v3/rls.pb.validate.go

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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/ratelimit/v3/rls.proto
     3  
     4  package envoy_service_ratelimit_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  
    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  	_ = ptypes.DynamicAny{}
    34  )
    35  
    36  // Validate checks the field values on RateLimitRequest 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 *RateLimitRequest) Validate() error {
    40  	if m == nil {
    41  		return nil
    42  	}
    43  
    44  	// no validation rules for Domain
    45  
    46  	for idx, item := range m.GetDescriptors() {
    47  		_, _ = idx, item
    48  
    49  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
    50  			if err := v.Validate(); err != nil {
    51  				return RateLimitRequestValidationError{
    52  					field:  fmt.Sprintf("Descriptors[%v]", idx),
    53  					reason: "embedded message failed validation",
    54  					cause:  err,
    55  				}
    56  			}
    57  		}
    58  
    59  	}
    60  
    61  	// no validation rules for HitsAddend
    62  
    63  	return nil
    64  }
    65  
    66  // RateLimitRequestValidationError is the validation error returned by
    67  // RateLimitRequest.Validate if the designated constraints aren't met.
    68  type RateLimitRequestValidationError struct {
    69  	field  string
    70  	reason string
    71  	cause  error
    72  	key    bool
    73  }
    74  
    75  // Field function returns field value.
    76  func (e RateLimitRequestValidationError) Field() string { return e.field }
    77  
    78  // Reason function returns reason value.
    79  func (e RateLimitRequestValidationError) Reason() string { return e.reason }
    80  
    81  // Cause function returns cause value.
    82  func (e RateLimitRequestValidationError) Cause() error { return e.cause }
    83  
    84  // Key function returns key value.
    85  func (e RateLimitRequestValidationError) Key() bool { return e.key }
    86  
    87  // ErrorName returns error name.
    88  func (e RateLimitRequestValidationError) ErrorName() string { return "RateLimitRequestValidationError" }
    89  
    90  // Error satisfies the builtin error interface
    91  func (e RateLimitRequestValidationError) Error() string {
    92  	cause := ""
    93  	if e.cause != nil {
    94  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
    95  	}
    96  
    97  	key := ""
    98  	if e.key {
    99  		key = "key for "
   100  	}
   101  
   102  	return fmt.Sprintf(
   103  		"invalid %sRateLimitRequest.%s: %s%s",
   104  		key,
   105  		e.field,
   106  		e.reason,
   107  		cause)
   108  }
   109  
   110  var _ error = RateLimitRequestValidationError{}
   111  
   112  var _ interface {
   113  	Field() string
   114  	Reason() string
   115  	Key() bool
   116  	Cause() error
   117  	ErrorName() string
   118  } = RateLimitRequestValidationError{}
   119  
   120  // Validate checks the field values on RateLimitResponse with the rules defined
   121  // in the proto definition for this message. If any rules are violated, an
   122  // error is returned.
   123  func (m *RateLimitResponse) Validate() error {
   124  	if m == nil {
   125  		return nil
   126  	}
   127  
   128  	// no validation rules for OverallCode
   129  
   130  	for idx, item := range m.GetStatuses() {
   131  		_, _ = idx, item
   132  
   133  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   134  			if err := v.Validate(); err != nil {
   135  				return RateLimitResponseValidationError{
   136  					field:  fmt.Sprintf("Statuses[%v]", idx),
   137  					reason: "embedded message failed validation",
   138  					cause:  err,
   139  				}
   140  			}
   141  		}
   142  
   143  	}
   144  
   145  	for idx, item := range m.GetResponseHeadersToAdd() {
   146  		_, _ = idx, item
   147  
   148  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   149  			if err := v.Validate(); err != nil {
   150  				return RateLimitResponseValidationError{
   151  					field:  fmt.Sprintf("ResponseHeadersToAdd[%v]", idx),
   152  					reason: "embedded message failed validation",
   153  					cause:  err,
   154  				}
   155  			}
   156  		}
   157  
   158  	}
   159  
   160  	for idx, item := range m.GetRequestHeadersToAdd() {
   161  		_, _ = idx, item
   162  
   163  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   164  			if err := v.Validate(); err != nil {
   165  				return RateLimitResponseValidationError{
   166  					field:  fmt.Sprintf("RequestHeadersToAdd[%v]", idx),
   167  					reason: "embedded message failed validation",
   168  					cause:  err,
   169  				}
   170  			}
   171  		}
   172  
   173  	}
   174  
   175  	// no validation rules for RawBody
   176  
   177  	if v, ok := interface{}(m.GetDynamicMetadata()).(interface{ Validate() error }); ok {
   178  		if err := v.Validate(); err != nil {
   179  			return RateLimitResponseValidationError{
   180  				field:  "DynamicMetadata",
   181  				reason: "embedded message failed validation",
   182  				cause:  err,
   183  			}
   184  		}
   185  	}
   186  
   187  	return nil
   188  }
   189  
   190  // RateLimitResponseValidationError is the validation error returned by
   191  // RateLimitResponse.Validate if the designated constraints aren't met.
   192  type RateLimitResponseValidationError struct {
   193  	field  string
   194  	reason string
   195  	cause  error
   196  	key    bool
   197  }
   198  
   199  // Field function returns field value.
   200  func (e RateLimitResponseValidationError) Field() string { return e.field }
   201  
   202  // Reason function returns reason value.
   203  func (e RateLimitResponseValidationError) Reason() string { return e.reason }
   204  
   205  // Cause function returns cause value.
   206  func (e RateLimitResponseValidationError) Cause() error { return e.cause }
   207  
   208  // Key function returns key value.
   209  func (e RateLimitResponseValidationError) Key() bool { return e.key }
   210  
   211  // ErrorName returns error name.
   212  func (e RateLimitResponseValidationError) ErrorName() string {
   213  	return "RateLimitResponseValidationError"
   214  }
   215  
   216  // Error satisfies the builtin error interface
   217  func (e RateLimitResponseValidationError) Error() string {
   218  	cause := ""
   219  	if e.cause != nil {
   220  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   221  	}
   222  
   223  	key := ""
   224  	if e.key {
   225  		key = "key for "
   226  	}
   227  
   228  	return fmt.Sprintf(
   229  		"invalid %sRateLimitResponse.%s: %s%s",
   230  		key,
   231  		e.field,
   232  		e.reason,
   233  		cause)
   234  }
   235  
   236  var _ error = RateLimitResponseValidationError{}
   237  
   238  var _ interface {
   239  	Field() string
   240  	Reason() string
   241  	Key() bool
   242  	Cause() error
   243  	ErrorName() string
   244  } = RateLimitResponseValidationError{}
   245  
   246  // Validate checks the field values on RateLimitResponse_RateLimit with the
   247  // rules defined in the proto definition for this message. If any rules are
   248  // violated, an error is returned.
   249  func (m *RateLimitResponse_RateLimit) Validate() error {
   250  	if m == nil {
   251  		return nil
   252  	}
   253  
   254  	// no validation rules for Name
   255  
   256  	// no validation rules for RequestsPerUnit
   257  
   258  	// no validation rules for Unit
   259  
   260  	return nil
   261  }
   262  
   263  // RateLimitResponse_RateLimitValidationError is the validation error returned
   264  // by RateLimitResponse_RateLimit.Validate if the designated constraints
   265  // aren't met.
   266  type RateLimitResponse_RateLimitValidationError struct {
   267  	field  string
   268  	reason string
   269  	cause  error
   270  	key    bool
   271  }
   272  
   273  // Field function returns field value.
   274  func (e RateLimitResponse_RateLimitValidationError) Field() string { return e.field }
   275  
   276  // Reason function returns reason value.
   277  func (e RateLimitResponse_RateLimitValidationError) Reason() string { return e.reason }
   278  
   279  // Cause function returns cause value.
   280  func (e RateLimitResponse_RateLimitValidationError) Cause() error { return e.cause }
   281  
   282  // Key function returns key value.
   283  func (e RateLimitResponse_RateLimitValidationError) Key() bool { return e.key }
   284  
   285  // ErrorName returns error name.
   286  func (e RateLimitResponse_RateLimitValidationError) ErrorName() string {
   287  	return "RateLimitResponse_RateLimitValidationError"
   288  }
   289  
   290  // Error satisfies the builtin error interface
   291  func (e RateLimitResponse_RateLimitValidationError) 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 %sRateLimitResponse_RateLimit.%s: %s%s",
   304  		key,
   305  		e.field,
   306  		e.reason,
   307  		cause)
   308  }
   309  
   310  var _ error = RateLimitResponse_RateLimitValidationError{}
   311  
   312  var _ interface {
   313  	Field() string
   314  	Reason() string
   315  	Key() bool
   316  	Cause() error
   317  	ErrorName() string
   318  } = RateLimitResponse_RateLimitValidationError{}
   319  
   320  // Validate checks the field values on RateLimitResponse_DescriptorStatus with
   321  // the rules defined in the proto definition for this message. If any rules
   322  // are violated, an error is returned.
   323  func (m *RateLimitResponse_DescriptorStatus) Validate() error {
   324  	if m == nil {
   325  		return nil
   326  	}
   327  
   328  	// no validation rules for Code
   329  
   330  	if v, ok := interface{}(m.GetCurrentLimit()).(interface{ Validate() error }); ok {
   331  		if err := v.Validate(); err != nil {
   332  			return RateLimitResponse_DescriptorStatusValidationError{
   333  				field:  "CurrentLimit",
   334  				reason: "embedded message failed validation",
   335  				cause:  err,
   336  			}
   337  		}
   338  	}
   339  
   340  	// no validation rules for LimitRemaining
   341  
   342  	if v, ok := interface{}(m.GetDurationUntilReset()).(interface{ Validate() error }); ok {
   343  		if err := v.Validate(); err != nil {
   344  			return RateLimitResponse_DescriptorStatusValidationError{
   345  				field:  "DurationUntilReset",
   346  				reason: "embedded message failed validation",
   347  				cause:  err,
   348  			}
   349  		}
   350  	}
   351  
   352  	return nil
   353  }
   354  
   355  // RateLimitResponse_DescriptorStatusValidationError is the validation error
   356  // returned by RateLimitResponse_DescriptorStatus.Validate if the designated
   357  // constraints aren't met.
   358  type RateLimitResponse_DescriptorStatusValidationError struct {
   359  	field  string
   360  	reason string
   361  	cause  error
   362  	key    bool
   363  }
   364  
   365  // Field function returns field value.
   366  func (e RateLimitResponse_DescriptorStatusValidationError) Field() string { return e.field }
   367  
   368  // Reason function returns reason value.
   369  func (e RateLimitResponse_DescriptorStatusValidationError) Reason() string { return e.reason }
   370  
   371  // Cause function returns cause value.
   372  func (e RateLimitResponse_DescriptorStatusValidationError) Cause() error { return e.cause }
   373  
   374  // Key function returns key value.
   375  func (e RateLimitResponse_DescriptorStatusValidationError) Key() bool { return e.key }
   376  
   377  // ErrorName returns error name.
   378  func (e RateLimitResponse_DescriptorStatusValidationError) ErrorName() string {
   379  	return "RateLimitResponse_DescriptorStatusValidationError"
   380  }
   381  
   382  // Error satisfies the builtin error interface
   383  func (e RateLimitResponse_DescriptorStatusValidationError) Error() string {
   384  	cause := ""
   385  	if e.cause != nil {
   386  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   387  	}
   388  
   389  	key := ""
   390  	if e.key {
   391  		key = "key for "
   392  	}
   393  
   394  	return fmt.Sprintf(
   395  		"invalid %sRateLimitResponse_DescriptorStatus.%s: %s%s",
   396  		key,
   397  		e.field,
   398  		e.reason,
   399  		cause)
   400  }
   401  
   402  var _ error = RateLimitResponse_DescriptorStatusValidationError{}
   403  
   404  var _ interface {
   405  	Field() string
   406  	Reason() string
   407  	Key() bool
   408  	Cause() error
   409  	ErrorName() string
   410  } = RateLimitResponse_DescriptorStatusValidationError{}
   411  

View as plain text