...

Source file src/github.com/datawire/ambassador/v2/pkg/api/envoy/service/auth/v4alpha/external_auth.pb.validate.go

Documentation: github.com/datawire/ambassador/v2/pkg/api/envoy/service/auth/v4alpha

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

View as plain text