...

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

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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/ratelimit/v3/rls.proto
     3  
     4  package envoy_config_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  	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.ApiVersion(0)
    38  )
    39  
    40  // Validate checks the field values on RateLimitServiceConfig with the rules
    41  // defined in the proto definition for this message. If any rules are
    42  // violated, an error is returned.
    43  func (m *RateLimitServiceConfig) Validate() error {
    44  	if m == nil {
    45  		return nil
    46  	}
    47  
    48  	if m.GetGrpcService() == nil {
    49  		return RateLimitServiceConfigValidationError{
    50  			field:  "GrpcService",
    51  			reason: "value is required",
    52  		}
    53  	}
    54  
    55  	if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
    56  		if err := v.Validate(); err != nil {
    57  			return RateLimitServiceConfigValidationError{
    58  				field:  "GrpcService",
    59  				reason: "embedded message failed validation",
    60  				cause:  err,
    61  			}
    62  		}
    63  	}
    64  
    65  	if _, ok := v3.ApiVersion_name[int32(m.GetTransportApiVersion())]; !ok {
    66  		return RateLimitServiceConfigValidationError{
    67  			field:  "TransportApiVersion",
    68  			reason: "value must be one of the defined enum values",
    69  		}
    70  	}
    71  
    72  	// no validation rules for UseAlpha
    73  
    74  	return nil
    75  }
    76  
    77  // RateLimitServiceConfigValidationError is the validation error returned by
    78  // RateLimitServiceConfig.Validate if the designated constraints aren't met.
    79  type RateLimitServiceConfigValidationError struct {
    80  	field  string
    81  	reason string
    82  	cause  error
    83  	key    bool
    84  }
    85  
    86  // Field function returns field value.
    87  func (e RateLimitServiceConfigValidationError) Field() string { return e.field }
    88  
    89  // Reason function returns reason value.
    90  func (e RateLimitServiceConfigValidationError) Reason() string { return e.reason }
    91  
    92  // Cause function returns cause value.
    93  func (e RateLimitServiceConfigValidationError) Cause() error { return e.cause }
    94  
    95  // Key function returns key value.
    96  func (e RateLimitServiceConfigValidationError) Key() bool { return e.key }
    97  
    98  // ErrorName returns error name.
    99  func (e RateLimitServiceConfigValidationError) ErrorName() string {
   100  	return "RateLimitServiceConfigValidationError"
   101  }
   102  
   103  // Error satisfies the builtin error interface
   104  func (e RateLimitServiceConfigValidationError) Error() string {
   105  	cause := ""
   106  	if e.cause != nil {
   107  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   108  	}
   109  
   110  	key := ""
   111  	if e.key {
   112  		key = "key for "
   113  	}
   114  
   115  	return fmt.Sprintf(
   116  		"invalid %sRateLimitServiceConfig.%s: %s%s",
   117  		key,
   118  		e.field,
   119  		e.reason,
   120  		cause)
   121  }
   122  
   123  var _ error = RateLimitServiceConfigValidationError{}
   124  
   125  var _ interface {
   126  	Field() string
   127  	Reason() string
   128  	Key() bool
   129  	Cause() error
   130  	ErrorName() string
   131  } = RateLimitServiceConfigValidationError{}
   132  

View as plain text