github.com/cloudwan/edgelq-sdk@v1.15.4/iam/resources/v1alpha2/invitation/invitation.pb.validate.go (about) 1 // Code generated by protoc-gen-goten-validate 2 // File: edgelq/iam/proto/v1alpha2/invitation.proto 3 // DO NOT EDIT!!! 4 5 package iam_invitation 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/v1alpha2/role" 24 service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/service_account" 25 user "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/user" 26 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 27 ) 28 29 var ( 30 _ = bytes.Equal 31 _ = errors.New 32 _ = fmt.Errorf 33 _ = net.ParseIP 34 _ = regexp.Match 35 _ = strings.Split 36 _ = time.Now 37 _ = utf8.RuneCountInString 38 _ = url.Parse 39 _ = gotenvalidate.NewValidationError 40 ) 41 42 // make sure we're using proto imports 43 var ( 44 _ = &role.Role{} 45 _ = &service_account.ServiceAccount{} 46 _ = &user.User{} 47 _ = ×tamppb.Timestamp{} 48 ) 49 50 func (obj *Actor) GotenValidate() error { 51 if obj == nil { 52 return nil 53 } 54 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 55 return cvobj.GotenCustomValidate() 56 } 57 return nil 58 } 59 func (obj *Invitation) GotenValidate() error { 60 if obj == nil { 61 return nil 62 } 63 if err := gotenvalidate.ValidateEmail(string(obj.InviteeEmail)); err != nil { 64 return gotenvalidate.NewValidationError("Invitation", "inviteeEmail", obj.InviteeEmail, "field must contain a valid email address", err) 65 } 66 if subobj, ok := interface{}(obj.InviterActor).(gotenvalidate.Validator); ok { 67 if err := subobj.GotenValidate(); err != nil { 68 return gotenvalidate.NewValidationError("Invitation", "inviterActor", obj.InviterActor, "nested object validation failed", err) 69 } 70 } 71 if obj.LanguageCode != "" && obj.LanguageCode != "en-us" && obj.LanguageCode != "ja-jp" { 72 return gotenvalidate.NewValidationError("Invitation", "languageCode", obj.LanguageCode, "field must be equal to exactly one of the following values: , en-us, ja-jp", nil) 73 } 74 if len(obj.Roles) < 1 { 75 return gotenvalidate.NewValidationError("Invitation", "roles", obj.Roles, "field must have at least 1 items", nil) 76 } 77 if len(obj.Roles) > 1 { 78 values := make(map[*role.Reference]struct{}) 79 for _, v := range obj.Roles { 80 if _, ok := values[v]; ok { 81 return gotenvalidate.NewValidationError("Invitation", "roles", obj.Roles, "field must contain unique items", nil) 82 } 83 values[v] = struct{}{} 84 } 85 } 86 if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok { 87 return cvobj.GotenCustomValidate() 88 } 89 return nil 90 }