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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/devices/proto/v1/device_hardware_register_session.proto
     3  // DO NOT EDIT!!!
     4  
     5  package device_hardware_register_session
     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  	device "github.com/cloudwan/edgelq-sdk/devices/resources/v1/device"
    24  	device_hardware "github.com/cloudwan/edgelq-sdk/devices/resources/v1/device_hardware"
    25  	project "github.com/cloudwan/edgelq-sdk/devices/resources/v1/project"
    26  	provisioning_policy "github.com/cloudwan/edgelq-sdk/devices/resources/v1/provisioning_policy"
    27  	meta "github.com/cloudwan/goten-sdk/types/meta"
    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  	_ = &device.Device{}
    47  	_ = &device_hardware.DeviceHardware{}
    48  	_ = &project.Project{}
    49  	_ = &provisioning_policy.ProvisioningPolicy{}
    50  	_ = &timestamppb.Timestamp{}
    51  	_ = &meta.Meta{}
    52  )
    53  
    54  func (obj *DeviceHardwareRegisterSession) GotenValidate() error {
    55  	if obj == nil {
    56  		return nil
    57  	}
    58  	{
    59  		rlen := utf8.RuneCountInString(obj.DisplayName)
    60  		if rlen > 256 {
    61  			return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "displayName", obj.DisplayName, "field must contain at most 256 characters", nil)
    62  		}
    63  	}
    64  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    65  		if err := subobj.GotenValidate(); err != nil {
    66  			return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "metadata", obj.Metadata, "nested object validation failed", err)
    67  		}
    68  	}
    69  	if err := gotenvalidate.ValidateEmail(string(obj.UserEmail)); err != nil {
    70  		return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "userEmail", obj.UserEmail, "field must contain a valid email address", err)
    71  	}
    72  	if obj.UserEmail == "" {
    73  		return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "userEmail", obj.UserEmail, "field is required", nil)
    74  	}
    75  	if obj.LanguageCode != "" && obj.LanguageCode != "en-us" && obj.LanguageCode != "ja-jp" {
    76  		return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "languageCode", obj.LanguageCode, "field must be equal to exactly one of the following values: , en-us, ja-jp", nil)
    77  	}
    78  	if subobj, ok := interface{}(obj.Status).(gotenvalidate.Validator); ok {
    79  		if err := subobj.GotenValidate(); err != nil {
    80  			return gotenvalidate.NewValidationError("DeviceHardwareRegisterSession", "status", obj.Status, "nested object validation failed", err)
    81  		}
    82  	}
    83  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    84  		return cvobj.GotenCustomValidate()
    85  	}
    86  	return nil
    87  }
    88  func (obj *DeviceHardwareRegisterSession_Status) GotenValidate() error {
    89  	if obj == nil {
    90  		return nil
    91  	}
    92  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    93  		return cvobj.GotenCustomValidate()
    94  	}
    95  	return nil
    96  }