...

Source file src/github.com/datawire/ambassador/v2/pkg/api/envoy/config/rbac/v4alpha/rbac.pb.validate.go

Documentation: github.com/datawire/ambassador/v2/pkg/api/envoy/config/rbac/v4alpha

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

View as plain text