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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/iam/proto/v1/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  	condition "github.com/cloudwan/edgelq-sdk/iam/resources/v1/condition"
    24  	group "github.com/cloudwan/edgelq-sdk/iam/resources/v1/group"
    25  	role "github.com/cloudwan/edgelq-sdk/iam/resources/v1/role"
    26  	service_account "github.com/cloudwan/edgelq-sdk/iam/resources/v1/service_account"
    27  	user "github.com/cloudwan/edgelq-sdk/iam/resources/v1/user"
    28  	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
    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  	_ = &group.Group{}
    48  	_ = &role.Role{}
    49  	_ = &service_account.ServiceAccount{}
    50  	_ = &user.User{}
    51  	_ = &timestamppb.Timestamp{}
    52  )
    53  
    54  func (obj *Actor) 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 *Invitation) GotenValidate() error {
    64  	if obj == nil {
    65  		return nil
    66  	}
    67  	if err := gotenvalidate.ValidateEmail(string(obj.InviteeEmail)); err != nil {
    68  		return gotenvalidate.NewValidationError("Invitation", "inviteeEmail", obj.InviteeEmail, "field must contain a valid email address", err)
    69  	}
    70  	if subobj, ok := interface{}(obj.InviterActor).(gotenvalidate.Validator); ok {
    71  		if err := subobj.GotenValidate(); err != nil {
    72  			return gotenvalidate.NewValidationError("Invitation", "inviterActor", obj.InviterActor, "nested object validation failed", err)
    73  		}
    74  	}
    75  	if obj.LanguageCode != "" && obj.LanguageCode != "en-us" && obj.LanguageCode != "ja-jp" {
    76  		return gotenvalidate.NewValidationError("Invitation", "languageCode", obj.LanguageCode, "field must be equal to exactly one of the following values: , en-us, ja-jp", nil)
    77  	}
    78  	for idx, elem := range obj.BindingRoles {
    79  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    80  			if err := subobj.GotenValidate(); err != nil {
    81  				return gotenvalidate.NewValidationError("Invitation", "bindingRoles", obj.BindingRoles[idx], "nested object validation failed", err)
    82  			}
    83  		}
    84  	}
    85  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    86  		return cvobj.GotenCustomValidate()
    87  	}
    88  	return nil
    89  }
    90  func (obj *Invitation_BindingRole) GotenValidate() error {
    91  	if obj == nil {
    92  		return nil
    93  	}
    94  	for idx, elem := range obj.ExecutableConditions {
    95  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
    96  			if err := subobj.GotenValidate(); err != nil {
    97  				return gotenvalidate.NewValidationError("BindingRole", "executableConditions", obj.ExecutableConditions[idx], "nested object validation failed", err)
    98  			}
    99  		}
   100  	}
   101  	for idx, elem := range obj.ScopeParams {
   102  		if subobj, ok := interface{}(elem).(gotenvalidate.Validator); ok {
   103  			if err := subobj.GotenValidate(); err != nil {
   104  				return gotenvalidate.NewValidationError("BindingRole", "scopeParams", obj.ScopeParams[idx], "nested object validation failed", err)
   105  			}
   106  		}
   107  	}
   108  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
   109  		return cvobj.GotenCustomValidate()
   110  	}
   111  	return nil
   112  }