dragonfly/pkg/rpc/manager/manager.pb.validate.go

1373 lines
33 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 CDNCluster with the rules defined in the
// proto definition for this message. If any rules are violated, an error is returned.
func (m *CDNCluster) 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
if v, ok := interface{}(m.GetSecurityGroup()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CDNClusterValidationError{
field: "SecurityGroup",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// CDNClusterValidationError is the validation error returned by
// CDNCluster.Validate if the designated constraints aren't met.
type CDNClusterValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CDNClusterValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CDNClusterValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CDNClusterValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CDNClusterValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CDNClusterValidationError) ErrorName() string { return "CDNClusterValidationError" }
// Error satisfies the builtin error interface
func (e CDNClusterValidationError) 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 %sCDNCluster.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CDNClusterValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CDNClusterValidationError{}
// 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 CDN with the rules defined in the proto
// definition for this message. If any rules are violated, an error is returned.
func (m *CDN) Validate() error {
if m == nil {
return nil
}
// no validation rules for Id
// no validation rules for HostName
// no validation rules for Idc
// 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 CdnClusterId
if v, ok := interface{}(m.GetCdnCluster()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return CDNValidationError{
field: "CdnCluster",
reason: "embedded message failed validation",
cause: err,
}
}
}
return nil
}
// CDNValidationError is the validation error returned by CDN.Validate if the
// designated constraints aren't met.
type CDNValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CDNValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CDNValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CDNValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CDNValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CDNValidationError) ErrorName() string { return "CDNValidationError" }
// Error satisfies the builtin error interface
func (e CDNValidationError) 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 %sCDN.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CDNValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CDNValidationError{}
// Validate checks the field values on GetCDNRequest with the rules defined in
// the proto definition for this message. If any rules are violated, an error
// is returned.
func (m *GetCDNRequest) Validate() error {
if m == nil {
return nil
}
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
return GetCDNRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
}
if err := m._validateHostname(m.GetHostName()); err != nil {
return GetCDNRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
}
if m.GetCdnClusterId() < 1 {
return GetCDNRequestValidationError{
field: "CdnClusterId",
reason: "value must be greater than or equal to 1",
}
}
return nil
}
func (m *GetCDNRequest) _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
}
// GetCDNRequestValidationError is the validation error returned by
// GetCDNRequest.Validate if the designated constraints aren't met.
type GetCDNRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetCDNRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetCDNRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetCDNRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetCDNRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetCDNRequestValidationError) ErrorName() string { return "GetCDNRequestValidationError" }
// Error satisfies the builtin error interface
func (e GetCDNRequestValidationError) 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 %sGetCDNRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetCDNRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetCDNRequestValidationError{}
// Validate checks the field values on UpdateCDNRequest with the rules defined
// in the proto definition for this message. If any rules are violated, an
// error is returned.
func (m *UpdateCDNRequest) Validate() error {
if m == nil {
return nil
}
if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok {
return UpdateCDNRequestValidationError{
field: "SourceType",
reason: "value must be one of the defined enum values",
}
}
if err := m._validateHostname(m.GetHostName()); err != nil {
return UpdateCDNRequestValidationError{
field: "HostName",
reason: "value must be a valid hostname",
cause: err,
}
}
if m.GetIdc() != "" {
if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 {
return UpdateCDNRequestValidationError{
field: "Idc",
reason: "value length must be between 1 and 1024 runes, inclusive",
}
}
}
if m.GetLocation() != "" {
if utf8.RuneCountInString(m.GetLocation()) > 1024 {
return UpdateCDNRequestValidationError{
field: "Location",
reason: "value length must be at most 1024 runes",
}
}
}
if ip := net.ParseIP(m.GetIp()); ip == nil {
return UpdateCDNRequestValidationError{
field: "Ip",
reason: "value must be a valid IP address",
}
}
if val := m.GetPort(); val < 1024 || val >= 65535 {
return UpdateCDNRequestValidationError{
field: "Port",
reason: "value must be inside range [1024, 65535)",
}
}
if val := m.GetDownloadPort(); val < 1024 || val >= 65535 {
return UpdateCDNRequestValidationError{
field: "DownloadPort",
reason: "value must be inside range [1024, 65535)",
}
}
if m.GetCdnClusterId() < 1 {
return UpdateCDNRequestValidationError{
field: "CdnClusterId",
reason: "value must be greater than or equal to 1",
}
}
return nil
}
func (m *UpdateCDNRequest) _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
}
// UpdateCDNRequestValidationError is the validation error returned by
// UpdateCDNRequest.Validate if the designated constraints aren't met.
type UpdateCDNRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdateCDNRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdateCDNRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdateCDNRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdateCDNRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdateCDNRequestValidationError) ErrorName() string { return "UpdateCDNRequestValidationError" }
// Error satisfies the builtin error interface
func (e UpdateCDNRequestValidationError) 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 %sUpdateCDNRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdateCDNRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdateCDNRequestValidationError{}
// 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
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,
}
}
}
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 := 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.GetCdns() {
_, _ = idx, item
if v, ok := interface{}(item).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SchedulerValidationError{
field: fmt.Sprintf("Cdns[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
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.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 utf8.RuneCountInString(m.GetLocation()) > 1024 {
return UpdateSchedulerRequestValidationError{
field: "Location",
reason: "value length must be at most 1024 runes",
}
}
}
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.GetSchedulerClusterId() < 1 {
return UpdateSchedulerRequestValidationError{
field: "SchedulerClusterId",
reason: "value must be greater than or equal to 1",
}
}
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 := 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,
}
}
}
}
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 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{}