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

     1  // Code generated by protoc-gen-goten-validate
     2  // File: edgelq/devices/proto/v1/device_hardware.proto
     3  // DO NOT EDIT!!!
     4  
     5  package device_hardware
     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  	cellular_api_sim_card "github.com/cloudwan/edgelq-sdk/cellular-api/resources/v1/sim_card"
    24  	device "github.com/cloudwan/edgelq-sdk/devices/resources/v1/device"
    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  )
    29  
    30  var (
    31  	_ = bytes.Equal
    32  	_ = errors.New
    33  	_ = fmt.Errorf
    34  	_ = net.ParseIP
    35  	_ = regexp.Match
    36  	_ = strings.Split
    37  	_ = time.Now
    38  	_ = utf8.RuneCountInString
    39  	_ = url.Parse
    40  	_ = gotenvalidate.NewValidationError
    41  )
    42  
    43  // make sure we're using proto imports
    44  var (
    45  	_ = &cellular_api_sim_card.SimCard{}
    46  	_ = &device.Device{}
    47  	_ = &project.Project{}
    48  	_ = &provisioning_policy.ProvisioningPolicy{}
    49  	_ = &meta.Meta{}
    50  )
    51  
    52  func (obj *DeviceHardware) GotenValidate() error {
    53  	if obj == nil {
    54  		return nil
    55  	}
    56  	if subobj, ok := interface{}(obj.Metadata).(gotenvalidate.Validator); ok {
    57  		if err := subobj.GotenValidate(); err != nil {
    58  			return gotenvalidate.NewValidationError("DeviceHardware", "metadata", obj.Metadata, "nested object validation failed", err)
    59  		}
    60  	}
    61  	{
    62  		rlen := utf8.RuneCountInString(obj.DisplayName)
    63  		if rlen > 256 {
    64  			return gotenvalidate.NewValidationError("DeviceHardware", "displayName", obj.DisplayName, "field must contain at most 256 characters", nil)
    65  		}
    66  	}
    67  	if subobj, ok := interface{}(obj.Status).(gotenvalidate.Validator); ok {
    68  		if err := subobj.GotenValidate(); err != nil {
    69  			return gotenvalidate.NewValidationError("DeviceHardware", "status", obj.Status, "nested object validation failed", err)
    70  		}
    71  	}
    72  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    73  		return cvobj.GotenCustomValidate()
    74  	}
    75  	return nil
    76  }
    77  func (obj *DeviceHardware_Status) GotenValidate() error {
    78  	if obj == nil {
    79  		return nil
    80  	}
    81  	if cvobj, ok := interface{}(obj).(gotenvalidate.CustomValidator); ok {
    82  		return cvobj.GotenCustomValidate()
    83  	}
    84  	return nil
    85  }