github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1/role_binding/role_binding.pb.validate.go (about)

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/iam/proto/v1/role_binding.proto
     3  // DO NOT EDIT!!!
     4  
     5  package role_binding
     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  	condition "github.com/cloudwan/edgelq-sdk/iam/resources/v1/condition"
    24  	organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization"
    25  	project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project"
    26  	role "github.com/cloudwan/edgelq-sdk/iam/resources/v1/role"
    27  	meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service"
    28  	meta "github.com/cloudwan/goten-sdk/types/meta"
    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  	_ = &condition.Condition{}
    47  	_ = &organization.Organization{}
    48  	_ = &project.Project{}
    49  	_ = &role.Role{}
    50  	_ = &meta_service.Service{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  func (obj *RoleBinding) GotenValidate() error {
    55  	if obj == nil {
    56  		return nil
    57  	}
    58  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    59  		if err := subobj.GotenValidate(); err != nil {
    60  			return gotenvalidate.NewValidationError("RoleBinding", "metadata", obj.Metadata, "nested object validation failed", err)
    61  		}
    62  	}
    63  	if obj.Member == "" {
    64  		return gotenvalidate.NewValidationError("RoleBinding", "member", obj.Member, "field is required", nil)
    65  	}
    66  	for idx, elem := range obj.ScopeParams {
    67  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    68  			if err := subobj.GotenValidate(); err != nil {
    69  				return gotenvalidate.NewValidationError("RoleBinding", "scopeParams", obj.ScopeParams[idx], "nested object validation failed", err)
    70  			}
    71  		}
    72  	}
    73  	for idx, elem := range obj.ExecutableConditions {
    74  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    75  			if err := subobj.GotenValidate(); err != nil {
    76  				return gotenvalidate.NewValidationError("RoleBinding", "executableConditions", obj.ExecutableConditions[idx], "nested object validation failed", err)
    77  			}
    78  		}
    79  	}
    80  	for idx, elem := range obj.AncestryPath {
    81  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    82  			if err := subobj.GotenValidate(); err != nil {
    83  				return gotenvalidate.NewValidationError("RoleBinding", "ancestryPath", obj.AncestryPath[idx], "nested object validation failed", err)
    84  			}
    85  		}
    86  	}
    87  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    88  		return cvobj.GotenCustomValidate()
    89  	}
    90  	return nil
    91  }
    92  func (obj *RoleBinding_Parent) GotenValidate() error {
    93  	if obj == nil {
    94  		return nil
    95  	}
    96  	if len(obj.Member) > 256 {
    97  		return gotenvalidate.NewValidationError("Parent", "member", obj.Member, "field must contain at most 256 characters", nil)
    98  	}
    99  	if obj.Member == "" {
   100  		return gotenvalidate.NewValidationError("Parent", "member", obj.Member, "field is required", nil)
   101  	}
   102  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   103  		return cvobj.GotenCustomValidate()
   104  	}
   105  	return nil
   106  }