github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/service/auth/v2/external_auth.pb.validate.go (about)

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/service/auth/v2/external_auth.proto
     3  
     4  package envoy_service_auth_v2
     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 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  	return nil
   236  }
   237  
   238  // OkHttpResponseValidationError is the validation error returned by
   239  // OkHttpResponse.Validate if the designated constraints aren't met.
   240  type OkHttpResponseValidationError struct {
   241  	field  string
   242  	reason string
   243  	cause  error
   244  	key    bool
   245  }
   246  
   247  // Field function returns field value.
   248  func (e OkHttpResponseValidationError) Field() string { return e.field }
   249  
   250  // Reason function returns reason value.
   251  func (e OkHttpResponseValidationError) Reason() string { return e.reason }
   252  
   253  // Cause function returns cause value.
   254  func (e OkHttpResponseValidationError) Cause() error { return e.cause }
   255  
   256  // Key function returns key value.
   257  func (e OkHttpResponseValidationError) Key() bool { return e.key }
   258  
   259  // ErrorName returns error name.
   260  func (e OkHttpResponseValidationError) ErrorName() string { return "OkHttpResponseValidationError" }
   261  
   262  // Error satisfies the builtin error interface
   263  func (e OkHttpResponseValidationError) Error() string {
   264  	cause := ""
   265  	if e.cause != nil {
   266  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   267  	}
   268  
   269  	key := ""
   270  	if e.key {
   271  		key = "key for "
   272  	}
   273  
   274  	return fmt.Sprintf(
   275  		"invalid %sOkHttpResponse.%s: %s%s",
   276  		key,
   277  		e.field,
   278  		e.reason,
   279  		cause)
   280  }
   281  
   282  var _ error = OkHttpResponseValidationError{}
   283  
   284  var _ interface {
   285  	Field() string
   286  	Reason() string
   287  	Key() bool
   288  	Cause() error
   289  	ErrorName() string
   290  } = OkHttpResponseValidationError{}
   291  
   292  // Validate checks the field values on CheckResponse with the rules defined in
   293  // the proto definition for this message. If any rules are violated, an error
   294  // is returned.
   295  func (m *CheckResponse) Validate() error {
   296  	if m == nil {
   297  		return nil
   298  	}
   299  
   300  	if v, ok := interface{}(m.GetStatus()).(interface{ Validate() error }); ok {
   301  		if err := v.Validate(); err != nil {
   302  			return CheckResponseValidationError{
   303  				field:  "Status",
   304  				reason: "embedded message failed validation",
   305  				cause:  err,
   306  			}
   307  		}
   308  	}
   309  
   310  	switch m.HttpResponse.(type) {
   311  
   312  	case *CheckResponse_DeniedResponse:
   313  
   314  		if v, ok := interface{}(m.GetDeniedResponse()).(interface{ Validate() error }); ok {
   315  			if err := v.Validate(); err != nil {
   316  				return CheckResponseValidationError{
   317  					field:  "DeniedResponse",
   318  					reason: "embedded message failed validation",
   319  					cause:  err,
   320  				}
   321  			}
   322  		}
   323  
   324  	case *CheckResponse_OkResponse:
   325  
   326  		if v, ok := interface{}(m.GetOkResponse()).(interface{ Validate() error }); ok {
   327  			if err := v.Validate(); err != nil {
   328  				return CheckResponseValidationError{
   329  					field:  "OkResponse",
   330  					reason: "embedded message failed validation",
   331  					cause:  err,
   332  				}
   333  			}
   334  		}
   335  
   336  	}
   337  
   338  	return nil
   339  }
   340  
   341  // CheckResponseValidationError is the validation error returned by
   342  // CheckResponse.Validate if the designated constraints aren't met.
   343  type CheckResponseValidationError struct {
   344  	field  string
   345  	reason string
   346  	cause  error
   347  	key    bool
   348  }
   349  
   350  // Field function returns field value.
   351  func (e CheckResponseValidationError) Field() string { return e.field }
   352  
   353  // Reason function returns reason value.
   354  func (e CheckResponseValidationError) Reason() string { return e.reason }
   355  
   356  // Cause function returns cause value.
   357  func (e CheckResponseValidationError) Cause() error { return e.cause }
   358  
   359  // Key function returns key value.
   360  func (e CheckResponseValidationError) Key() bool { return e.key }
   361  
   362  // ErrorName returns error name.
   363  func (e CheckResponseValidationError) ErrorName() string { return "CheckResponseValidationError" }
   364  
   365  // Error satisfies the builtin error interface
   366  func (e CheckResponseValidationError) Error() string {
   367  	cause := ""
   368  	if e.cause != nil {
   369  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   370  	}
   371  
   372  	key := ""
   373  	if e.key {
   374  		key = "key for "
   375  	}
   376  
   377  	return fmt.Sprintf(
   378  		"invalid %sCheckResponse.%s: %s%s",
   379  		key,
   380  		e.field,
   381  		e.reason,
   382  		cause)
   383  }
   384  
   385  var _ error = CheckResponseValidationError{}
   386  
   387  var _ interface {
   388  	Field() string
   389  	Reason() string
   390  	Key() bool
   391  	Cause() error
   392  	ErrorName() string
   393  } = CheckResponseValidationError{}