mirror of https://github.com/dragonflyoss/api.git
2931 lines
74 KiB
Go
2931 lines
74 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 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{}
|