1958 lines
47 KiB
Go
1958 lines
47 KiB
Go
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
// source: pkg/rpc/manager/manager.proto
|
|
|
|
package manager
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"fmt"
|
|
"net"
|
|
"net/mail"
|
|
"net/url"
|
|
"regexp"
|
|
"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{}
|
|
)
|
|
|
|
// Validate checks the field values on SecurityGroup with the rules defined in
|
|
// the proto definition for this message. If any rules are violated, an error
|
|
// is returned.
|
|
func (m *SecurityGroup) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
// 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
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an
|
|
// error is returned.
|
|
func (m *SeedPeerCluster) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
// 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 v, ok := any(m.GetSecurityGroup()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return SeedPeerClusterValidationError{
|
|
field: "SecurityGroup",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *SeedPeer) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
// 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 v, ok := any(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 v, ok := any(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
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *GetSeedPeerRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return GetSeedPeerRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return GetSeedPeerRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if m.GetSeedPeerClusterId() < 1 {
|
|
return GetSeedPeerRequestValidationError{
|
|
field: "SeedPeerClusterId",
|
|
reason: "value must be greater than or equal to 1",
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *UpdateSeedPeerRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if _, ok := _UpdateSeedPeerRequest_Type_InLookup[m.GetType()]; !ok {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "Type",
|
|
reason: "value must be in list [super strong weak]",
|
|
}
|
|
}
|
|
|
|
if m.GetIdc() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "Idc",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetNetTopology() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "NetTopology",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetLocation() != "" {
|
|
|
|
if utf8.RuneCountInString(m.GetLocation()) > 1024 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "Location",
|
|
reason: "value length must be at most 1024 runes",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "Ip",
|
|
reason: "value must be a valid IP address",
|
|
}
|
|
}
|
|
|
|
if val := m.GetPort(); val < 1024 || val >= 65535 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "Port",
|
|
reason: "value must be inside range [1024, 65535)",
|
|
}
|
|
}
|
|
|
|
if val := m.GetDownloadPort(); val < 1024 || val >= 65535 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "DownloadPort",
|
|
reason: "value must be inside range [1024, 65535)",
|
|
}
|
|
}
|
|
|
|
if m.GetSeedPeerClusterId() < 1 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "SeedPeerClusterId",
|
|
reason: "value must be greater than or equal to 1",
|
|
}
|
|
}
|
|
|
|
if m.GetObjectStoragePort() != 0 {
|
|
|
|
if val := m.GetObjectStoragePort(); val < 1024 || val >= 65535 {
|
|
return UpdateSeedPeerRequestValidationError{
|
|
field: "ObjectStoragePort",
|
|
reason: "value must be inside range [1024, 65535)",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an
|
|
// error is returned.
|
|
func (m *SchedulerCluster) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
// 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 v, ok := any(m.GetSecurityGroup()).(interface{ Validate() error }); ok {
|
|
if err := v.Validate(); err != nil {
|
|
return SchedulerClusterValidationError{
|
|
field: "SecurityGroup",
|
|
reason: "embedded message failed validation",
|
|
cause: err,
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *Scheduler) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
// 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 v, ok := any(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 v, ok := any(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
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *GetSchedulerRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return GetSchedulerRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return GetSchedulerRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if m.GetSchedulerClusterId() < 1 {
|
|
return GetSchedulerRequestValidationError{
|
|
field: "SchedulerClusterId",
|
|
reason: "value must be greater than or equal to 1",
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *UpdateSchedulerRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if m.GetSchedulerClusterId() < 1 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "SchedulerClusterId",
|
|
reason: "value must be greater than or equal to 1",
|
|
}
|
|
}
|
|
|
|
if m.GetVips() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetVips()); l < 1 || l > 1024 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "Vips",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetIdc() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "Idc",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetLocation() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetLocation()); l < 1 || l > 1024 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "Location",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if len(m.GetNetConfig()) > 0 {
|
|
|
|
if len(m.GetNetConfig()) < 1 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "NetConfig",
|
|
reason: "value length must be at least 1 bytes",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "Ip",
|
|
reason: "value must be a valid IP address",
|
|
}
|
|
}
|
|
|
|
if val := m.GetPort(); val < 1024 || val >= 65535 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "Port",
|
|
reason: "value must be inside range [1024, 65535)",
|
|
}
|
|
}
|
|
|
|
if m.GetNetTopology() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetNetTopology()); l < 1 || l > 1024 {
|
|
return UpdateSchedulerRequestValidationError{
|
|
field: "NetTopology",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *ListSchedulersRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return ListSchedulersRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return ListSchedulersRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
|
return ListSchedulersRequestValidationError{
|
|
field: "Ip",
|
|
reason: "value must be a valid IP address",
|
|
}
|
|
}
|
|
|
|
if len(m.GetHostInfo()) > 0 {
|
|
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *ListSchedulersResponse) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
for idx, item := range m.GetSchedulers() {
|
|
_, _ = idx, item
|
|
|
|
if v, ok := any(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,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error
|
|
// is returned.
|
|
func (m *ObjectStorage) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
|
|
return ObjectStorageValidationError{
|
|
field: "Name",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
if m.GetRegion() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetRegion()); l < 1 || l > 1024 {
|
|
return ObjectStorageValidationError{
|
|
field: "Region",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetEndpoint() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetEndpoint()); l < 1 || l > 1024 {
|
|
return ObjectStorageValidationError{
|
|
field: "Endpoint",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetAccessKey() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetAccessKey()); l < 1 || l > 1024 {
|
|
return ObjectStorageValidationError{
|
|
field: "AccessKey",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if m.GetSecretKey() != "" {
|
|
|
|
if l := utf8.RuneCountInString(m.GetSecretKey()); l < 1 || l > 1024 {
|
|
return ObjectStorageValidationError{
|
|
field: "SecretKey",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *GetObjectStorageRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return GetObjectStorageRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return GetObjectStorageRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
|
return GetObjectStorageRequestValidationError{
|
|
field: "Ip",
|
|
reason: "value must be a valid IP address",
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *Bucket) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 {
|
|
return BucketValidationError{
|
|
field: "Name",
|
|
reason: "value length must be between 1 and 1024 runes, inclusive",
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *ListBucketsRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return ListBucketsRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return ListBucketsRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if ip := net.ParseIP(m.GetIp()); ip == nil {
|
|
return ListBucketsRequestValidationError{
|
|
field: "Ip",
|
|
reason: "value must be a valid IP address",
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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, an error is returned.
|
|
func (m *ListBucketsResponse) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
for idx, item := range m.GetBuckets() {
|
|
_, _ = idx, item
|
|
|
|
if v, ok := any(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,
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// 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, an
|
|
// error is returned.
|
|
func (m *KeepAliveRequest) Validate() error {
|
|
if m == nil {
|
|
return nil
|
|
}
|
|
|
|
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
|
|
return KeepAliveRequestValidationError{
|
|
field: "SourceType",
|
|
reason: "value must be one of the defined enum values",
|
|
}
|
|
}
|
|
|
|
if err := m._validateHostname(m.GetHostName()); err != nil {
|
|
return KeepAliveRequestValidationError{
|
|
field: "HostName",
|
|
reason: "value must be a valid hostname",
|
|
cause: err,
|
|
}
|
|
}
|
|
|
|
if m.GetClusterId() < 1 {
|
|
return KeepAliveRequestValidationError{
|
|
field: "ClusterId",
|
|
reason: "value must be greater than or equal to 1",
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// 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{}
|