github.com/cloudwan/edgelq-sdk@v1.15.4/iam/client/v1/authorization/authorization_custom.pb.validate.go (about)

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/iam/proto/v1/authorization_custom.proto
     3  // DO NOT EDIT!!!
     4  
     5  package authorization_client
     6  
     7  import (
     8  	"bytes"
     9  	"errors"
    10  	"fmt"
    11  	"net"
    12  	"net/url"
    13  	"regexp"
    14  	"strings"
    15  	"time"
    16  	"unicode/utf8"
    17  
    18  	gotenvalidate "github.com/cloudwan/goten-sdk/runtime/validate"
    19  )
    20  
    21  // proto imports
    22  import (
    23  	role "github.com/cloudwan/edgelq-sdk/iam/resources/v1/role"
    24  	role_binding "github.com/cloudwan/edgelq-sdk/iam/resources/v1/role_binding"
    25  	service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1/service_account"
    26  	user "github.com/cloudwan/edgelq-sdk/iam/resources/v1/user"
    27  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    28  	fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
    29  )
    30  
    31  var (
    32  	_ = bytes.Equal
    33  	_ = errors.New
    34  	_ = fmt.Errorf
    35  	_ = net.ParseIP
    36  	_ = regexp.Match
    37  	_ = strings.Split
    38  	_ = time.Now
    39  	_ = utf8.RuneCountInString
    40  	_ = url.Parse
    41  	_ = gotenvalidate.NewValidationError
    42  )
    43  
    44  // make sure we're using proto imports
    45  var (
    46  	_ = &role.Role{}
    47  	_ = &role_binding.RoleBinding{}
    48  	_ = &service_account.ServiceAccount{}
    49  	_ = &user.User{}
    50  	_ = &fieldmaskpb.FieldMask{}
    51  	_ = &meta_service.Service{}
    52  )
    53  
    54  func (obj *GetPrincipalRequest) GotenValidate() error {
    55  	if obj == nil {
    56  		return nil
    57  	}
    58  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    59  		return cvobj.GotenCustomValidate()
    60  	}
    61  	return nil
    62  }
    63  func (obj *GetPrincipalResponse) GotenValidate() error {
    64  	if obj == nil {
    65  		return nil
    66  	}
    67  	switch opt := obj.Principal.(type) {
    68  	case *GetPrincipalResponse_User:
    69  		if subobj, ok := interface{}(opt.User).(gotenvalidate.Validator); ok {
    70  			if err := subobj.GotenValidate(); err != nil {
    71  				return gotenvalidate.NewValidationError("GetPrincipalResponse", "user", opt.User, "nested object validation failed", err)
    72  			}
    73  		}
    74  	case *GetPrincipalResponse_ServiceAccount:
    75  		if subobj, ok := interface{}(opt.ServiceAccount).(gotenvalidate.Validator); ok {
    76  			if err := subobj.GotenValidate(); err != nil {
    77  				return gotenvalidate.NewValidationError("GetPrincipalResponse", "serviceAccount", opt.ServiceAccount, "nested object validation failed", err)
    78  			}
    79  		}
    80  	case *GetPrincipalResponse_Anonymous:
    81  	default:
    82  		_ = opt
    83  	}
    84  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    85  		return cvobj.GotenCustomValidate()
    86  	}
    87  	return nil
    88  }
    89  func (obj *WatchPrincipalUpdatesRequest) GotenValidate() error {
    90  	if obj == nil {
    91  		return nil
    92  	}
    93  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    94  		return cvobj.GotenCustomValidate()
    95  	}
    96  	return nil
    97  }
    98  func (obj *WatchPrincipalUpdatesResponse) GotenValidate() error {
    99  	if obj == nil {
   100  		return nil
   101  	}
   102  	for idx, elem := range obj.CurrentPrincipals {
   103  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   104  			if err := subobj.GotenValidate(); err != nil {
   105  				return gotenvalidate.NewValidationError("WatchPrincipalUpdatesResponse", "currentPrincipals", obj.CurrentPrincipals[idx], "nested object validation failed", err)
   106  			}
   107  		}
   108  	}
   109  	for idx, elem := range obj.RemovedPrincipals {
   110  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   111  			if err := subobj.GotenValidate(); err != nil {
   112  				return gotenvalidate.NewValidationError("WatchPrincipalUpdatesResponse", "removedPrincipals", obj.RemovedPrincipals[idx], "nested object validation failed", err)
   113  			}
   114  		}
   115  	}
   116  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   117  		return cvobj.GotenCustomValidate()
   118  	}
   119  	return nil
   120  }
   121  func (obj *WatchPrincipalUpdatesResponse_CurrentPrincipal) GotenValidate() error {
   122  	if obj == nil {
   123  		return nil
   124  	}
   125  	switch opt := obj.Update.(type) {
   126  	case *WatchPrincipalUpdatesResponse_CurrentPrincipal_User:
   127  		if subobj, ok := interface{}(opt.User).(gotenvalidate.Validator); ok {
   128  			if err := subobj.GotenValidate(); err != nil {
   129  				return gotenvalidate.NewValidationError("CurrentPrincipal", "user", opt.User, "nested object validation failed", err)
   130  			}
   131  		}
   132  	case *WatchPrincipalUpdatesResponse_CurrentPrincipal_ServiceAccount:
   133  		if subobj, ok := interface{}(opt.ServiceAccount).(gotenvalidate.Validator); ok {
   134  			if err := subobj.GotenValidate(); err != nil {
   135  				return gotenvalidate.NewValidationError("CurrentPrincipal", "serviceAccount", opt.ServiceAccount, "nested object validation failed", err)
   136  			}
   137  		}
   138  	default:
   139  		_ = opt
   140  	}
   141  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   142  		return cvobj.GotenCustomValidate()
   143  	}
   144  	return nil
   145  }
   146  func (obj *WatchPrincipalUpdatesResponse_RemovedPrincipal) GotenValidate() error {
   147  	if obj == nil {
   148  		return nil
   149  	}
   150  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   151  		return cvobj.GotenCustomValidate()
   152  	}
   153  	return nil
   154  }
   155  func (obj *CheckMyRoleBindingsRequest) GotenValidate() error {
   156  	if obj == nil {
   157  		return nil
   158  	}
   159  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   160  		return cvobj.GotenCustomValidate()
   161  	}
   162  	return nil
   163  }
   164  func (obj *CheckMyRoleBindingsResponse) GotenValidate() error {
   165  	if obj == nil {
   166  		return nil
   167  	}
   168  	for idx, elem := range obj.ResolvableGrants {
   169  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   170  			if err := subobj.GotenValidate(); err != nil {
   171  				return gotenvalidate.NewValidationError("CheckMyRoleBindingsResponse", "resolvableGrants", obj.ResolvableGrants[idx], "nested object validation failed", err)
   172  			}
   173  		}
   174  	}
   175  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   176  		return cvobj.GotenCustomValidate()
   177  	}
   178  	return nil
   179  }
   180  func (obj *CheckMyRoleBindingsResponse_ResolvableGrant) GotenValidate() error {
   181  	if obj == nil {
   182  		return nil
   183  	}
   184  	if subobj, ok := interface{}(obj.RoleBinding).(gotenvalidate.Validator); ok {
   185  		if err := subobj.GotenValidate(); err != nil {
   186  			return gotenvalidate.NewValidationError("ResolvableGrant", "roleBinding", obj.RoleBinding, "nested object validation failed", err)
   187  		}
   188  	}
   189  	for idx, elem := range obj.Grants {
   190  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   191  			if err := subobj.GotenValidate(); err != nil {
   192  				return gotenvalidate.NewValidationError("ResolvableGrant", "grants", obj.Grants[idx], "nested object validation failed", err)
   193  			}
   194  		}
   195  	}
   196  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   197  		return cvobj.GotenCustomValidate()
   198  	}
   199  	return nil
   200  }