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

     1  // Code generated by protoc-gen-validate. DO NOT EDIT.
     2  // source: envoy/config/rbac/v2/rbac.proto
     3  
     4  package envoy_config_rbac_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 RBAC with the rules defined in the proto
    37  // definition for this message. If any rules are violated, an error is returned.
    38  func (m *RBAC) Validate() error {
    39  	if m == nil {
    40  		return nil
    41  	}
    42  
    43  	// no validation rules for Action
    44  
    45  	for key, val := range m.GetPolicies() {
    46  		_ = val
    47  
    48  		// no validation rules for Policies[key]
    49  
    50  		if v, ok := interface{}(val).(interface{ Validate() error }); ok {
    51  			if err := v.Validate(); err != nil {
    52  				return RBACValidationError{
    53  					field:  fmt.Sprintf("Policies[%v]", key),
    54  					reason: "embedded message failed validation",
    55  					cause:  err,
    56  				}
    57  			}
    58  		}
    59  
    60  	}
    61  
    62  	return nil
    63  }
    64  
    65  // RBACValidationError is the validation error returned by RBAC.Validate if the
    66  // designated constraints aren't met.
    67  type RBACValidationError struct {
    68  	field  string
    69  	reason string
    70  	cause  error
    71  	key    bool
    72  }
    73  
    74  // Field function returns field value.
    75  func (e RBACValidationError) Field() string { return e.field }
    76  
    77  // Reason function returns reason value.
    78  func (e RBACValidationError) Reason() string { return e.reason }
    79  
    80  // Cause function returns cause value.
    81  func (e RBACValidationError) Cause() error { return e.cause }
    82  
    83  // Key function returns key value.
    84  func (e RBACValidationError) Key() bool { return e.key }
    85  
    86  // ErrorName returns error name.
    87  func (e RBACValidationError) ErrorName() string { return "RBACValidationError" }
    88  
    89  // Error satisfies the builtin error interface
    90  func (e RBACValidationError) 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 %sRBAC.%s: %s%s",
   103  		key,
   104  		e.field,
   105  		e.reason,
   106  		cause)
   107  }
   108  
   109  var _ error = RBACValidationError{}
   110  
   111  var _ interface {
   112  	Field() string
   113  	Reason() string
   114  	Key() bool
   115  	Cause() error
   116  	ErrorName() string
   117  } = RBACValidationError{}
   118  
   119  // Validate checks the field values on Policy with the rules defined in the
   120  // proto definition for this message. If any rules are violated, an error is returned.
   121  func (m *Policy) Validate() error {
   122  	if m == nil {
   123  		return nil
   124  	}
   125  
   126  	if len(m.GetPermissions()) < 1 {
   127  		return PolicyValidationError{
   128  			field:  "Permissions",
   129  			reason: "value must contain at least 1 item(s)",
   130  		}
   131  	}
   132  
   133  	for idx, item := range m.GetPermissions() {
   134  		_, _ = idx, item
   135  
   136  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   137  			if err := v.Validate(); err != nil {
   138  				return PolicyValidationError{
   139  					field:  fmt.Sprintf("Permissions[%v]", idx),
   140  					reason: "embedded message failed validation",
   141  					cause:  err,
   142  				}
   143  			}
   144  		}
   145  
   146  	}
   147  
   148  	if len(m.GetPrincipals()) < 1 {
   149  		return PolicyValidationError{
   150  			field:  "Principals",
   151  			reason: "value must contain at least 1 item(s)",
   152  		}
   153  	}
   154  
   155  	for idx, item := range m.GetPrincipals() {
   156  		_, _ = idx, item
   157  
   158  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   159  			if err := v.Validate(); err != nil {
   160  				return PolicyValidationError{
   161  					field:  fmt.Sprintf("Principals[%v]", idx),
   162  					reason: "embedded message failed validation",
   163  					cause:  err,
   164  				}
   165  			}
   166  		}
   167  
   168  	}
   169  
   170  	if v, ok := interface{}(m.GetCondition()).(interface{ Validate() error }); ok {
   171  		if err := v.Validate(); err != nil {
   172  			return PolicyValidationError{
   173  				field:  "Condition",
   174  				reason: "embedded message failed validation",
   175  				cause:  err,
   176  			}
   177  		}
   178  	}
   179  
   180  	return nil
   181  }
   182  
   183  // PolicyValidationError is the validation error returned by Policy.Validate if
   184  // the designated constraints aren't met.
   185  type PolicyValidationError struct {
   186  	field  string
   187  	reason string
   188  	cause  error
   189  	key    bool
   190  }
   191  
   192  // Field function returns field value.
   193  func (e PolicyValidationError) Field() string { return e.field }
   194  
   195  // Reason function returns reason value.
   196  func (e PolicyValidationError) Reason() string { return e.reason }
   197  
   198  // Cause function returns cause value.
   199  func (e PolicyValidationError) Cause() error { return e.cause }
   200  
   201  // Key function returns key value.
   202  func (e PolicyValidationError) Key() bool { return e.key }
   203  
   204  // ErrorName returns error name.
   205  func (e PolicyValidationError) ErrorName() string { return "PolicyValidationError" }
   206  
   207  // Error satisfies the builtin error interface
   208  func (e PolicyValidationError) Error() string {
   209  	cause := ""
   210  	if e.cause != nil {
   211  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   212  	}
   213  
   214  	key := ""
   215  	if e.key {
   216  		key = "key for "
   217  	}
   218  
   219  	return fmt.Sprintf(
   220  		"invalid %sPolicy.%s: %s%s",
   221  		key,
   222  		e.field,
   223  		e.reason,
   224  		cause)
   225  }
   226  
   227  var _ error = PolicyValidationError{}
   228  
   229  var _ interface {
   230  	Field() string
   231  	Reason() string
   232  	Key() bool
   233  	Cause() error
   234  	ErrorName() string
   235  } = PolicyValidationError{}
   236  
   237  // Validate checks the field values on Permission with the rules defined in the
   238  // proto definition for this message. If any rules are violated, an error is returned.
   239  func (m *Permission) Validate() error {
   240  	if m == nil {
   241  		return nil
   242  	}
   243  
   244  	switch m.Rule.(type) {
   245  
   246  	case *Permission_AndRules:
   247  
   248  		if v, ok := interface{}(m.GetAndRules()).(interface{ Validate() error }); ok {
   249  			if err := v.Validate(); err != nil {
   250  				return PermissionValidationError{
   251  					field:  "AndRules",
   252  					reason: "embedded message failed validation",
   253  					cause:  err,
   254  				}
   255  			}
   256  		}
   257  
   258  	case *Permission_OrRules:
   259  
   260  		if v, ok := interface{}(m.GetOrRules()).(interface{ Validate() error }); ok {
   261  			if err := v.Validate(); err != nil {
   262  				return PermissionValidationError{
   263  					field:  "OrRules",
   264  					reason: "embedded message failed validation",
   265  					cause:  err,
   266  				}
   267  			}
   268  		}
   269  
   270  	case *Permission_Any:
   271  
   272  		if m.GetAny() != true {
   273  			return PermissionValidationError{
   274  				field:  "Any",
   275  				reason: "value must equal true",
   276  			}
   277  		}
   278  
   279  	case *Permission_Header:
   280  
   281  		if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
   282  			if err := v.Validate(); err != nil {
   283  				return PermissionValidationError{
   284  					field:  "Header",
   285  					reason: "embedded message failed validation",
   286  					cause:  err,
   287  				}
   288  			}
   289  		}
   290  
   291  	case *Permission_UrlPath:
   292  
   293  		if v, ok := interface{}(m.GetUrlPath()).(interface{ Validate() error }); ok {
   294  			if err := v.Validate(); err != nil {
   295  				return PermissionValidationError{
   296  					field:  "UrlPath",
   297  					reason: "embedded message failed validation",
   298  					cause:  err,
   299  				}
   300  			}
   301  		}
   302  
   303  	case *Permission_DestinationIp:
   304  
   305  		if v, ok := interface{}(m.GetDestinationIp()).(interface{ Validate() error }); ok {
   306  			if err := v.Validate(); err != nil {
   307  				return PermissionValidationError{
   308  					field:  "DestinationIp",
   309  					reason: "embedded message failed validation",
   310  					cause:  err,
   311  				}
   312  			}
   313  		}
   314  
   315  	case *Permission_DestinationPort:
   316  
   317  		if m.GetDestinationPort() > 65535 {
   318  			return PermissionValidationError{
   319  				field:  "DestinationPort",
   320  				reason: "value must be less than or equal to 65535",
   321  			}
   322  		}
   323  
   324  	case *Permission_Metadata:
   325  
   326  		if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   327  			if err := v.Validate(); err != nil {
   328  				return PermissionValidationError{
   329  					field:  "Metadata",
   330  					reason: "embedded message failed validation",
   331  					cause:  err,
   332  				}
   333  			}
   334  		}
   335  
   336  	case *Permission_NotRule:
   337  
   338  		if v, ok := interface{}(m.GetNotRule()).(interface{ Validate() error }); ok {
   339  			if err := v.Validate(); err != nil {
   340  				return PermissionValidationError{
   341  					field:  "NotRule",
   342  					reason: "embedded message failed validation",
   343  					cause:  err,
   344  				}
   345  			}
   346  		}
   347  
   348  	case *Permission_RequestedServerName:
   349  
   350  		if v, ok := interface{}(m.GetRequestedServerName()).(interface{ Validate() error }); ok {
   351  			if err := v.Validate(); err != nil {
   352  				return PermissionValidationError{
   353  					field:  "RequestedServerName",
   354  					reason: "embedded message failed validation",
   355  					cause:  err,
   356  				}
   357  			}
   358  		}
   359  
   360  	default:
   361  		return PermissionValidationError{
   362  			field:  "Rule",
   363  			reason: "value is required",
   364  		}
   365  
   366  	}
   367  
   368  	return nil
   369  }
   370  
   371  // PermissionValidationError is the validation error returned by
   372  // Permission.Validate if the designated constraints aren't met.
   373  type PermissionValidationError struct {
   374  	field  string
   375  	reason string
   376  	cause  error
   377  	key    bool
   378  }
   379  
   380  // Field function returns field value.
   381  func (e PermissionValidationError) Field() string { return e.field }
   382  
   383  // Reason function returns reason value.
   384  func (e PermissionValidationError) Reason() string { return e.reason }
   385  
   386  // Cause function returns cause value.
   387  func (e PermissionValidationError) Cause() error { return e.cause }
   388  
   389  // Key function returns key value.
   390  func (e PermissionValidationError) Key() bool { return e.key }
   391  
   392  // ErrorName returns error name.
   393  func (e PermissionValidationError) ErrorName() string { return "PermissionValidationError" }
   394  
   395  // Error satisfies the builtin error interface
   396  func (e PermissionValidationError) Error() string {
   397  	cause := ""
   398  	if e.cause != nil {
   399  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   400  	}
   401  
   402  	key := ""
   403  	if e.key {
   404  		key = "key for "
   405  	}
   406  
   407  	return fmt.Sprintf(
   408  		"invalid %sPermission.%s: %s%s",
   409  		key,
   410  		e.field,
   411  		e.reason,
   412  		cause)
   413  }
   414  
   415  var _ error = PermissionValidationError{}
   416  
   417  var _ interface {
   418  	Field() string
   419  	Reason() string
   420  	Key() bool
   421  	Cause() error
   422  	ErrorName() string
   423  } = PermissionValidationError{}
   424  
   425  // Validate checks the field values on Principal with the rules defined in the
   426  // proto definition for this message. If any rules are violated, an error is returned.
   427  func (m *Principal) Validate() error {
   428  	if m == nil {
   429  		return nil
   430  	}
   431  
   432  	switch m.Identifier.(type) {
   433  
   434  	case *Principal_AndIds:
   435  
   436  		if v, ok := interface{}(m.GetAndIds()).(interface{ Validate() error }); ok {
   437  			if err := v.Validate(); err != nil {
   438  				return PrincipalValidationError{
   439  					field:  "AndIds",
   440  					reason: "embedded message failed validation",
   441  					cause:  err,
   442  				}
   443  			}
   444  		}
   445  
   446  	case *Principal_OrIds:
   447  
   448  		if v, ok := interface{}(m.GetOrIds()).(interface{ Validate() error }); ok {
   449  			if err := v.Validate(); err != nil {
   450  				return PrincipalValidationError{
   451  					field:  "OrIds",
   452  					reason: "embedded message failed validation",
   453  					cause:  err,
   454  				}
   455  			}
   456  		}
   457  
   458  	case *Principal_Any:
   459  
   460  		if m.GetAny() != true {
   461  			return PrincipalValidationError{
   462  				field:  "Any",
   463  				reason: "value must equal true",
   464  			}
   465  		}
   466  
   467  	case *Principal_Authenticated_:
   468  
   469  		if v, ok := interface{}(m.GetAuthenticated()).(interface{ Validate() error }); ok {
   470  			if err := v.Validate(); err != nil {
   471  				return PrincipalValidationError{
   472  					field:  "Authenticated",
   473  					reason: "embedded message failed validation",
   474  					cause:  err,
   475  				}
   476  			}
   477  		}
   478  
   479  	case *Principal_SourceIp:
   480  
   481  		if v, ok := interface{}(m.GetSourceIp()).(interface{ Validate() error }); ok {
   482  			if err := v.Validate(); err != nil {
   483  				return PrincipalValidationError{
   484  					field:  "SourceIp",
   485  					reason: "embedded message failed validation",
   486  					cause:  err,
   487  				}
   488  			}
   489  		}
   490  
   491  	case *Principal_DirectRemoteIp:
   492  
   493  		if v, ok := interface{}(m.GetDirectRemoteIp()).(interface{ Validate() error }); ok {
   494  			if err := v.Validate(); err != nil {
   495  				return PrincipalValidationError{
   496  					field:  "DirectRemoteIp",
   497  					reason: "embedded message failed validation",
   498  					cause:  err,
   499  				}
   500  			}
   501  		}
   502  
   503  	case *Principal_RemoteIp:
   504  
   505  		if v, ok := interface{}(m.GetRemoteIp()).(interface{ Validate() error }); ok {
   506  			if err := v.Validate(); err != nil {
   507  				return PrincipalValidationError{
   508  					field:  "RemoteIp",
   509  					reason: "embedded message failed validation",
   510  					cause:  err,
   511  				}
   512  			}
   513  		}
   514  
   515  	case *Principal_Header:
   516  
   517  		if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
   518  			if err := v.Validate(); err != nil {
   519  				return PrincipalValidationError{
   520  					field:  "Header",
   521  					reason: "embedded message failed validation",
   522  					cause:  err,
   523  				}
   524  			}
   525  		}
   526  
   527  	case *Principal_UrlPath:
   528  
   529  		if v, ok := interface{}(m.GetUrlPath()).(interface{ Validate() error }); ok {
   530  			if err := v.Validate(); err != nil {
   531  				return PrincipalValidationError{
   532  					field:  "UrlPath",
   533  					reason: "embedded message failed validation",
   534  					cause:  err,
   535  				}
   536  			}
   537  		}
   538  
   539  	case *Principal_Metadata:
   540  
   541  		if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
   542  			if err := v.Validate(); err != nil {
   543  				return PrincipalValidationError{
   544  					field:  "Metadata",
   545  					reason: "embedded message failed validation",
   546  					cause:  err,
   547  				}
   548  			}
   549  		}
   550  
   551  	case *Principal_NotId:
   552  
   553  		if v, ok := interface{}(m.GetNotId()).(interface{ Validate() error }); ok {
   554  			if err := v.Validate(); err != nil {
   555  				return PrincipalValidationError{
   556  					field:  "NotId",
   557  					reason: "embedded message failed validation",
   558  					cause:  err,
   559  				}
   560  			}
   561  		}
   562  
   563  	default:
   564  		return PrincipalValidationError{
   565  			field:  "Identifier",
   566  			reason: "value is required",
   567  		}
   568  
   569  	}
   570  
   571  	return nil
   572  }
   573  
   574  // PrincipalValidationError is the validation error returned by
   575  // Principal.Validate if the designated constraints aren't met.
   576  type PrincipalValidationError struct {
   577  	field  string
   578  	reason string
   579  	cause  error
   580  	key    bool
   581  }
   582  
   583  // Field function returns field value.
   584  func (e PrincipalValidationError) Field() string { return e.field }
   585  
   586  // Reason function returns reason value.
   587  func (e PrincipalValidationError) Reason() string { return e.reason }
   588  
   589  // Cause function returns cause value.
   590  func (e PrincipalValidationError) Cause() error { return e.cause }
   591  
   592  // Key function returns key value.
   593  func (e PrincipalValidationError) Key() bool { return e.key }
   594  
   595  // ErrorName returns error name.
   596  func (e PrincipalValidationError) ErrorName() string { return "PrincipalValidationError" }
   597  
   598  // Error satisfies the builtin error interface
   599  func (e PrincipalValidationError) Error() string {
   600  	cause := ""
   601  	if e.cause != nil {
   602  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   603  	}
   604  
   605  	key := ""
   606  	if e.key {
   607  		key = "key for "
   608  	}
   609  
   610  	return fmt.Sprintf(
   611  		"invalid %sPrincipal.%s: %s%s",
   612  		key,
   613  		e.field,
   614  		e.reason,
   615  		cause)
   616  }
   617  
   618  var _ error = PrincipalValidationError{}
   619  
   620  var _ interface {
   621  	Field() string
   622  	Reason() string
   623  	Key() bool
   624  	Cause() error
   625  	ErrorName() string
   626  } = PrincipalValidationError{}
   627  
   628  // Validate checks the field values on Permission_Set with the rules defined in
   629  // the proto definition for this message. If any rules are violated, an error
   630  // is returned.
   631  func (m *Permission_Set) Validate() error {
   632  	if m == nil {
   633  		return nil
   634  	}
   635  
   636  	if len(m.GetRules()) < 1 {
   637  		return Permission_SetValidationError{
   638  			field:  "Rules",
   639  			reason: "value must contain at least 1 item(s)",
   640  		}
   641  	}
   642  
   643  	for idx, item := range m.GetRules() {
   644  		_, _ = idx, item
   645  
   646  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   647  			if err := v.Validate(); err != nil {
   648  				return Permission_SetValidationError{
   649  					field:  fmt.Sprintf("Rules[%v]", idx),
   650  					reason: "embedded message failed validation",
   651  					cause:  err,
   652  				}
   653  			}
   654  		}
   655  
   656  	}
   657  
   658  	return nil
   659  }
   660  
   661  // Permission_SetValidationError is the validation error returned by
   662  // Permission_Set.Validate if the designated constraints aren't met.
   663  type Permission_SetValidationError struct {
   664  	field  string
   665  	reason string
   666  	cause  error
   667  	key    bool
   668  }
   669  
   670  // Field function returns field value.
   671  func (e Permission_SetValidationError) Field() string { return e.field }
   672  
   673  // Reason function returns reason value.
   674  func (e Permission_SetValidationError) Reason() string { return e.reason }
   675  
   676  // Cause function returns cause value.
   677  func (e Permission_SetValidationError) Cause() error { return e.cause }
   678  
   679  // Key function returns key value.
   680  func (e Permission_SetValidationError) Key() bool { return e.key }
   681  
   682  // ErrorName returns error name.
   683  func (e Permission_SetValidationError) ErrorName() string { return "Permission_SetValidationError" }
   684  
   685  // Error satisfies the builtin error interface
   686  func (e Permission_SetValidationError) Error() string {
   687  	cause := ""
   688  	if e.cause != nil {
   689  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   690  	}
   691  
   692  	key := ""
   693  	if e.key {
   694  		key = "key for "
   695  	}
   696  
   697  	return fmt.Sprintf(
   698  		"invalid %sPermission_Set.%s: %s%s",
   699  		key,
   700  		e.field,
   701  		e.reason,
   702  		cause)
   703  }
   704  
   705  var _ error = Permission_SetValidationError{}
   706  
   707  var _ interface {
   708  	Field() string
   709  	Reason() string
   710  	Key() bool
   711  	Cause() error
   712  	ErrorName() string
   713  } = Permission_SetValidationError{}
   714  
   715  // Validate checks the field values on Principal_Set with the rules defined in
   716  // the proto definition for this message. If any rules are violated, an error
   717  // is returned.
   718  func (m *Principal_Set) Validate() error {
   719  	if m == nil {
   720  		return nil
   721  	}
   722  
   723  	if len(m.GetIds()) < 1 {
   724  		return Principal_SetValidationError{
   725  			field:  "Ids",
   726  			reason: "value must contain at least 1 item(s)",
   727  		}
   728  	}
   729  
   730  	for idx, item := range m.GetIds() {
   731  		_, _ = idx, item
   732  
   733  		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
   734  			if err := v.Validate(); err != nil {
   735  				return Principal_SetValidationError{
   736  					field:  fmt.Sprintf("Ids[%v]", idx),
   737  					reason: "embedded message failed validation",
   738  					cause:  err,
   739  				}
   740  			}
   741  		}
   742  
   743  	}
   744  
   745  	return nil
   746  }
   747  
   748  // Principal_SetValidationError is the validation error returned by
   749  // Principal_Set.Validate if the designated constraints aren't met.
   750  type Principal_SetValidationError struct {
   751  	field  string
   752  	reason string
   753  	cause  error
   754  	key    bool
   755  }
   756  
   757  // Field function returns field value.
   758  func (e Principal_SetValidationError) Field() string { return e.field }
   759  
   760  // Reason function returns reason value.
   761  func (e Principal_SetValidationError) Reason() string { return e.reason }
   762  
   763  // Cause function returns cause value.
   764  func (e Principal_SetValidationError) Cause() error { return e.cause }
   765  
   766  // Key function returns key value.
   767  func (e Principal_SetValidationError) Key() bool { return e.key }
   768  
   769  // ErrorName returns error name.
   770  func (e Principal_SetValidationError) ErrorName() string { return "Principal_SetValidationError" }
   771  
   772  // Error satisfies the builtin error interface
   773  func (e Principal_SetValidationError) Error() string {
   774  	cause := ""
   775  	if e.cause != nil {
   776  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   777  	}
   778  
   779  	key := ""
   780  	if e.key {
   781  		key = "key for "
   782  	}
   783  
   784  	return fmt.Sprintf(
   785  		"invalid %sPrincipal_Set.%s: %s%s",
   786  		key,
   787  		e.field,
   788  		e.reason,
   789  		cause)
   790  }
   791  
   792  var _ error = Principal_SetValidationError{}
   793  
   794  var _ interface {
   795  	Field() string
   796  	Reason() string
   797  	Key() bool
   798  	Cause() error
   799  	ErrorName() string
   800  } = Principal_SetValidationError{}
   801  
   802  // Validate checks the field values on Principal_Authenticated with the rules
   803  // defined in the proto definition for this message. If any rules are
   804  // violated, an error is returned.
   805  func (m *Principal_Authenticated) Validate() error {
   806  	if m == nil {
   807  		return nil
   808  	}
   809  
   810  	if v, ok := interface{}(m.GetPrincipalName()).(interface{ Validate() error }); ok {
   811  		if err := v.Validate(); err != nil {
   812  			return Principal_AuthenticatedValidationError{
   813  				field:  "PrincipalName",
   814  				reason: "embedded message failed validation",
   815  				cause:  err,
   816  			}
   817  		}
   818  	}
   819  
   820  	return nil
   821  }
   822  
   823  // Principal_AuthenticatedValidationError is the validation error returned by
   824  // Principal_Authenticated.Validate if the designated constraints aren't met.
   825  type Principal_AuthenticatedValidationError struct {
   826  	field  string
   827  	reason string
   828  	cause  error
   829  	key    bool
   830  }
   831  
   832  // Field function returns field value.
   833  func (e Principal_AuthenticatedValidationError) Field() string { return e.field }
   834  
   835  // Reason function returns reason value.
   836  func (e Principal_AuthenticatedValidationError) Reason() string { return e.reason }
   837  
   838  // Cause function returns cause value.
   839  func (e Principal_AuthenticatedValidationError) Cause() error { return e.cause }
   840  
   841  // Key function returns key value.
   842  func (e Principal_AuthenticatedValidationError) Key() bool { return e.key }
   843  
   844  // ErrorName returns error name.
   845  func (e Principal_AuthenticatedValidationError) ErrorName() string {
   846  	return "Principal_AuthenticatedValidationError"
   847  }
   848  
   849  // Error satisfies the builtin error interface
   850  func (e Principal_AuthenticatedValidationError) Error() string {
   851  	cause := ""
   852  	if e.cause != nil {
   853  		cause = fmt.Sprintf(" | caused by: %v", e.cause)
   854  	}
   855  
   856  	key := ""
   857  	if e.key {
   858  		key = "key for "
   859  	}
   860  
   861  	return fmt.Sprintf(
   862  		"invalid %sPrincipal_Authenticated.%s: %s%s",
   863  		key,
   864  		e.field,
   865  		e.reason,
   866  		cause)
   867  }
   868  
   869  var _ error = Principal_AuthenticatedValidationError{}
   870  
   871  var _ interface {
   872  	Field() string
   873  	Reason() string
   874  	Key() bool
   875  	Cause() error
   876  	ErrorName() string
   877  } = Principal_AuthenticatedValidationError{}