api/pkg/apis/manager/v1/manager.pb.validate.go

5174 lines
132 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/manager/v1/manager.proto
package v1
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on SecurityGroup with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *SecurityGroup) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SecurityGroup with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in SecurityGroupMultiError, or
// nil if none found.
func (m *SecurityGroup) ValidateAll() error {
return m.validate(true)
}
func (m *SecurityGroup) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Name
// no validation rules for Bio
// no validation rules for Domain
// no validation rules for ProxyDomain
if len(errors) > 0 {
return SecurityGroupMultiError(errors)
}
return nil
}
// SecurityGroupMultiError is an error wrapping multiple validation errors
// returned by SecurityGroup.ValidateAll() if the designated constraints
// aren't met.
type SecurityGroupMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SecurityGroupMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SecurityGroupMultiError) AllErrors() []error { return m }
// SecurityGroupValidationError is the validation error returned by
// SecurityGroup.Validate if the designated constraints aren't met.
type SecurityGroupValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SecurityGroupValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SecurityGroupValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SecurityGroupValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SecurityGroupValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SecurityGroupValidationError) ErrorName() string { return "SecurityGroupValidationError" }
// Error satisfies the builtin error interface
func (e SecurityGroupValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sSecurityGroup.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SecurityGroupValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SecurityGroupValidationError{}
// Validate checks the field values on SeedPeerCluster with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *SeedPeerCluster) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SeedPeerCluster with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// SeedPeerClusterMultiError, or nil if none found.
func (m *SeedPeerCluster) ValidateAll() error {
return m.validate(true)
}
func (m *SeedPeerCluster) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Name
// no validation rules for Bio
// no validation rules for Config
// no validation rules for Scopes
if all {
switch v := interface{}(m.GetSecurityGroup()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SeedPeerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SeedPeerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SeedPeerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return SeedPeerClusterMultiError(errors)
}
return nil
}
// SeedPeerClusterMultiError is an error wrapping multiple validation errors
// returned by SeedPeerCluster.ValidateAll() if the designated constraints
// aren't met.
type SeedPeerClusterMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SeedPeerClusterMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SeedPeerClusterMultiError) AllErrors() []error { return m }
// SeedPeerClusterValidationError is the validation error returned by
// SeedPeerCluster.Validate if the designated constraints aren't met.
type SeedPeerClusterValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SeedPeerClusterValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SeedPeerClusterValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SeedPeerClusterValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SeedPeerClusterValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SeedPeerClusterValidationError) ErrorName() string { return "SeedPeerClusterValidationError" }
// Error satisfies the builtin error interface
func (e SeedPeerClusterValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sSeedPeerCluster.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SeedPeerClusterValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SeedPeerClusterValidationError{}
// Validate checks the field values on SeedPeer with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *SeedPeer) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SeedPeer with the rules defined in
// the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in SeedPeerMultiError, or nil
// if none found.
func (m *SeedPeer) ValidateAll() error {
return m.validate(true)
}
func (m *SeedPeer) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for HostName
// no validation rules for Type
// no validation rules for Idc
// no validation rules for NetTopology
// no validation rules for Location
// no validation rules for Ip
// no validation rules for Port
// no validation rules for DownloadPort
// no validation rules for State
// no validation rules for SeedPeerClusterId
if all {
switch v := interface{}(m.GetSeedPeerCluster()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SeedPeerValidationError{
field: "SeedPeerCluster",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SeedPeerValidationError{
field: "SeedPeerCluster",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetSeedPeerCluster()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SeedPeerValidationError{
field: "SeedPeerCluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
for idx, item := range m.GetSchedulers() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SeedPeerValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SeedPeerValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SeedPeerValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for ObjectStoragePort
if len(errors) > 0 {
return SeedPeerMultiError(errors)
}
return nil
}
// SeedPeerMultiError is an error wrapping multiple validation errors returned
// by SeedPeer.ValidateAll() if the designated constraints aren't met.
type SeedPeerMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SeedPeerMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SeedPeerMultiError) AllErrors() []error { return m }
// SeedPeerValidationError is the validation error returned by
// SeedPeer.Validate if the designated constraints aren't met.
type SeedPeerValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SeedPeerValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SeedPeerValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SeedPeerValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SeedPeerValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SeedPeerValidationError) ErrorName() string { return "SeedPeerValidationError" }
// Error satisfies the builtin error interface
func (e SeedPeerValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sSeedPeer.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SeedPeerValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SeedPeerValidationError{}
// Validate checks the field values on GetSeedPeerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetSeedPeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetSeedPeerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetSeedPeerRequestMultiError, or nil if none found.
func (m *GetSeedPeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetSeedPeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := GetSeedPeerRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = GetSeedPeerRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetSeedPeerClusterId() < 1 {
err := GetSeedPeerRequestValidationError{
field: "SeedPeerClusterId",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetIp() != "" {
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := GetSeedPeerRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return GetSeedPeerRequestMultiError(errors)
}
return nil
}
func (m *GetSeedPeerRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// GetSeedPeerRequestMultiError is an error wrapping multiple validation errors
// returned by GetSeedPeerRequest.ValidateAll() if the designated constraints
// aren't met.
type GetSeedPeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetSeedPeerRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetSeedPeerRequestMultiError) AllErrors() []error { return m }
// GetSeedPeerRequestValidationError is the validation error returned by
// GetSeedPeerRequest.Validate if the designated constraints aren't met.
type GetSeedPeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetSeedPeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetSeedPeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetSeedPeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetSeedPeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetSeedPeerRequestValidationError) ErrorName() string {
return "GetSeedPeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e GetSeedPeerRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetSeedPeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetSeedPeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetSeedPeerRequestValidationError{}
// Validate checks the field values on UpdateSeedPeerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *UpdateSeedPeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdateSeedPeerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// UpdateSeedPeerRequestMultiError, or nil if none found.
func (m *UpdateSeedPeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UpdateSeedPeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := UpdateSeedPeerRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = UpdateSeedPeerRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if _, ok := _UpdateSeedPeerRequest_Type_InLookup[m.GetType()]; !ok {
err := UpdateSeedPeerRequestValidationError{
field: "Type",
reason: "value must be in list [super strong weak]",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetIdc() != "" {
if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 {
err := UpdateSeedPeerRequestValidationError{
field: "Idc",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetNetTopology() != "" {
if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 {
err := UpdateSeedPeerRequestValidationError{
field: "NetTopology",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetLocation() != "" {
if utf8.RuneCountInString(m.GetLocation()) > 1024 {
err := UpdateSeedPeerRequestValidationError{
field: "Location",
reason: "value length must be at most 1024 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := UpdateSeedPeerRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if val := m.GetPort(); val < 1024 || val >= 65535 {
err := UpdateSeedPeerRequestValidationError{
field: "Port",
reason: "value must be inside range [1024, 65535)",
}
if !all {
return err
}
errors = append(errors, err)
}
if val := m.GetDownloadPort(); val < 1024 || val >= 65535 {
err := UpdateSeedPeerRequestValidationError{
field: "DownloadPort",
reason: "value must be inside range [1024, 65535)",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetSeedPeerClusterId() < 1 {
err := UpdateSeedPeerRequestValidationError{
field: "SeedPeerClusterId",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetObjectStoragePort() != 0 {
if val := m.GetObjectStoragePort(); val < 1024 || val >= 65535 {
err := UpdateSeedPeerRequestValidationError{
field: "ObjectStoragePort",
reason: "value must be inside range [1024, 65535)",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return UpdateSeedPeerRequestMultiError(errors)
}
return nil
}
func (m *UpdateSeedPeerRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// UpdateSeedPeerRequestMultiError is an error wrapping multiple validation
// errors returned by UpdateSeedPeerRequest.ValidateAll() if the designated
// constraints aren't met.
type UpdateSeedPeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdateSeedPeerRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m UpdateSeedPeerRequestMultiError) AllErrors() []error { return m }
// UpdateSeedPeerRequestValidationError is the validation error returned by
// UpdateSeedPeerRequest.Validate if the designated constraints aren't met.
type UpdateSeedPeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateSeedPeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateSeedPeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateSeedPeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateSeedPeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateSeedPeerRequestValidationError) ErrorName() string {
return "UpdateSeedPeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateSeedPeerRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateSeedPeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateSeedPeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateSeedPeerRequestValidationError{}
var _UpdateSeedPeerRequest_Type_InLookup = map[string]struct{}{
"super": {},
"strong": {},
"weak": {},
}
// Validate checks the field values on SchedulerCluster with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *SchedulerCluster) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SchedulerCluster with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// SchedulerClusterMultiError, or nil if none found.
func (m *SchedulerCluster) ValidateAll() error {
return m.validate(true)
}
func (m *SchedulerCluster) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Name
// no validation rules for Bio
// no validation rules for Config
// no validation rules for ClientConfig
// no validation rules for Scopes
if all {
switch v := interface{}(m.GetSecurityGroup()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SchedulerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SchedulerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SchedulerClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return SchedulerClusterMultiError(errors)
}
return nil
}
// SchedulerClusterMultiError is an error wrapping multiple validation errors
// returned by SchedulerCluster.ValidateAll() if the designated constraints
// aren't met.
type SchedulerClusterMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SchedulerClusterMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SchedulerClusterMultiError) AllErrors() []error { return m }
// SchedulerClusterValidationError is the validation error returned by
// SchedulerCluster.Validate if the designated constraints aren't met.
type SchedulerClusterValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SchedulerClusterValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SchedulerClusterValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SchedulerClusterValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SchedulerClusterValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SchedulerClusterValidationError) ErrorName() string { return "SchedulerClusterValidationError" }
// Error satisfies the builtin error interface
func (e SchedulerClusterValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sSchedulerCluster.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SchedulerClusterValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SchedulerClusterValidationError{}
// Validate checks the field values on Scheduler with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Scheduler) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Scheduler with the rules defined in
// the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in SchedulerMultiError, or nil
// if none found.
func (m *Scheduler) ValidateAll() error {
return m.validate(true)
}
func (m *Scheduler) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for HostName
// no validation rules for Vips
// no validation rules for Idc
// no validation rules for Location
// no validation rules for NetConfig
// no validation rules for Ip
// no validation rules for Port
// no validation rules for State
// no validation rules for SchedulerClusterId
if all {
switch v := interface{}(m.GetSchedulerCluster()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SchedulerValidationError{
field: "SchedulerCluster",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SchedulerValidationError{
field: "SchedulerCluster",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetSchedulerCluster()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SchedulerValidationError{
field: "SchedulerCluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
for idx, item := range m.GetSeedPeers() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SchedulerValidationError{
field: fmt.Sprintf("SeedPeers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SchedulerValidationError{
field: fmt.Sprintf("SeedPeers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SchedulerValidationError{
field: fmt.Sprintf("SeedPeers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
// no validation rules for NetTopology
if len(errors) > 0 {
return SchedulerMultiError(errors)
}
return nil
}
// SchedulerMultiError is an error wrapping multiple validation errors returned
// by Scheduler.ValidateAll() if the designated constraints aren't met.
type SchedulerMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SchedulerMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m SchedulerMultiError) AllErrors() []error { return m }
// SchedulerValidationError is the validation error returned by
// Scheduler.Validate if the designated constraints aren't met.
type SchedulerValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SchedulerValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SchedulerValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SchedulerValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SchedulerValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SchedulerValidationError) ErrorName() string { return "SchedulerValidationError" }
// Error satisfies the builtin error interface
func (e SchedulerValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sScheduler.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SchedulerValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SchedulerValidationError{}
// Validate checks the field values on GetSchedulerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetSchedulerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetSchedulerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetSchedulerRequestMultiError, or nil if none found.
func (m *GetSchedulerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetSchedulerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := GetSchedulerRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = GetSchedulerRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetSchedulerClusterId() < 1 {
err := GetSchedulerRequestValidationError{
field: "SchedulerClusterId",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetIp() != "" {
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := GetSchedulerRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return GetSchedulerRequestMultiError(errors)
}
return nil
}
func (m *GetSchedulerRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// GetSchedulerRequestMultiError is an error wrapping multiple validation
// errors returned by GetSchedulerRequest.ValidateAll() if the designated
// constraints aren't met.
type GetSchedulerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetSchedulerRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetSchedulerRequestMultiError) AllErrors() []error { return m }
// GetSchedulerRequestValidationError is the validation error returned by
// GetSchedulerRequest.Validate if the designated constraints aren't met.
type GetSchedulerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetSchedulerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetSchedulerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetSchedulerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetSchedulerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetSchedulerRequestValidationError) ErrorName() string {
return "GetSchedulerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e GetSchedulerRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetSchedulerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetSchedulerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetSchedulerRequestValidationError{}
// Validate checks the field values on UpdateSchedulerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *UpdateSchedulerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdateSchedulerRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// UpdateSchedulerRequestMultiError, or nil if none found.
func (m *UpdateSchedulerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UpdateSchedulerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := UpdateSchedulerRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = UpdateSchedulerRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetSchedulerClusterId() < 1 {
err := UpdateSchedulerRequestValidationError{
field: "SchedulerClusterId",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetVips() != "" {
if l := utf8.RuneCountInString(m.GetVips()); l < 1 || l > 1024 {
err := UpdateSchedulerRequestValidationError{
field: "Vips",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetIdc() != "" {
if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 {
err := UpdateSchedulerRequestValidationError{
field: "Idc",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetLocation() != "" {
if l := utf8.RuneCountInString(m.GetLocation()); l < 1 || l > 1024 {
err := UpdateSchedulerRequestValidationError{
field: "Location",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(m.GetNetConfig()) > 0 {
if len(m.GetNetConfig()) < 1 {
err := UpdateSchedulerRequestValidationError{
field: "NetConfig",
reason: "value length must be at least 1 bytes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := UpdateSchedulerRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if val := m.GetPort(); val < 1024 || val >= 65535 {
err := UpdateSchedulerRequestValidationError{
field: "Port",
reason: "value must be inside range [1024, 65535)",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetNetTopology() != "" {
if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 {
err := UpdateSchedulerRequestValidationError{
field: "NetTopology",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return UpdateSchedulerRequestMultiError(errors)
}
return nil
}
func (m *UpdateSchedulerRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// UpdateSchedulerRequestMultiError is an error wrapping multiple validation
// errors returned by UpdateSchedulerRequest.ValidateAll() if the designated
// constraints aren't met.
type UpdateSchedulerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdateSchedulerRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m UpdateSchedulerRequestMultiError) AllErrors() []error { return m }
// UpdateSchedulerRequestValidationError is the validation error returned by
// UpdateSchedulerRequest.Validate if the designated constraints aren't met.
type UpdateSchedulerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateSchedulerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateSchedulerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateSchedulerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateSchedulerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateSchedulerRequestValidationError) ErrorName() string {
return "UpdateSchedulerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateSchedulerRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateSchedulerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateSchedulerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateSchedulerRequestValidationError{}
// Validate checks the field values on ListSchedulersRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListSchedulersRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListSchedulersRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListSchedulersRequestMultiError, or nil if none found.
func (m *ListSchedulersRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListSchedulersRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := ListSchedulersRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = ListSchedulersRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := ListSchedulersRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(m.GetHostInfo()) > 0 {
}
if len(errors) > 0 {
return ListSchedulersRequestMultiError(errors)
}
return nil
}
func (m *ListSchedulersRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// ListSchedulersRequestMultiError is an error wrapping multiple validation
// errors returned by ListSchedulersRequest.ValidateAll() if the designated
// constraints aren't met.
type ListSchedulersRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListSchedulersRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListSchedulersRequestMultiError) AllErrors() []error { return m }
// ListSchedulersRequestValidationError is the validation error returned by
// ListSchedulersRequest.Validate if the designated constraints aren't met.
type ListSchedulersRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListSchedulersRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListSchedulersRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListSchedulersRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListSchedulersRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListSchedulersRequestValidationError) ErrorName() string {
return "ListSchedulersRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListSchedulersRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListSchedulersRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListSchedulersRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListSchedulersRequestValidationError{}
// Validate checks the field values on ListSchedulersResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListSchedulersResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListSchedulersResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListSchedulersResponseMultiError, or nil if none found.
func (m *ListSchedulersResponse) ValidateAll() error {
return m.validate(true)
}
func (m *ListSchedulersResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetSchedulers() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListSchedulersResponseValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListSchedulersResponseValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListSchedulersResponseValidationError{
field: fmt.Sprintf("Schedulers[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListSchedulersResponseMultiError(errors)
}
return nil
}
// ListSchedulersResponseMultiError is an error wrapping multiple validation
// errors returned by ListSchedulersResponse.ValidateAll() if the designated
// constraints aren't met.
type ListSchedulersResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListSchedulersResponseMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListSchedulersResponseMultiError) AllErrors() []error { return m }
// ListSchedulersResponseValidationError is the validation error returned by
// ListSchedulersResponse.Validate if the designated constraints aren't met.
type ListSchedulersResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListSchedulersResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListSchedulersResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListSchedulersResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListSchedulersResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListSchedulersResponseValidationError) ErrorName() string {
return "ListSchedulersResponseValidationError"
}
// Error satisfies the builtin error interface
func (e ListSchedulersResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListSchedulersResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListSchedulersResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListSchedulersResponseValidationError{}
// Validate checks the field values on ObjectStorage with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *ObjectStorage) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ObjectStorage with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in ObjectStorageMultiError, or
// nil if none found.
func (m *ObjectStorage) ValidateAll() error {
return m.validate(true)
}
func (m *ObjectStorage) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
err := ObjectStorageValidationError{
field: "Name",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetRegion() != "" {
if l := utf8.RuneCountInString(m.GetRegion()); l < 1 || l > 1024 {
err := ObjectStorageValidationError{
field: "Region",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetEndpoint() != "" {
if l := utf8.RuneCountInString(m.GetEndpoint()); l < 1 || l > 1024 {
err := ObjectStorageValidationError{
field: "Endpoint",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetAccessKey() != "" {
if l := utf8.RuneCountInString(m.GetAccessKey()); l < 1 || l > 1024 {
err := ObjectStorageValidationError{
field: "AccessKey",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetSecretKey() != "" {
if l := utf8.RuneCountInString(m.GetSecretKey()); l < 1 || l > 1024 {
err := ObjectStorageValidationError{
field: "SecretKey",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return ObjectStorageMultiError(errors)
}
return nil
}
// ObjectStorageMultiError is an error wrapping multiple validation errors
// returned by ObjectStorage.ValidateAll() if the designated constraints
// aren't met.
type ObjectStorageMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ObjectStorageMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ObjectStorageMultiError) AllErrors() []error { return m }
// ObjectStorageValidationError is the validation error returned by
// ObjectStorage.Validate if the designated constraints aren't met.
type ObjectStorageValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ObjectStorageValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ObjectStorageValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ObjectStorageValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ObjectStorageValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ObjectStorageValidationError) ErrorName() string { return "ObjectStorageValidationError" }
// Error satisfies the builtin error interface
func (e ObjectStorageValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sObjectStorage.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ObjectStorageValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ObjectStorageValidationError{}
// Validate checks the field values on GetObjectStorageRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetObjectStorageRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetObjectStorageRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetObjectStorageRequestMultiError, or nil if none found.
func (m *GetObjectStorageRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetObjectStorageRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := GetObjectStorageRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = GetObjectStorageRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := GetObjectStorageRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return GetObjectStorageRequestMultiError(errors)
}
return nil
}
func (m *GetObjectStorageRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// GetObjectStorageRequestMultiError is an error wrapping multiple validation
// errors returned by GetObjectStorageRequest.ValidateAll() if the designated
// constraints aren't met.
type GetObjectStorageRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetObjectStorageRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetObjectStorageRequestMultiError) AllErrors() []error { return m }
// GetObjectStorageRequestValidationError is the validation error returned by
// GetObjectStorageRequest.Validate if the designated constraints aren't met.
type GetObjectStorageRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetObjectStorageRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetObjectStorageRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetObjectStorageRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetObjectStorageRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetObjectStorageRequestValidationError) ErrorName() string {
return "GetObjectStorageRequestValidationError"
}
// Error satisfies the builtin error interface
func (e GetObjectStorageRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetObjectStorageRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetObjectStorageRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetObjectStorageRequestValidationError{}
// Validate checks the field values on Bucket with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Bucket) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Bucket with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in BucketMultiError, or nil if none found.
func (m *Bucket) ValidateAll() error {
return m.validate(true)
}
func (m *Bucket) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
err := BucketValidationError{
field: "Name",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return BucketMultiError(errors)
}
return nil
}
// BucketMultiError is an error wrapping multiple validation errors returned by
// Bucket.ValidateAll() if the designated constraints aren't met.
type BucketMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m BucketMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m BucketMultiError) AllErrors() []error { return m }
// BucketValidationError is the validation error returned by Bucket.Validate if
// the designated constraints aren't met.
type BucketValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e BucketValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e BucketValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e BucketValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e BucketValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e BucketValidationError) ErrorName() string { return "BucketValidationError" }
// Error satisfies the builtin error interface
func (e BucketValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sBucket.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = BucketValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = BucketValidationError{}
// Validate checks the field values on ListBucketsRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListBucketsRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListBucketsRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListBucketsRequestMultiError, or nil if none found.
func (m *ListBucketsRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListBucketsRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := ListBucketsRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = ListBucketsRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := ListBucketsRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ListBucketsRequestMultiError(errors)
}
return nil
}
func (m *ListBucketsRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// ListBucketsRequestMultiError is an error wrapping multiple validation errors
// returned by ListBucketsRequest.ValidateAll() if the designated constraints
// aren't met.
type ListBucketsRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListBucketsRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListBucketsRequestMultiError) AllErrors() []error { return m }
// ListBucketsRequestValidationError is the validation error returned by
// ListBucketsRequest.Validate if the designated constraints aren't met.
type ListBucketsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListBucketsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListBucketsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListBucketsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListBucketsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListBucketsRequestValidationError) ErrorName() string {
return "ListBucketsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListBucketsRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListBucketsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListBucketsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListBucketsRequestValidationError{}
// Validate checks the field values on ListBucketsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListBucketsResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListBucketsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListBucketsResponseMultiError, or nil if none found.
func (m *ListBucketsResponse) ValidateAll() error {
return m.validate(true)
}
func (m *ListBucketsResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetBuckets() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListBucketsResponseValidationError{
field: fmt.Sprintf("Buckets[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListBucketsResponseValidationError{
field: fmt.Sprintf("Buckets[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListBucketsResponseValidationError{
field: fmt.Sprintf("Buckets[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListBucketsResponseMultiError(errors)
}
return nil
}
// ListBucketsResponseMultiError is an error wrapping multiple validation
// errors returned by ListBucketsResponse.ValidateAll() if the designated
// constraints aren't met.
type ListBucketsResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListBucketsResponseMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListBucketsResponseMultiError) AllErrors() []error { return m }
// ListBucketsResponseValidationError is the validation error returned by
// ListBucketsResponse.Validate if the designated constraints aren't met.
type ListBucketsResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListBucketsResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListBucketsResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListBucketsResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListBucketsResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListBucketsResponseValidationError) ErrorName() string {
return "ListBucketsResponseValidationError"
}
// Error satisfies the builtin error interface
func (e ListBucketsResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListBucketsResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListBucketsResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListBucketsResponseValidationError{}
// Validate checks the field values on Model with the rules defined in the
// proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *Model) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Model with the rules defined in the
// proto definition for this message. If any rules are violated, the result is
// a list of violation errors wrapped in ModelMultiError, or nil if none found.
func (m *Model) ValidateAll() error {
return m.validate(true)
}
func (m *Model) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetId()); l < 1 || l > 1024 {
err := ModelValidationError{
field: "Id",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
err := ModelValidationError{
field: "Name",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetVersionId()); l < 1 || l > 1024 {
err := ModelValidationError{
field: "VersionId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := ModelValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = ModelValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := ModelValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetCreateAt() == nil {
err := ModelValidationError{
field: "CreateAt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetUpdateAt() == nil {
err := ModelValidationError{
field: "UpdateAt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ModelMultiError(errors)
}
return nil
}
func (m *Model) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// ModelMultiError is an error wrapping multiple validation errors returned by
// Model.ValidateAll() if the designated constraints aren't met.
type ModelMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ModelMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ModelMultiError) AllErrors() []error { return m }
// ModelValidationError is the validation error returned by Model.Validate if
// the designated constraints aren't met.
type ModelValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ModelValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ModelValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ModelValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ModelValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ModelValidationError) ErrorName() string { return "ModelValidationError" }
// Error satisfies the builtin error interface
func (e ModelValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sModel.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ModelValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ModelValidationError{}
// Validate checks the field values on ListModelsRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *ListModelsRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListModelsRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListModelsRequestMultiError, or nil if none found.
func (m *ListModelsRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListModelsRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := ListModelsRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ListModelsRequestMultiError(errors)
}
return nil
}
// ListModelsRequestMultiError is an error wrapping multiple validation errors
// returned by ListModelsRequest.ValidateAll() if the designated constraints
// aren't met.
type ListModelsRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListModelsRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListModelsRequestMultiError) AllErrors() []error { return m }
// ListModelsRequestValidationError is the validation error returned by
// ListModelsRequest.Validate if the designated constraints aren't met.
type ListModelsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListModelsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListModelsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListModelsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListModelsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListModelsRequestValidationError) ErrorName() string {
return "ListModelsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListModelsRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListModelsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListModelsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListModelsRequestValidationError{}
// Validate checks the field values on ListModelsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListModelsResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListModelsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListModelsResponseMultiError, or nil if none found.
func (m *ListModelsResponse) ValidateAll() error {
return m.validate(true)
}
func (m *ListModelsResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetModels() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListModelsResponseValidationError{
field: fmt.Sprintf("Models[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListModelsResponseValidationError{
field: fmt.Sprintf("Models[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListModelsResponseValidationError{
field: fmt.Sprintf("Models[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListModelsResponseMultiError(errors)
}
return nil
}
// ListModelsResponseMultiError is an error wrapping multiple validation errors
// returned by ListModelsResponse.ValidateAll() if the designated constraints
// aren't met.
type ListModelsResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListModelsResponseMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListModelsResponseMultiError) AllErrors() []error { return m }
// ListModelsResponseValidationError is the validation error returned by
// ListModelsResponse.Validate if the designated constraints aren't met.
type ListModelsResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListModelsResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListModelsResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListModelsResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListModelsResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListModelsResponseValidationError) ErrorName() string {
return "ListModelsResponseValidationError"
}
// Error satisfies the builtin error interface
func (e ListModelsResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListModelsResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListModelsResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListModelsResponseValidationError{}
// Validate checks the field values on GetModelRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *GetModelRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetModelRequestMultiError, or nil if none found.
func (m *GetModelRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetModelRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := GetModelRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := GetModelRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return GetModelRequestMultiError(errors)
}
return nil
}
// GetModelRequestMultiError is an error wrapping multiple validation errors
// returned by GetModelRequest.ValidateAll() if the designated constraints
// aren't met.
type GetModelRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetModelRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetModelRequestMultiError) AllErrors() []error { return m }
// GetModelRequestValidationError is the validation error returned by
// GetModelRequest.Validate if the designated constraints aren't met.
type GetModelRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetModelRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetModelRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetModelRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetModelRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetModelRequestValidationError) ErrorName() string { return "GetModelRequestValidationError" }
// Error satisfies the builtin error interface
func (e GetModelRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetModelRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetModelRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetModelRequestValidationError{}
// Validate checks the field values on CreateModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *CreateModelRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on CreateModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// CreateModelRequestMultiError, or nil if none found.
func (m *CreateModelRequest) ValidateAll() error {
return m.validate(true)
}
func (m *CreateModelRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := CreateModelRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
err := CreateModelRequestValidationError{
field: "Name",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetVersionId()); l < 1 || l > 1024 {
err := CreateModelRequestValidationError{
field: "VersionId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := CreateModelRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = CreateModelRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := CreateModelRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return CreateModelRequestMultiError(errors)
}
return nil
}
func (m *CreateModelRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// CreateModelRequestMultiError is an error wrapping multiple validation errors
// returned by CreateModelRequest.ValidateAll() if the designated constraints
// aren't met.
type CreateModelRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m CreateModelRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m CreateModelRequestMultiError) AllErrors() []error { return m }
// CreateModelRequestValidationError is the validation error returned by
// CreateModelRequest.Validate if the designated constraints aren't met.
type CreateModelRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CreateModelRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CreateModelRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CreateModelRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CreateModelRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CreateModelRequestValidationError) ErrorName() string {
return "CreateModelRequestValidationError"
}
// Error satisfies the builtin error interface
func (e CreateModelRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sCreateModelRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CreateModelRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CreateModelRequestValidationError{}
// Validate checks the field values on UpdateModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *UpdateModelRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdateModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// UpdateModelRequestMultiError, or nil if none found.
func (m *UpdateModelRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UpdateModelRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := UpdateModelRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetName() != "" {
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
err := UpdateModelRequestValidationError{
field: "Name",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetVersionId() != "" {
if l := utf8.RuneCountInString(m.GetVersionId()); l < 1 || l > 1024 {
err := UpdateModelRequestValidationError{
field: "VersionId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := UpdateModelRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetHostName() != "" {
if err := m._validateHostname(m.GetHostName()); err != nil {
err = UpdateModelRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetIp() != "" {
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := UpdateModelRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return UpdateModelRequestMultiError(errors)
}
return nil
}
func (m *UpdateModelRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// UpdateModelRequestMultiError is an error wrapping multiple validation errors
// returned by UpdateModelRequest.ValidateAll() if the designated constraints
// aren't met.
type UpdateModelRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdateModelRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m UpdateModelRequestMultiError) AllErrors() []error { return m }
// UpdateModelRequestValidationError is the validation error returned by
// UpdateModelRequest.Validate if the designated constraints aren't met.
type UpdateModelRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateModelRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateModelRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateModelRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateModelRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateModelRequestValidationError) ErrorName() string {
return "UpdateModelRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateModelRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateModelRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateModelRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateModelRequestValidationError{}
// Validate checks the field values on DeleteModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *DeleteModelRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteModelRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// DeleteModelRequestMultiError, or nil if none found.
func (m *DeleteModelRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteModelRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := DeleteModelRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := DeleteModelRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteModelRequestMultiError(errors)
}
return nil
}
// DeleteModelRequestMultiError is an error wrapping multiple validation errors
// returned by DeleteModelRequest.ValidateAll() if the designated constraints
// aren't met.
type DeleteModelRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteModelRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m DeleteModelRequestMultiError) AllErrors() []error { return m }
// DeleteModelRequestValidationError is the validation error returned by
// DeleteModelRequest.Validate if the designated constraints aren't met.
type DeleteModelRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteModelRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteModelRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteModelRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteModelRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteModelRequestValidationError) ErrorName() string {
return "DeleteModelRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteModelRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sDeleteModelRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteModelRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteModelRequestValidationError{}
// Validate checks the field values on ModelVersion with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *ModelVersion) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ModelVersion with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in ModelVersionMultiError, or
// nil if none found.
func (m *ModelVersion) ValidateAll() error {
return m.validate(true)
}
func (m *ModelVersion) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetId()); l < 1 || l > 1024 {
err := ModelVersionValidationError{
field: "Id",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(m.GetDate()) < 1 {
err := ModelVersionValidationError{
field: "Date",
reason: "value length must be at least 1 bytes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetMae() < 0 {
err := ModelVersionValidationError{
field: "Mae",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetMse() < 0 {
err := ModelVersionValidationError{
field: "Mse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetRmse() < 0 {
err := ModelVersionValidationError{
field: "Rmse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetR2() < 0 {
err := ModelVersionValidationError{
field: "R2",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetCreateAt() == nil {
err := ModelVersionValidationError{
field: "CreateAt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetUpdateAt() == nil {
err := ModelVersionValidationError{
field: "UpdateAt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ModelVersionMultiError(errors)
}
return nil
}
// ModelVersionMultiError is an error wrapping multiple validation errors
// returned by ModelVersion.ValidateAll() if the designated constraints aren't met.
type ModelVersionMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ModelVersionMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ModelVersionMultiError) AllErrors() []error { return m }
// ModelVersionValidationError is the validation error returned by
// ModelVersion.Validate if the designated constraints aren't met.
type ModelVersionValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ModelVersionValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ModelVersionValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ModelVersionValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ModelVersionValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ModelVersionValidationError) ErrorName() string { return "ModelVersionValidationError" }
// Error satisfies the builtin error interface
func (e ModelVersionValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sModelVersion.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ModelVersionValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ModelVersionValidationError{}
// Validate checks the field values on ListModelVersionsRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListModelVersionsRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListModelVersionsRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListModelVersionsRequestMultiError, or nil if none found.
func (m *ListModelVersionsRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListModelVersionsRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := ListModelVersionsRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := ListModelVersionsRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ListModelVersionsRequestMultiError(errors)
}
return nil
}
// ListModelVersionsRequestMultiError is an error wrapping multiple validation
// errors returned by ListModelVersionsRequest.ValidateAll() if the designated
// constraints aren't met.
type ListModelVersionsRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListModelVersionsRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListModelVersionsRequestMultiError) AllErrors() []error { return m }
// ListModelVersionsRequestValidationError is the validation error returned by
// ListModelVersionsRequest.Validate if the designated constraints aren't met.
type ListModelVersionsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListModelVersionsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListModelVersionsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListModelVersionsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListModelVersionsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListModelVersionsRequestValidationError) ErrorName() string {
return "ListModelVersionsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListModelVersionsRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListModelVersionsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListModelVersionsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListModelVersionsRequestValidationError{}
// Validate checks the field values on ListModelVersionsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *ListModelVersionsResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListModelVersionsResponse with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ListModelVersionsResponseMultiError, or nil if none found.
func (m *ListModelVersionsResponse) ValidateAll() error {
return m.validate(true)
}
func (m *ListModelVersionsResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetModelVersions() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListModelVersionsResponseValidationError{
field: fmt.Sprintf("ModelVersions[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListModelVersionsResponseValidationError{
field: fmt.Sprintf("ModelVersions[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ListModelVersionsResponseValidationError{
field: fmt.Sprintf("ModelVersions[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListModelVersionsResponseMultiError(errors)
}
return nil
}
// ListModelVersionsResponseMultiError is an error wrapping multiple validation
// errors returned by ListModelVersionsResponse.ValidateAll() if the
// designated constraints aren't met.
type ListModelVersionsResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListModelVersionsResponseMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ListModelVersionsResponseMultiError) AllErrors() []error { return m }
// ListModelVersionsResponseValidationError is the validation error returned by
// ListModelVersionsResponse.Validate if the designated constraints aren't met.
type ListModelVersionsResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListModelVersionsResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListModelVersionsResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListModelVersionsResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListModelVersionsResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListModelVersionsResponseValidationError) ErrorName() string {
return "ListModelVersionsResponseValidationError"
}
// Error satisfies the builtin error interface
func (e ListModelVersionsResponseValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sListModelVersionsResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListModelVersionsResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListModelVersionsResponseValidationError{}
// Validate checks the field values on GetModelVersionRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *GetModelVersionRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetModelVersionRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// GetModelVersionRequestMultiError, or nil if none found.
func (m *GetModelVersionRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetModelVersionRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := GetModelVersionRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := GetModelVersionRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelVersionId()); l < 1 || l > 1024 {
err := GetModelVersionRequestValidationError{
field: "ModelVersionId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return GetModelVersionRequestMultiError(errors)
}
return nil
}
// GetModelVersionRequestMultiError is an error wrapping multiple validation
// errors returned by GetModelVersionRequest.ValidateAll() if the designated
// constraints aren't met.
type GetModelVersionRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetModelVersionRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m GetModelVersionRequestMultiError) AllErrors() []error { return m }
// GetModelVersionRequestValidationError is the validation error returned by
// GetModelVersionRequest.Validate if the designated constraints aren't met.
type GetModelVersionRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetModelVersionRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetModelVersionRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetModelVersionRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetModelVersionRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetModelVersionRequestValidationError) ErrorName() string {
return "GetModelVersionRequestValidationError"
}
// Error satisfies the builtin error interface
func (e GetModelVersionRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sGetModelVersionRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetModelVersionRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetModelVersionRequestValidationError{}
// Validate checks the field values on CreateModelVersionRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *CreateModelVersionRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on CreateModelVersionRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// CreateModelVersionRequestMultiError, or nil if none found.
func (m *CreateModelVersionRequest) ValidateAll() error {
return m.validate(true)
}
func (m *CreateModelVersionRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetId()); l < 1 || l > 1024 {
err := CreateModelVersionRequestValidationError{
field: "Id",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := CreateModelVersionRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := CreateModelVersionRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(m.GetDate()) < 1 {
err := CreateModelVersionRequestValidationError{
field: "Date",
reason: "value length must be at least 1 bytes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetMae() < 0 {
err := CreateModelVersionRequestValidationError{
field: "Mae",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetMse() < 0 {
err := CreateModelVersionRequestValidationError{
field: "Mse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetRmse() < 0 {
err := CreateModelVersionRequestValidationError{
field: "Rmse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetR2() < 0 {
err := CreateModelVersionRequestValidationError{
field: "R2",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return CreateModelVersionRequestMultiError(errors)
}
return nil
}
// CreateModelVersionRequestMultiError is an error wrapping multiple validation
// errors returned by CreateModelVersionRequest.ValidateAll() if the
// designated constraints aren't met.
type CreateModelVersionRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m CreateModelVersionRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m CreateModelVersionRequestMultiError) AllErrors() []error { return m }
// CreateModelVersionRequestValidationError is the validation error returned by
// CreateModelVersionRequest.Validate if the designated constraints aren't met.
type CreateModelVersionRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CreateModelVersionRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CreateModelVersionRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CreateModelVersionRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CreateModelVersionRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CreateModelVersionRequestValidationError) ErrorName() string {
return "CreateModelVersionRequestValidationError"
}
// Error satisfies the builtin error interface
func (e CreateModelVersionRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sCreateModelVersionRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CreateModelVersionRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CreateModelVersionRequestValidationError{}
// Validate checks the field values on UpdateModelVersionRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *UpdateModelVersionRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdateModelVersionRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// UpdateModelVersionRequestMultiError, or nil if none found.
func (m *UpdateModelVersionRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UpdateModelVersionRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetId()); l < 1 || l > 1024 {
err := UpdateModelVersionRequestValidationError{
field: "Id",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := UpdateModelVersionRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := UpdateModelVersionRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(m.GetDate()) > 0 {
if len(m.GetDate()) < 1 {
err := UpdateModelVersionRequestValidationError{
field: "Date",
reason: "value length must be at least 1 bytes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetMae() != 0 {
if m.GetMae() < 0 {
err := UpdateModelVersionRequestValidationError{
field: "Mae",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetMse() != 0 {
if m.GetMse() < 0 {
err := UpdateModelVersionRequestValidationError{
field: "Mse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetRmse() != 0 {
if m.GetRmse() < 0 {
err := UpdateModelVersionRequestValidationError{
field: "Rmse",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if m.GetR2() != 0 {
if m.GetR2() < 0 {
err := UpdateModelVersionRequestValidationError{
field: "R2",
reason: "value must be greater than or equal to 0",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return UpdateModelVersionRequestMultiError(errors)
}
return nil
}
// UpdateModelVersionRequestMultiError is an error wrapping multiple validation
// errors returned by UpdateModelVersionRequest.ValidateAll() if the
// designated constraints aren't met.
type UpdateModelVersionRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdateModelVersionRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m UpdateModelVersionRequestMultiError) AllErrors() []error { return m }
// UpdateModelVersionRequestValidationError is the validation error returned by
// UpdateModelVersionRequest.Validate if the designated constraints aren't met.
type UpdateModelVersionRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateModelVersionRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateModelVersionRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateModelVersionRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateModelVersionRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateModelVersionRequestValidationError) ErrorName() string {
return "UpdateModelVersionRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UpdateModelVersionRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUpdateModelVersionRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateModelVersionRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateModelVersionRequestValidationError{}
// Validate checks the field values on DeleteModelVersionRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *DeleteModelVersionRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteModelVersionRequest with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// DeleteModelVersionRequestMultiError, or nil if none found.
func (m *DeleteModelVersionRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteModelVersionRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if l := utf8.RuneCountInString(m.GetSchedulerId()); l < 1 || l > 1024 {
err := DeleteModelVersionRequestValidationError{
field: "SchedulerId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelId()); l < 1 || l > 1024 {
err := DeleteModelVersionRequestValidationError{
field: "ModelId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if l := utf8.RuneCountInString(m.GetModelVersionId()); l < 1 || l > 1024 {
err := DeleteModelVersionRequestValidationError{
field: "ModelVersionId",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteModelVersionRequestMultiError(errors)
}
return nil
}
// DeleteModelVersionRequestMultiError is an error wrapping multiple validation
// errors returned by DeleteModelVersionRequest.ValidateAll() if the
// designated constraints aren't met.
type DeleteModelVersionRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteModelVersionRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m DeleteModelVersionRequestMultiError) AllErrors() []error { return m }
// DeleteModelVersionRequestValidationError is the validation error returned by
// DeleteModelVersionRequest.Validate if the designated constraints aren't met.
type DeleteModelVersionRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteModelVersionRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteModelVersionRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteModelVersionRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteModelVersionRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteModelVersionRequestValidationError) ErrorName() string {
return "DeleteModelVersionRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteModelVersionRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sDeleteModelVersionRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteModelVersionRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteModelVersionRequestValidationError{}
// Validate checks the field values on KeepAliveRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *KeepAliveRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on KeepAliveRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// KeepAliveRequestMultiError, or nil if none found.
func (m *KeepAliveRequest) ValidateAll() error {
return m.validate(true)
}
func (m *KeepAliveRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
err := KeepAliveRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
if !all {
return err
}
errors = append(errors, err)
}
if err := m._validateHostname(m.GetHostName()); err != nil {
err = KeepAliveRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetClusterId() < 1 {
err := KeepAliveRequestValidationError{
field: "ClusterId",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetIp() != "" {
if ip := net.ParseIP(m.GetIp()); ip == nil {
err := KeepAliveRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return KeepAliveRequestMultiError(errors)
}
return nil
}
func (m *KeepAliveRequest) _validateHostname(host string) error {
s := strings.ToLower(strings.TrimSuffix(host, "."))
if len(host) > 253 {
return errors.New("hostname cannot exceed 253 characters")
}
for _, part := range strings.Split(s, ".") {
if l := len(part); l == 0 || l > 63 {
return errors.New("hostname part must be non-empty and cannot exceed 63 characters")
}
if part[0] == '-' {
return errors.New("hostname parts cannot begin with hyphens")
}
if part[len(part)-1] == '-' {
return errors.New("hostname parts cannot end with hyphens")
}
for _, r := range part {
if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' {
return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r))
}
}
}
return nil
}
// KeepAliveRequestMultiError is an error wrapping multiple validation errors
// returned by KeepAliveRequest.ValidateAll() if the designated constraints
// aren't met.
type KeepAliveRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m KeepAliveRequestMultiError) Error() string {
var msgs []string
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m KeepAliveRequestMultiError) AllErrors() []error { return m }
// KeepAliveRequestValidationError is the validation error returned by
// KeepAliveRequest.Validate if the designated constraints aren't met.
type KeepAliveRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e KeepAliveRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e KeepAliveRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e KeepAliveRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e KeepAliveRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e KeepAliveRequestValidationError) ErrorName() string { return "KeepAliveRequestValidationError" }
// Error satisfies the builtin error interface
func (e KeepAliveRequestValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sKeepAliveRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = KeepAliveRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = KeepAliveRequestValidationError{}