api/pkg/apis/scheduler/v2/scheduler.pb.validate.go

7340 lines
201 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkg/apis/scheduler/v2/scheduler.proto
package scheduler
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 RegisterPeerRequest 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 *RegisterPeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on RegisterPeerRequest 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
// RegisterPeerRequestMultiError, or nil if none found.
func (m *RegisterPeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *RegisterPeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetDownload() == nil {
err := RegisterPeerRequestValidationError{
field: "Download",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetDownload()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RegisterPeerRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RegisterPeerRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownload()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RegisterPeerRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return RegisterPeerRequestMultiError(errors)
}
return nil
}
// RegisterPeerRequestMultiError is an error wrapping multiple validation
// errors returned by RegisterPeerRequest.ValidateAll() if the designated
// constraints aren't met.
type RegisterPeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m RegisterPeerRequestMultiError) 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 RegisterPeerRequestMultiError) AllErrors() []error { return m }
// RegisterPeerRequestValidationError is the validation error returned by
// RegisterPeerRequest.Validate if the designated constraints aren't met.
type RegisterPeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e RegisterPeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e RegisterPeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e RegisterPeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e RegisterPeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e RegisterPeerRequestValidationError) ErrorName() string {
return "RegisterPeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e RegisterPeerRequestValidationError) 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 %sRegisterPeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = RegisterPeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = RegisterPeerRequestValidationError{}
// Validate checks the field values on DownloadPeerStartedRequest 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 *DownloadPeerStartedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPeerStartedRequest 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
// DownloadPeerStartedRequestMultiError, or nil if none found.
func (m *DownloadPeerStartedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerStartedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return DownloadPeerStartedRequestMultiError(errors)
}
return nil
}
// DownloadPeerStartedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadPeerStartedRequest.ValidateAll() if
// the designated constraints aren't met.
type DownloadPeerStartedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerStartedRequestMultiError) 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 DownloadPeerStartedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerStartedRequestValidationError is the validation error returned
// by DownloadPeerStartedRequest.Validate if the designated constraints aren't met.
type DownloadPeerStartedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerStartedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerStartedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerStartedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerStartedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerStartedRequestValidationError) ErrorName() string {
return "DownloadPeerStartedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerStartedRequestValidationError) 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 %sDownloadPeerStartedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerStartedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerStartedRequestValidationError{}
// Validate checks the field values on DownloadPeerBackToSourceStartedRequest
// 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 *DownloadPeerBackToSourceStartedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on
// DownloadPeerBackToSourceStartedRequest 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
// DownloadPeerBackToSourceStartedRequestMultiError, or nil if none found.
func (m *DownloadPeerBackToSourceStartedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerBackToSourceStartedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := DownloadPeerBackToSourceStartedRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return DownloadPeerBackToSourceStartedRequestMultiError(errors)
}
return nil
}
// DownloadPeerBackToSourceStartedRequestMultiError is an error wrapping
// multiple validation errors returned by
// DownloadPeerBackToSourceStartedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadPeerBackToSourceStartedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerBackToSourceStartedRequestMultiError) 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 DownloadPeerBackToSourceStartedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerBackToSourceStartedRequestValidationError is the validation
// error returned by DownloadPeerBackToSourceStartedRequest.Validate if the
// designated constraints aren't met.
type DownloadPeerBackToSourceStartedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerBackToSourceStartedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerBackToSourceStartedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerBackToSourceStartedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerBackToSourceStartedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerBackToSourceStartedRequestValidationError) ErrorName() string {
return "DownloadPeerBackToSourceStartedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerBackToSourceStartedRequestValidationError) 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 %sDownloadPeerBackToSourceStartedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerBackToSourceStartedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerBackToSourceStartedRequestValidationError{}
// Validate checks the field values on ReschedulePeerRequest 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 *ReschedulePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ReschedulePeerRequest 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
// ReschedulePeerRequestMultiError, or nil if none found.
func (m *ReschedulePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ReschedulePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetCandidateParents() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ReschedulePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ReschedulePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%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 ReschedulePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := ReschedulePeerRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return ReschedulePeerRequestMultiError(errors)
}
return nil
}
// ReschedulePeerRequestMultiError is an error wrapping multiple validation
// errors returned by ReschedulePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type ReschedulePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ReschedulePeerRequestMultiError) 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 ReschedulePeerRequestMultiError) AllErrors() []error { return m }
// ReschedulePeerRequestValidationError is the validation error returned by
// ReschedulePeerRequest.Validate if the designated constraints aren't met.
type ReschedulePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ReschedulePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ReschedulePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ReschedulePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ReschedulePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ReschedulePeerRequestValidationError) ErrorName() string {
return "ReschedulePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ReschedulePeerRequestValidationError) 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 %sReschedulePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ReschedulePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ReschedulePeerRequestValidationError{}
// Validate checks the field values on DownloadPeerFinishedRequest 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 *DownloadPeerFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPeerFinishedRequest 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
// DownloadPeerFinishedRequestMultiError, or nil if none found.
func (m *DownloadPeerFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for ContentLength
// no validation rules for PieceCount
if len(errors) > 0 {
return DownloadPeerFinishedRequestMultiError(errors)
}
return nil
}
// DownloadPeerFinishedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadPeerFinishedRequest.ValidateAll() if
// the designated constraints aren't met.
type DownloadPeerFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerFinishedRequestMultiError) 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 DownloadPeerFinishedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerFinishedRequestValidationError is the validation error returned
// by DownloadPeerFinishedRequest.Validate if the designated constraints
// aren't met.
type DownloadPeerFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerFinishedRequestValidationError) ErrorName() string {
return "DownloadPeerFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerFinishedRequestValidationError) 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 %sDownloadPeerFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerFinishedRequestValidationError{}
// Validate checks the field values on DownloadPeerBackToSourceFinishedRequest
// 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 *DownloadPeerBackToSourceFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on
// DownloadPeerBackToSourceFinishedRequest 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
// DownloadPeerBackToSourceFinishedRequestMultiError, or nil if none found.
func (m *DownloadPeerBackToSourceFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerBackToSourceFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for ContentLength
// no validation rules for PieceCount
if len(errors) > 0 {
return DownloadPeerBackToSourceFinishedRequestMultiError(errors)
}
return nil
}
// DownloadPeerBackToSourceFinishedRequestMultiError is an error wrapping
// multiple validation errors returned by
// DownloadPeerBackToSourceFinishedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadPeerBackToSourceFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerBackToSourceFinishedRequestMultiError) 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 DownloadPeerBackToSourceFinishedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerBackToSourceFinishedRequestValidationError is the validation
// error returned by DownloadPeerBackToSourceFinishedRequest.Validate if the
// designated constraints aren't met.
type DownloadPeerBackToSourceFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerBackToSourceFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerBackToSourceFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerBackToSourceFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerBackToSourceFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerBackToSourceFinishedRequestValidationError) ErrorName() string {
return "DownloadPeerBackToSourceFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerBackToSourceFinishedRequestValidationError) 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 %sDownloadPeerBackToSourceFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerBackToSourceFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerBackToSourceFinishedRequestValidationError{}
// Validate checks the field values on DownloadPeerFailedRequest 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 *DownloadPeerFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPeerFailedRequest 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
// DownloadPeerFailedRequestMultiError, or nil if none found.
func (m *DownloadPeerFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := DownloadPeerFailedRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return DownloadPeerFailedRequestMultiError(errors)
}
return nil
}
// DownloadPeerFailedRequestMultiError is an error wrapping multiple validation
// errors returned by DownloadPeerFailedRequest.ValidateAll() if the
// designated constraints aren't met.
type DownloadPeerFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerFailedRequestMultiError) 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 DownloadPeerFailedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerFailedRequestValidationError is the validation error returned by
// DownloadPeerFailedRequest.Validate if the designated constraints aren't met.
type DownloadPeerFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerFailedRequestValidationError) ErrorName() string {
return "DownloadPeerFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerFailedRequestValidationError) 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 %sDownloadPeerFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerFailedRequestValidationError{}
// Validate checks the field values on DownloadPeerBackToSourceFailedRequest
// 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 *DownloadPeerBackToSourceFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPeerBackToSourceFailedRequest
// 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
// DownloadPeerBackToSourceFailedRequestMultiError, or nil if none found.
func (m *DownloadPeerBackToSourceFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPeerBackToSourceFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := DownloadPeerBackToSourceFailedRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return DownloadPeerBackToSourceFailedRequestMultiError(errors)
}
return nil
}
// DownloadPeerBackToSourceFailedRequestMultiError is an error wrapping
// multiple validation errors returned by
// DownloadPeerBackToSourceFailedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadPeerBackToSourceFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPeerBackToSourceFailedRequestMultiError) 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 DownloadPeerBackToSourceFailedRequestMultiError) AllErrors() []error { return m }
// DownloadPeerBackToSourceFailedRequestValidationError is the validation error
// returned by DownloadPeerBackToSourceFailedRequest.Validate if the
// designated constraints aren't met.
type DownloadPeerBackToSourceFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPeerBackToSourceFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPeerBackToSourceFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPeerBackToSourceFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPeerBackToSourceFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPeerBackToSourceFailedRequestValidationError) ErrorName() string {
return "DownloadPeerBackToSourceFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPeerBackToSourceFailedRequestValidationError) 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 %sDownloadPeerBackToSourceFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPeerBackToSourceFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPeerBackToSourceFailedRequestValidationError{}
// Validate checks the field values on DownloadPieceFinishedRequest 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 *DownloadPieceFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPieceFinishedRequest 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
// DownloadPieceFinishedRequestMultiError, or nil if none found.
func (m *DownloadPieceFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPieceFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetPiece() == nil {
err := DownloadPieceFinishedRequestValidationError{
field: "Piece",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetPiece()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, DownloadPieceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, DownloadPieceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DownloadPieceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return DownloadPieceFinishedRequestMultiError(errors)
}
return nil
}
// DownloadPieceFinishedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadPieceFinishedRequest.ValidateAll() if
// the designated constraints aren't met.
type DownloadPieceFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPieceFinishedRequestMultiError) 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 DownloadPieceFinishedRequestMultiError) AllErrors() []error { return m }
// DownloadPieceFinishedRequestValidationError is the validation error returned
// by DownloadPieceFinishedRequest.Validate if the designated constraints
// aren't met.
type DownloadPieceFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPieceFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPieceFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPieceFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPieceFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPieceFinishedRequestValidationError) ErrorName() string {
return "DownloadPieceFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPieceFinishedRequestValidationError) 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 %sDownloadPieceFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPieceFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPieceFinishedRequestValidationError{}
// Validate checks the field values on DownloadPieceBackToSourceFinishedRequest
// 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 *DownloadPieceBackToSourceFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on
// DownloadPieceBackToSourceFinishedRequest 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
// DownloadPieceBackToSourceFinishedRequestMultiError, or nil if none found.
func (m *DownloadPieceBackToSourceFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPieceBackToSourceFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetPiece() == nil {
err := DownloadPieceBackToSourceFinishedRequestValidationError{
field: "Piece",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetPiece()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, DownloadPieceBackToSourceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, DownloadPieceBackToSourceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DownloadPieceBackToSourceFinishedRequestValidationError{
field: "Piece",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return DownloadPieceBackToSourceFinishedRequestMultiError(errors)
}
return nil
}
// DownloadPieceBackToSourceFinishedRequestMultiError is an error wrapping
// multiple validation errors returned by
// DownloadPieceBackToSourceFinishedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadPieceBackToSourceFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPieceBackToSourceFinishedRequestMultiError) 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 DownloadPieceBackToSourceFinishedRequestMultiError) AllErrors() []error { return m }
// DownloadPieceBackToSourceFinishedRequestValidationError is the validation
// error returned by DownloadPieceBackToSourceFinishedRequest.Validate if the
// designated constraints aren't met.
type DownloadPieceBackToSourceFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPieceBackToSourceFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPieceBackToSourceFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPieceBackToSourceFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPieceBackToSourceFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPieceBackToSourceFinishedRequestValidationError) ErrorName() string {
return "DownloadPieceBackToSourceFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPieceBackToSourceFinishedRequestValidationError) 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 %sDownloadPieceBackToSourceFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPieceBackToSourceFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPieceBackToSourceFinishedRequestValidationError{}
// Validate checks the field values on DownloadPieceFailedRequest 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 *DownloadPieceFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadPieceFailedRequest 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
// DownloadPieceFailedRequestMultiError, or nil if none found.
func (m *DownloadPieceFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPieceFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetParentId()) < 1 {
err := DownloadPieceFailedRequestValidationError{
field: "ParentId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for Temporary
if m.PieceNumber != nil {
// no validation rules for PieceNumber
}
if len(errors) > 0 {
return DownloadPieceFailedRequestMultiError(errors)
}
return nil
}
// DownloadPieceFailedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadPieceFailedRequest.ValidateAll() if
// the designated constraints aren't met.
type DownloadPieceFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPieceFailedRequestMultiError) 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 DownloadPieceFailedRequestMultiError) AllErrors() []error { return m }
// DownloadPieceFailedRequestValidationError is the validation error returned
// by DownloadPieceFailedRequest.Validate if the designated constraints aren't met.
type DownloadPieceFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPieceFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPieceFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPieceFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPieceFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPieceFailedRequestValidationError) ErrorName() string {
return "DownloadPieceFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPieceFailedRequestValidationError) 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 %sDownloadPieceFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPieceFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPieceFailedRequestValidationError{}
// Validate checks the field values on DownloadPieceBackToSourceFailedRequest
// 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 *DownloadPieceBackToSourceFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on
// DownloadPieceBackToSourceFailedRequest 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
// DownloadPieceBackToSourceFailedRequestMultiError, or nil if none found.
func (m *DownloadPieceBackToSourceFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadPieceBackToSourceFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
oneofResponsePresent := false
switch v := m.Response.(type) {
case *DownloadPieceBackToSourceFailedRequest_Backend:
if v == nil {
err := DownloadPieceBackToSourceFailedRequestValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetBackend()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
field: "Backend",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{
field: "Backend",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetBackend()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DownloadPieceBackToSourceFailedRequestValidationError{
field: "Backend",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofResponsePresent {
err := DownloadPieceBackToSourceFailedRequestValidationError{
field: "Response",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.PieceNumber != nil {
// no validation rules for PieceNumber
}
if len(errors) > 0 {
return DownloadPieceBackToSourceFailedRequestMultiError(errors)
}
return nil
}
// DownloadPieceBackToSourceFailedRequestMultiError is an error wrapping
// multiple validation errors returned by
// DownloadPieceBackToSourceFailedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadPieceBackToSourceFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadPieceBackToSourceFailedRequestMultiError) 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 DownloadPieceBackToSourceFailedRequestMultiError) AllErrors() []error { return m }
// DownloadPieceBackToSourceFailedRequestValidationError is the validation
// error returned by DownloadPieceBackToSourceFailedRequest.Validate if the
// designated constraints aren't met.
type DownloadPieceBackToSourceFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadPieceBackToSourceFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadPieceBackToSourceFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadPieceBackToSourceFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadPieceBackToSourceFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadPieceBackToSourceFailedRequestValidationError) ErrorName() string {
return "DownloadPieceBackToSourceFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadPieceBackToSourceFailedRequestValidationError) 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 %sDownloadPieceBackToSourceFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadPieceBackToSourceFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadPieceBackToSourceFailedRequestValidationError{}
// Validate checks the field values on AnnouncePeerRequest 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 *AnnouncePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AnnouncePeerRequest 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
// AnnouncePeerRequestMultiError, or nil if none found.
func (m *AnnouncePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *AnnouncePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := AnnouncePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := AnnouncePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := AnnouncePeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent := false
switch v := m.Request.(type) {
case *AnnouncePeerRequest_RegisterPeerRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetRegisterPeerRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "RegisterPeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "RegisterPeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetRegisterPeerRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "RegisterPeerRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerStartedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerStartedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerStartedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerBackToSourceStartedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerBackToSourceStartedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerBackToSourceStartedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceStartedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_ReschedulePeerRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetReschedulePeerRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "ReschedulePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "ReschedulePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetReschedulePeerRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "ReschedulePeerRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerFinishedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerBackToSourceFinishedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerBackToSourceFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerBackToSourceFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerFailedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPeerBackToSourceFailedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPeerBackToSourceFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPeerBackToSourceFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPeerBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPieceFinishedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPieceBackToSourceFinishedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceBackToSourceFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceBackToSourceFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPieceFailedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerRequest_DownloadPieceBackToSourceFailedRequest:
if v == nil {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceBackToSourceFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceBackToSourceFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerRequestValidationError{
field: "DownloadPieceBackToSourceFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofRequestPresent {
err := AnnouncePeerRequestValidationError{
field: "Request",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AnnouncePeerRequestMultiError(errors)
}
return nil
}
// AnnouncePeerRequestMultiError is an error wrapping multiple validation
// errors returned by AnnouncePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type AnnouncePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AnnouncePeerRequestMultiError) 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 AnnouncePeerRequestMultiError) AllErrors() []error { return m }
// AnnouncePeerRequestValidationError is the validation error returned by
// AnnouncePeerRequest.Validate if the designated constraints aren't met.
type AnnouncePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AnnouncePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AnnouncePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AnnouncePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AnnouncePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AnnouncePeerRequestValidationError) ErrorName() string {
return "AnnouncePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e AnnouncePeerRequestValidationError) 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 %sAnnouncePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AnnouncePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AnnouncePeerRequestValidationError{}
// Validate checks the field values on EmptyTaskResponse 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 *EmptyTaskResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on EmptyTaskResponse 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
// EmptyTaskResponseMultiError, or nil if none found.
func (m *EmptyTaskResponse) ValidateAll() error {
return m.validate(true)
}
func (m *EmptyTaskResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return EmptyTaskResponseMultiError(errors)
}
return nil
}
// EmptyTaskResponseMultiError is an error wrapping multiple validation errors
// returned by EmptyTaskResponse.ValidateAll() if the designated constraints
// aren't met.
type EmptyTaskResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m EmptyTaskResponseMultiError) 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 EmptyTaskResponseMultiError) AllErrors() []error { return m }
// EmptyTaskResponseValidationError is the validation error returned by
// EmptyTaskResponse.Validate if the designated constraints aren't met.
type EmptyTaskResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e EmptyTaskResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e EmptyTaskResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e EmptyTaskResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e EmptyTaskResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e EmptyTaskResponseValidationError) ErrorName() string {
return "EmptyTaskResponseValidationError"
}
// Error satisfies the builtin error interface
func (e EmptyTaskResponseValidationError) 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 %sEmptyTaskResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = EmptyTaskResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = EmptyTaskResponseValidationError{}
// Validate checks the field values on NormalTaskResponse 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 *NormalTaskResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on NormalTaskResponse 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
// NormalTaskResponseMultiError, or nil if none found.
func (m *NormalTaskResponse) ValidateAll() error {
return m.validate(true)
}
func (m *NormalTaskResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetCandidateParents()) < 1 {
err := NormalTaskResponseValidationError{
field: "CandidateParents",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
for idx, item := range m.GetCandidateParents() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, NormalTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, NormalTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%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 NormalTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return NormalTaskResponseMultiError(errors)
}
return nil
}
// NormalTaskResponseMultiError is an error wrapping multiple validation errors
// returned by NormalTaskResponse.ValidateAll() if the designated constraints
// aren't met.
type NormalTaskResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m NormalTaskResponseMultiError) 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 NormalTaskResponseMultiError) AllErrors() []error { return m }
// NormalTaskResponseValidationError is the validation error returned by
// NormalTaskResponse.Validate if the designated constraints aren't met.
type NormalTaskResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e NormalTaskResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e NormalTaskResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e NormalTaskResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e NormalTaskResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e NormalTaskResponseValidationError) ErrorName() string {
return "NormalTaskResponseValidationError"
}
// Error satisfies the builtin error interface
func (e NormalTaskResponseValidationError) 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 %sNormalTaskResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = NormalTaskResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = NormalTaskResponseValidationError{}
// Validate checks the field values on NeedBackToSourceResponse 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 *NeedBackToSourceResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on NeedBackToSourceResponse 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
// NeedBackToSourceResponseMultiError, or nil if none found.
func (m *NeedBackToSourceResponse) ValidateAll() error {
return m.validate(true)
}
func (m *NeedBackToSourceResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := NeedBackToSourceResponseValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return NeedBackToSourceResponseMultiError(errors)
}
return nil
}
// NeedBackToSourceResponseMultiError is an error wrapping multiple validation
// errors returned by NeedBackToSourceResponse.ValidateAll() if the designated
// constraints aren't met.
type NeedBackToSourceResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m NeedBackToSourceResponseMultiError) 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 NeedBackToSourceResponseMultiError) AllErrors() []error { return m }
// NeedBackToSourceResponseValidationError is the validation error returned by
// NeedBackToSourceResponse.Validate if the designated constraints aren't met.
type NeedBackToSourceResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e NeedBackToSourceResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e NeedBackToSourceResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e NeedBackToSourceResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e NeedBackToSourceResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e NeedBackToSourceResponseValidationError) ErrorName() string {
return "NeedBackToSourceResponseValidationError"
}
// Error satisfies the builtin error interface
func (e NeedBackToSourceResponseValidationError) 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 %sNeedBackToSourceResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = NeedBackToSourceResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = NeedBackToSourceResponseValidationError{}
// Validate checks the field values on AnnouncePeerResponse 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 *AnnouncePeerResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AnnouncePeerResponse 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
// AnnouncePeerResponseMultiError, or nil if none found.
func (m *AnnouncePeerResponse) ValidateAll() error {
return m.validate(true)
}
func (m *AnnouncePeerResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
oneofResponsePresent := false
switch v := m.Response.(type) {
case *AnnouncePeerResponse_EmptyTaskResponse:
if v == nil {
err := AnnouncePeerResponseValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetEmptyTaskResponse()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetEmptyTaskResponse()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerResponse_NormalTaskResponse:
if v == nil {
err := AnnouncePeerResponseValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetNormalTaskResponse()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetNormalTaskResponse()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnouncePeerResponse_NeedBackToSourceResponse:
if v == nil {
err := AnnouncePeerResponseValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetNeedBackToSourceResponse()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "NeedBackToSourceResponse",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnouncePeerResponseValidationError{
field: "NeedBackToSourceResponse",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetNeedBackToSourceResponse()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnouncePeerResponseValidationError{
field: "NeedBackToSourceResponse",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofResponsePresent {
err := AnnouncePeerResponseValidationError{
field: "Response",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AnnouncePeerResponseMultiError(errors)
}
return nil
}
// AnnouncePeerResponseMultiError is an error wrapping multiple validation
// errors returned by AnnouncePeerResponse.ValidateAll() if the designated
// constraints aren't met.
type AnnouncePeerResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AnnouncePeerResponseMultiError) 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 AnnouncePeerResponseMultiError) AllErrors() []error { return m }
// AnnouncePeerResponseValidationError is the validation error returned by
// AnnouncePeerResponse.Validate if the designated constraints aren't met.
type AnnouncePeerResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AnnouncePeerResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AnnouncePeerResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AnnouncePeerResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AnnouncePeerResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AnnouncePeerResponseValidationError) ErrorName() string {
return "AnnouncePeerResponseValidationError"
}
// Error satisfies the builtin error interface
func (e AnnouncePeerResponseValidationError) 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 %sAnnouncePeerResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AnnouncePeerResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AnnouncePeerResponseValidationError{}
// Validate checks the field values on StatPeerRequest 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 *StatPeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on StatPeerRequest 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
// StatPeerRequestMultiError, or nil if none found.
func (m *StatPeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *StatPeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := StatPeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := StatPeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := StatPeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return StatPeerRequestMultiError(errors)
}
return nil
}
// StatPeerRequestMultiError is an error wrapping multiple validation errors
// returned by StatPeerRequest.ValidateAll() if the designated constraints
// aren't met.
type StatPeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m StatPeerRequestMultiError) 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 StatPeerRequestMultiError) AllErrors() []error { return m }
// StatPeerRequestValidationError is the validation error returned by
// StatPeerRequest.Validate if the designated constraints aren't met.
type StatPeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e StatPeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e StatPeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e StatPeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e StatPeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e StatPeerRequestValidationError) ErrorName() string { return "StatPeerRequestValidationError" }
// Error satisfies the builtin error interface
func (e StatPeerRequestValidationError) 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 %sStatPeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = StatPeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = StatPeerRequestValidationError{}
// Validate checks the field values on DeletePeerRequest 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 *DeletePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeletePeerRequest 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
// DeletePeerRequestMultiError, or nil if none found.
func (m *DeletePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeletePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := DeletePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := DeletePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := DeletePeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeletePeerRequestMultiError(errors)
}
return nil
}
// DeletePeerRequestMultiError is an error wrapping multiple validation errors
// returned by DeletePeerRequest.ValidateAll() if the designated constraints
// aren't met.
type DeletePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeletePeerRequestMultiError) 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 DeletePeerRequestMultiError) AllErrors() []error { return m }
// DeletePeerRequestValidationError is the validation error returned by
// DeletePeerRequest.Validate if the designated constraints aren't met.
type DeletePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeletePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeletePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeletePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeletePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeletePeerRequestValidationError) ErrorName() string {
return "DeletePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeletePeerRequestValidationError) 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 %sDeletePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeletePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeletePeerRequestValidationError{}
// Validate checks the field values on StatTaskRequest 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 *StatTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on StatTaskRequest 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
// StatTaskRequestMultiError, or nil if none found.
func (m *StatTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *StatTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := StatTaskRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return StatTaskRequestMultiError(errors)
}
return nil
}
// StatTaskRequestMultiError is an error wrapping multiple validation errors
// returned by StatTaskRequest.ValidateAll() if the designated constraints
// aren't met.
type StatTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m StatTaskRequestMultiError) 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 StatTaskRequestMultiError) AllErrors() []error { return m }
// StatTaskRequestValidationError is the validation error returned by
// StatTaskRequest.Validate if the designated constraints aren't met.
type StatTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e StatTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e StatTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e StatTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e StatTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e StatTaskRequestValidationError) ErrorName() string { return "StatTaskRequestValidationError" }
// Error satisfies the builtin error interface
func (e StatTaskRequestValidationError) 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 %sStatTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = StatTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = StatTaskRequestValidationError{}
// Validate checks the field values on DeleteTaskRequest 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 *DeleteTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteTaskRequest 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
// DeleteTaskRequestMultiError, or nil if none found.
func (m *DeleteTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := DeleteTaskRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := DeleteTaskRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteTaskRequestMultiError(errors)
}
return nil
}
// DeleteTaskRequestMultiError is an error wrapping multiple validation errors
// returned by DeleteTaskRequest.ValidateAll() if the designated constraints
// aren't met.
type DeleteTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteTaskRequestMultiError) 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 DeleteTaskRequestMultiError) AllErrors() []error { return m }
// DeleteTaskRequestValidationError is the validation error returned by
// DeleteTaskRequest.Validate if the designated constraints aren't met.
type DeleteTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteTaskRequestValidationError) ErrorName() string {
return "DeleteTaskRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteTaskRequestValidationError) 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 %sDeleteTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteTaskRequestValidationError{}
// Validate checks the field values on AnnounceHostRequest 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 *AnnounceHostRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AnnounceHostRequest 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
// AnnounceHostRequestMultiError, or nil if none found.
func (m *AnnounceHostRequest) ValidateAll() error {
return m.validate(true)
}
func (m *AnnounceHostRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetHost() == nil {
err := AnnounceHostRequestValidationError{
field: "Host",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetHost()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceHostRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceHostRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceHostRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.Interval != nil {
if all {
switch v := interface{}(m.GetInterval()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceHostRequestValidationError{
field: "Interval",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceHostRequestValidationError{
field: "Interval",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetInterval()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceHostRequestValidationError{
field: "Interval",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return AnnounceHostRequestMultiError(errors)
}
return nil
}
// AnnounceHostRequestMultiError is an error wrapping multiple validation
// errors returned by AnnounceHostRequest.ValidateAll() if the designated
// constraints aren't met.
type AnnounceHostRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AnnounceHostRequestMultiError) 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 AnnounceHostRequestMultiError) AllErrors() []error { return m }
// AnnounceHostRequestValidationError is the validation error returned by
// AnnounceHostRequest.Validate if the designated constraints aren't met.
type AnnounceHostRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AnnounceHostRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AnnounceHostRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AnnounceHostRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AnnounceHostRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AnnounceHostRequestValidationError) ErrorName() string {
return "AnnounceHostRequestValidationError"
}
// Error satisfies the builtin error interface
func (e AnnounceHostRequestValidationError) 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 %sAnnounceHostRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AnnounceHostRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AnnounceHostRequestValidationError{}
// Validate checks the field values on DeleteHostRequest 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 *DeleteHostRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteHostRequest 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
// DeleteHostRequestMultiError, or nil if none found.
func (m *DeleteHostRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteHostRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := DeleteHostRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteHostRequestMultiError(errors)
}
return nil
}
// DeleteHostRequestMultiError is an error wrapping multiple validation errors
// returned by DeleteHostRequest.ValidateAll() if the designated constraints
// aren't met.
type DeleteHostRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteHostRequestMultiError) 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 DeleteHostRequestMultiError) AllErrors() []error { return m }
// DeleteHostRequestValidationError is the validation error returned by
// DeleteHostRequest.Validate if the designated constraints aren't met.
type DeleteHostRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteHostRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteHostRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteHostRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteHostRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteHostRequestValidationError) ErrorName() string {
return "DeleteHostRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteHostRequestValidationError) 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 %sDeleteHostRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteHostRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteHostRequestValidationError{}
// Validate checks the field values on ProbeStartedRequest 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 *ProbeStartedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ProbeStartedRequest 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
// ProbeStartedRequestMultiError, or nil if none found.
func (m *ProbeStartedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ProbeStartedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return ProbeStartedRequestMultiError(errors)
}
return nil
}
// ProbeStartedRequestMultiError is an error wrapping multiple validation
// errors returned by ProbeStartedRequest.ValidateAll() if the designated
// constraints aren't met.
type ProbeStartedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ProbeStartedRequestMultiError) 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 ProbeStartedRequestMultiError) AllErrors() []error { return m }
// ProbeStartedRequestValidationError is the validation error returned by
// ProbeStartedRequest.Validate if the designated constraints aren't met.
type ProbeStartedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProbeStartedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProbeStartedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProbeStartedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProbeStartedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProbeStartedRequestValidationError) ErrorName() string {
return "ProbeStartedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ProbeStartedRequestValidationError) 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 %sProbeStartedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProbeStartedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProbeStartedRequestValidationError{}
// Validate checks the field values on Probe 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 *Probe) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Probe 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 ProbeMultiError, or nil if none found.
func (m *Probe) ValidateAll() error {
return m.validate(true)
}
func (m *Probe) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetHost() == nil {
err := ProbeValidationError{
field: "Host",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetHost()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.GetRtt() == nil {
err := ProbeValidationError{
field: "Rtt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetCreatedAt() == nil {
err := ProbeValidationError{
field: "CreatedAt",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ProbeMultiError(errors)
}
return nil
}
// ProbeMultiError is an error wrapping multiple validation errors returned by
// Probe.ValidateAll() if the designated constraints aren't met.
type ProbeMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ProbeMultiError) 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 ProbeMultiError) AllErrors() []error { return m }
// ProbeValidationError is the validation error returned by Probe.Validate if
// the designated constraints aren't met.
type ProbeValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProbeValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProbeValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProbeValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProbeValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProbeValidationError) ErrorName() string { return "ProbeValidationError" }
// Error satisfies the builtin error interface
func (e ProbeValidationError) 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 %sProbe.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProbeValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProbeValidationError{}
// Validate checks the field values on ProbeFinishedRequest 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 *ProbeFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ProbeFinishedRequest 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
// ProbeFinishedRequestMultiError, or nil if none found.
func (m *ProbeFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ProbeFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetProbes()) < 1 {
err := ProbeFinishedRequestValidationError{
field: "Probes",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
for idx, item := range m.GetProbes() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ProbeFinishedRequestValidationError{
field: fmt.Sprintf("Probes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ProbeFinishedRequestValidationError{
field: fmt.Sprintf("Probes[%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 ProbeFinishedRequestValidationError{
field: fmt.Sprintf("Probes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ProbeFinishedRequestMultiError(errors)
}
return nil
}
// ProbeFinishedRequestMultiError is an error wrapping multiple validation
// errors returned by ProbeFinishedRequest.ValidateAll() if the designated
// constraints aren't met.
type ProbeFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ProbeFinishedRequestMultiError) 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 ProbeFinishedRequestMultiError) AllErrors() []error { return m }
// ProbeFinishedRequestValidationError is the validation error returned by
// ProbeFinishedRequest.Validate if the designated constraints aren't met.
type ProbeFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProbeFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProbeFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProbeFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProbeFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProbeFinishedRequestValidationError) ErrorName() string {
return "ProbeFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ProbeFinishedRequestValidationError) 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 %sProbeFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProbeFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProbeFinishedRequestValidationError{}
// Validate checks the field values on FailedProbe 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 *FailedProbe) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on FailedProbe 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 FailedProbeMultiError, or
// nil if none found.
func (m *FailedProbe) ValidateAll() error {
return m.validate(true)
}
func (m *FailedProbe) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetHost() == nil {
err := FailedProbeValidationError{
field: "Host",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetHost()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, FailedProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, FailedProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return FailedProbeValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
}
}
}
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := FailedProbeValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return FailedProbeMultiError(errors)
}
return nil
}
// FailedProbeMultiError is an error wrapping multiple validation errors
// returned by FailedProbe.ValidateAll() if the designated constraints aren't met.
type FailedProbeMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m FailedProbeMultiError) 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 FailedProbeMultiError) AllErrors() []error { return m }
// FailedProbeValidationError is the validation error returned by
// FailedProbe.Validate if the designated constraints aren't met.
type FailedProbeValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e FailedProbeValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e FailedProbeValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e FailedProbeValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e FailedProbeValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e FailedProbeValidationError) ErrorName() string { return "FailedProbeValidationError" }
// Error satisfies the builtin error interface
func (e FailedProbeValidationError) 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 %sFailedProbe.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = FailedProbeValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = FailedProbeValidationError{}
// Validate checks the field values on ProbeFailedRequest 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 *ProbeFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ProbeFailedRequest 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
// ProbeFailedRequestMultiError, or nil if none found.
func (m *ProbeFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ProbeFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetProbes()) < 1 {
err := ProbeFailedRequestValidationError{
field: "Probes",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
for idx, item := range m.GetProbes() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ProbeFailedRequestValidationError{
field: fmt.Sprintf("Probes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ProbeFailedRequestValidationError{
field: fmt.Sprintf("Probes[%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 ProbeFailedRequestValidationError{
field: fmt.Sprintf("Probes[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ProbeFailedRequestMultiError(errors)
}
return nil
}
// ProbeFailedRequestMultiError is an error wrapping multiple validation errors
// returned by ProbeFailedRequest.ValidateAll() if the designated constraints
// aren't met.
type ProbeFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ProbeFailedRequestMultiError) 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 ProbeFailedRequestMultiError) AllErrors() []error { return m }
// ProbeFailedRequestValidationError is the validation error returned by
// ProbeFailedRequest.Validate if the designated constraints aren't met.
type ProbeFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProbeFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProbeFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProbeFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProbeFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProbeFailedRequestValidationError) ErrorName() string {
return "ProbeFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ProbeFailedRequestValidationError) 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 %sProbeFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProbeFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProbeFailedRequestValidationError{}
// Validate checks the field values on SyncProbesRequest 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 *SyncProbesRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SyncProbesRequest 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
// SyncProbesRequestMultiError, or nil if none found.
func (m *SyncProbesRequest) ValidateAll() error {
return m.validate(true)
}
func (m *SyncProbesRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetHost() == nil {
err := SyncProbesRequestValidationError{
field: "Host",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetHost()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SyncProbesRequestValidationError{
field: "Host",
reason: "embedded message failed validation",
cause: err,
}
}
}
oneofRequestPresent := false
switch v := m.Request.(type) {
case *SyncProbesRequest_ProbeStartedRequest:
if v == nil {
err := SyncProbesRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetProbeStartedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetProbeStartedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SyncProbesRequestValidationError{
field: "ProbeStartedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *SyncProbesRequest_ProbeFinishedRequest:
if v == nil {
err := SyncProbesRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetProbeFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetProbeFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SyncProbesRequestValidationError{
field: "ProbeFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *SyncProbesRequest_ProbeFailedRequest:
if v == nil {
err := SyncProbesRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetProbeFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SyncProbesRequestValidationError{
field: "ProbeFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetProbeFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return SyncProbesRequestValidationError{
field: "ProbeFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofRequestPresent {
err := SyncProbesRequestValidationError{
field: "Request",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return SyncProbesRequestMultiError(errors)
}
return nil
}
// SyncProbesRequestMultiError is an error wrapping multiple validation errors
// returned by SyncProbesRequest.ValidateAll() if the designated constraints
// aren't met.
type SyncProbesRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SyncProbesRequestMultiError) 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 SyncProbesRequestMultiError) AllErrors() []error { return m }
// SyncProbesRequestValidationError is the validation error returned by
// SyncProbesRequest.Validate if the designated constraints aren't met.
type SyncProbesRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SyncProbesRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SyncProbesRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SyncProbesRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SyncProbesRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SyncProbesRequestValidationError) ErrorName() string {
return "SyncProbesRequestValidationError"
}
// Error satisfies the builtin error interface
func (e SyncProbesRequestValidationError) 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 %sSyncProbesRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SyncProbesRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SyncProbesRequestValidationError{}
// Validate checks the field values on SyncProbesResponse 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 *SyncProbesResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on SyncProbesResponse 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
// SyncProbesResponseMultiError, or nil if none found.
func (m *SyncProbesResponse) ValidateAll() error {
return m.validate(true)
}
func (m *SyncProbesResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetHosts()) > 0 {
if len(m.GetHosts()) < 1 {
err := SyncProbesResponseValidationError{
field: "Hosts",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
for idx, item := range m.GetHosts() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, SyncProbesResponseValidationError{
field: fmt.Sprintf("Hosts[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, SyncProbesResponseValidationError{
field: fmt.Sprintf("Hosts[%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 SyncProbesResponseValidationError{
field: fmt.Sprintf("Hosts[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
}
if len(errors) > 0 {
return SyncProbesResponseMultiError(errors)
}
return nil
}
// SyncProbesResponseMultiError is an error wrapping multiple validation errors
// returned by SyncProbesResponse.ValidateAll() if the designated constraints
// aren't met.
type SyncProbesResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m SyncProbesResponseMultiError) 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 SyncProbesResponseMultiError) AllErrors() []error { return m }
// SyncProbesResponseValidationError is the validation error returned by
// SyncProbesResponse.Validate if the designated constraints aren't met.
type SyncProbesResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e SyncProbesResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e SyncProbesResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e SyncProbesResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e SyncProbesResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e SyncProbesResponseValidationError) ErrorName() string {
return "SyncProbesResponseValidationError"
}
// Error satisfies the builtin error interface
func (e SyncProbesResponseValidationError) 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 %sSyncProbesResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = SyncProbesResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = SyncProbesResponseValidationError{}
// Validate checks the field values on RegisterCachePeerRequest 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 *RegisterCachePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on RegisterCachePeerRequest 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
// RegisterCachePeerRequestMultiError, or nil if none found.
func (m *RegisterCachePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *RegisterCachePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := RegisterCachePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := RegisterCachePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPieceLength() < 1 {
err := RegisterCachePeerRequestValidationError{
field: "PieceLength",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetOutputPath()) < 1 {
err := RegisterCachePeerRequestValidationError{
field: "OutputPath",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.Tag != nil {
// no validation rules for Tag
}
if m.Application != nil {
// no validation rules for Application
}
if m.Timeout != nil {
if all {
switch v := interface{}(m.GetTimeout()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RegisterCachePeerRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RegisterCachePeerRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RegisterCachePeerRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return RegisterCachePeerRequestMultiError(errors)
}
return nil
}
// RegisterCachePeerRequestMultiError is an error wrapping multiple validation
// errors returned by RegisterCachePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type RegisterCachePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m RegisterCachePeerRequestMultiError) 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 RegisterCachePeerRequestMultiError) AllErrors() []error { return m }
// RegisterCachePeerRequestValidationError is the validation error returned by
// RegisterCachePeerRequest.Validate if the designated constraints aren't met.
type RegisterCachePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e RegisterCachePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e RegisterCachePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e RegisterCachePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e RegisterCachePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e RegisterCachePeerRequestValidationError) ErrorName() string {
return "RegisterCachePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e RegisterCachePeerRequestValidationError) 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 %sRegisterCachePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = RegisterCachePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = RegisterCachePeerRequestValidationError{}
// Validate checks the field values on DownloadCachePeerStartedRequest 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 *DownloadCachePeerStartedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadCachePeerStartedRequest 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
// DownloadCachePeerStartedRequestMultiError, or nil if none found.
func (m *DownloadCachePeerStartedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadCachePeerStartedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return DownloadCachePeerStartedRequestMultiError(errors)
}
return nil
}
// DownloadCachePeerStartedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadCachePeerStartedRequest.ValidateAll()
// if the designated constraints aren't met.
type DownloadCachePeerStartedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadCachePeerStartedRequestMultiError) 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 DownloadCachePeerStartedRequestMultiError) AllErrors() []error { return m }
// DownloadCachePeerStartedRequestValidationError is the validation error
// returned by DownloadCachePeerStartedRequest.Validate if the designated
// constraints aren't met.
type DownloadCachePeerStartedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadCachePeerStartedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadCachePeerStartedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadCachePeerStartedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadCachePeerStartedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadCachePeerStartedRequestValidationError) ErrorName() string {
return "DownloadCachePeerStartedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadCachePeerStartedRequestValidationError) 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 %sDownloadCachePeerStartedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadCachePeerStartedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadCachePeerStartedRequestValidationError{}
// Validate checks the field values on RescheduleCachePeerRequest 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 *RescheduleCachePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on RescheduleCachePeerRequest 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
// RescheduleCachePeerRequestMultiError, or nil if none found.
func (m *RescheduleCachePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *RescheduleCachePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetCandidateParents() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RescheduleCachePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RescheduleCachePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%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 RescheduleCachePeerRequestValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := RescheduleCachePeerRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return RescheduleCachePeerRequestMultiError(errors)
}
return nil
}
// RescheduleCachePeerRequestMultiError is an error wrapping multiple
// validation errors returned by RescheduleCachePeerRequest.ValidateAll() if
// the designated constraints aren't met.
type RescheduleCachePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m RescheduleCachePeerRequestMultiError) 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 RescheduleCachePeerRequestMultiError) AllErrors() []error { return m }
// RescheduleCachePeerRequestValidationError is the validation error returned
// by RescheduleCachePeerRequest.Validate if the designated constraints aren't met.
type RescheduleCachePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e RescheduleCachePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e RescheduleCachePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e RescheduleCachePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e RescheduleCachePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e RescheduleCachePeerRequestValidationError) ErrorName() string {
return "RescheduleCachePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e RescheduleCachePeerRequestValidationError) 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 %sRescheduleCachePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = RescheduleCachePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = RescheduleCachePeerRequestValidationError{}
// Validate checks the field values on DownloadCachePeerFinishedRequest 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 *DownloadCachePeerFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadCachePeerFinishedRequest 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
// DownloadCachePeerFinishedRequestMultiError, or nil if none found.
func (m *DownloadCachePeerFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadCachePeerFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for PieceCount
if len(errors) > 0 {
return DownloadCachePeerFinishedRequestMultiError(errors)
}
return nil
}
// DownloadCachePeerFinishedRequestMultiError is an error wrapping multiple
// validation errors returned by
// DownloadCachePeerFinishedRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadCachePeerFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadCachePeerFinishedRequestMultiError) 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 DownloadCachePeerFinishedRequestMultiError) AllErrors() []error { return m }
// DownloadCachePeerFinishedRequestValidationError is the validation error
// returned by DownloadCachePeerFinishedRequest.Validate if the designated
// constraints aren't met.
type DownloadCachePeerFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadCachePeerFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadCachePeerFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadCachePeerFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadCachePeerFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadCachePeerFinishedRequestValidationError) ErrorName() string {
return "DownloadCachePeerFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadCachePeerFinishedRequestValidationError) 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 %sDownloadCachePeerFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadCachePeerFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadCachePeerFinishedRequestValidationError{}
// Validate checks the field values on DownloadCachePeerFailedRequest 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 *DownloadCachePeerFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadCachePeerFailedRequest 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
// DownloadCachePeerFailedRequestMultiError, or nil if none found.
func (m *DownloadCachePeerFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadCachePeerFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := DownloadCachePeerFailedRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return DownloadCachePeerFailedRequestMultiError(errors)
}
return nil
}
// DownloadCachePeerFailedRequestMultiError is an error wrapping multiple
// validation errors returned by DownloadCachePeerFailedRequest.ValidateAll()
// if the designated constraints aren't met.
type DownloadCachePeerFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadCachePeerFailedRequestMultiError) 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 DownloadCachePeerFailedRequestMultiError) AllErrors() []error { return m }
// DownloadCachePeerFailedRequestValidationError is the validation error
// returned by DownloadCachePeerFailedRequest.Validate if the designated
// constraints aren't met.
type DownloadCachePeerFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadCachePeerFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadCachePeerFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadCachePeerFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadCachePeerFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadCachePeerFailedRequestValidationError) ErrorName() string {
return "DownloadCachePeerFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadCachePeerFailedRequestValidationError) 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 %sDownloadCachePeerFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadCachePeerFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DownloadCachePeerFailedRequestValidationError{}
// Validate checks the field values on AnnounceCachePeerRequest 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 *AnnounceCachePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AnnounceCachePeerRequest 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
// AnnounceCachePeerRequestMultiError, or nil if none found.
func (m *AnnounceCachePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *AnnounceCachePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := AnnounceCachePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := AnnounceCachePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := AnnounceCachePeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent := false
switch v := m.Request.(type) {
case *AnnounceCachePeerRequest_RegisterCachePeerRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetRegisterCachePeerRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "RegisterCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "RegisterCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetRegisterCachePeerRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "RegisterCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_DownloadCachePeerStartedRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadCachePeerStartedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadCachePeerStartedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerStartedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_RescheduleCachePeerRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetRescheduleCachePeerRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "RescheduleCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "RescheduleCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetRescheduleCachePeerRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "RescheduleCachePeerRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_DownloadCachePeerFinishedRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadCachePeerFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadCachePeerFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_DownloadCachePeerFailedRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadCachePeerFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadCachePeerFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "DownloadCachePeerFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_DownloadPieceFinishedRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceFinishedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceFinishedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFinishedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerRequest_DownloadPieceFailedRequest:
if v == nil {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofRequestPresent = true
if all {
switch v := interface{}(m.GetDownloadPieceFailedRequest()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownloadPieceFailedRequest()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerRequestValidationError{
field: "DownloadPieceFailedRequest",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofRequestPresent {
err := AnnounceCachePeerRequestValidationError{
field: "Request",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AnnounceCachePeerRequestMultiError(errors)
}
return nil
}
// AnnounceCachePeerRequestMultiError is an error wrapping multiple validation
// errors returned by AnnounceCachePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type AnnounceCachePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AnnounceCachePeerRequestMultiError) 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 AnnounceCachePeerRequestMultiError) AllErrors() []error { return m }
// AnnounceCachePeerRequestValidationError is the validation error returned by
// AnnounceCachePeerRequest.Validate if the designated constraints aren't met.
type AnnounceCachePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AnnounceCachePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AnnounceCachePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AnnounceCachePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AnnounceCachePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AnnounceCachePeerRequestValidationError) ErrorName() string {
return "AnnounceCachePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e AnnounceCachePeerRequestValidationError) 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 %sAnnounceCachePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AnnounceCachePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AnnounceCachePeerRequestValidationError{}
// Validate checks the field values on EmptyCacheTaskResponse 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 *EmptyCacheTaskResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on EmptyCacheTaskResponse 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
// EmptyCacheTaskResponseMultiError, or nil if none found.
func (m *EmptyCacheTaskResponse) ValidateAll() error {
return m.validate(true)
}
func (m *EmptyCacheTaskResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return EmptyCacheTaskResponseMultiError(errors)
}
return nil
}
// EmptyCacheTaskResponseMultiError is an error wrapping multiple validation
// errors returned by EmptyCacheTaskResponse.ValidateAll() if the designated
// constraints aren't met.
type EmptyCacheTaskResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m EmptyCacheTaskResponseMultiError) 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 EmptyCacheTaskResponseMultiError) AllErrors() []error { return m }
// EmptyCacheTaskResponseValidationError is the validation error returned by
// EmptyCacheTaskResponse.Validate if the designated constraints aren't met.
type EmptyCacheTaskResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e EmptyCacheTaskResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e EmptyCacheTaskResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e EmptyCacheTaskResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e EmptyCacheTaskResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e EmptyCacheTaskResponseValidationError) ErrorName() string {
return "EmptyCacheTaskResponseValidationError"
}
// Error satisfies the builtin error interface
func (e EmptyCacheTaskResponseValidationError) 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 %sEmptyCacheTaskResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = EmptyCacheTaskResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = EmptyCacheTaskResponseValidationError{}
// Validate checks the field values on NormalCacheTaskResponse 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 *NormalCacheTaskResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on NormalCacheTaskResponse 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
// NormalCacheTaskResponseMultiError, or nil if none found.
func (m *NormalCacheTaskResponse) ValidateAll() error {
return m.validate(true)
}
func (m *NormalCacheTaskResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetCandidateParents()) < 1 {
err := NormalCacheTaskResponseValidationError{
field: "CandidateParents",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
for idx, item := range m.GetCandidateParents() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, NormalCacheTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, NormalCacheTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%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 NormalCacheTaskResponseValidationError{
field: fmt.Sprintf("CandidateParents[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return NormalCacheTaskResponseMultiError(errors)
}
return nil
}
// NormalCacheTaskResponseMultiError is an error wrapping multiple validation
// errors returned by NormalCacheTaskResponse.ValidateAll() if the designated
// constraints aren't met.
type NormalCacheTaskResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m NormalCacheTaskResponseMultiError) 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 NormalCacheTaskResponseMultiError) AllErrors() []error { return m }
// NormalCacheTaskResponseValidationError is the validation error returned by
// NormalCacheTaskResponse.Validate if the designated constraints aren't met.
type NormalCacheTaskResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e NormalCacheTaskResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e NormalCacheTaskResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e NormalCacheTaskResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e NormalCacheTaskResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e NormalCacheTaskResponseValidationError) ErrorName() string {
return "NormalCacheTaskResponseValidationError"
}
// Error satisfies the builtin error interface
func (e NormalCacheTaskResponseValidationError) 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 %sNormalCacheTaskResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = NormalCacheTaskResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = NormalCacheTaskResponseValidationError{}
// Validate checks the field values on AnnounceCachePeerResponse 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 *AnnounceCachePeerResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AnnounceCachePeerResponse 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
// AnnounceCachePeerResponseMultiError, or nil if none found.
func (m *AnnounceCachePeerResponse) ValidateAll() error {
return m.validate(true)
}
func (m *AnnounceCachePeerResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
oneofResponsePresent := false
switch v := m.Response.(type) {
case *AnnounceCachePeerResponse_EmptyTaskResponse:
if v == nil {
err := AnnounceCachePeerResponseValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetEmptyTaskResponse()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetEmptyTaskResponse()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerResponseValidationError{
field: "EmptyTaskResponse",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *AnnounceCachePeerResponse_NormalTaskResponse:
if v == nil {
err := AnnounceCachePeerResponseValidationError{
field: "Response",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
oneofResponsePresent = true
if all {
switch v := interface{}(m.GetNormalTaskResponse()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, AnnounceCachePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, AnnounceCachePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetNormalTaskResponse()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return AnnounceCachePeerResponseValidationError{
field: "NormalTaskResponse",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if !oneofResponsePresent {
err := AnnounceCachePeerResponseValidationError{
field: "Response",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AnnounceCachePeerResponseMultiError(errors)
}
return nil
}
// AnnounceCachePeerResponseMultiError is an error wrapping multiple validation
// errors returned by AnnounceCachePeerResponse.ValidateAll() if the
// designated constraints aren't met.
type AnnounceCachePeerResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AnnounceCachePeerResponseMultiError) 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 AnnounceCachePeerResponseMultiError) AllErrors() []error { return m }
// AnnounceCachePeerResponseValidationError is the validation error returned by
// AnnounceCachePeerResponse.Validate if the designated constraints aren't met.
type AnnounceCachePeerResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AnnounceCachePeerResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AnnounceCachePeerResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AnnounceCachePeerResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AnnounceCachePeerResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AnnounceCachePeerResponseValidationError) ErrorName() string {
return "AnnounceCachePeerResponseValidationError"
}
// Error satisfies the builtin error interface
func (e AnnounceCachePeerResponseValidationError) 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 %sAnnounceCachePeerResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AnnounceCachePeerResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AnnounceCachePeerResponseValidationError{}
// Validate checks the field values on StatCachePeerRequest 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 *StatCachePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on StatCachePeerRequest 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
// StatCachePeerRequestMultiError, or nil if none found.
func (m *StatCachePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *StatCachePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := StatCachePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := StatCachePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := StatCachePeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return StatCachePeerRequestMultiError(errors)
}
return nil
}
// StatCachePeerRequestMultiError is an error wrapping multiple validation
// errors returned by StatCachePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type StatCachePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m StatCachePeerRequestMultiError) 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 StatCachePeerRequestMultiError) AllErrors() []error { return m }
// StatCachePeerRequestValidationError is the validation error returned by
// StatCachePeerRequest.Validate if the designated constraints aren't met.
type StatCachePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e StatCachePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e StatCachePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e StatCachePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e StatCachePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e StatCachePeerRequestValidationError) ErrorName() string {
return "StatCachePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e StatCachePeerRequestValidationError) 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 %sStatCachePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = StatCachePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = StatCachePeerRequestValidationError{}
// Validate checks the field values on DeleteCachePeerRequest 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 *DeleteCachePeerRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteCachePeerRequest 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
// DeleteCachePeerRequestMultiError, or nil if none found.
func (m *DeleteCachePeerRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteCachePeerRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := DeleteCachePeerRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := DeleteCachePeerRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := DeleteCachePeerRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteCachePeerRequestMultiError(errors)
}
return nil
}
// DeleteCachePeerRequestMultiError is an error wrapping multiple validation
// errors returned by DeleteCachePeerRequest.ValidateAll() if the designated
// constraints aren't met.
type DeleteCachePeerRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteCachePeerRequestMultiError) 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 DeleteCachePeerRequestMultiError) AllErrors() []error { return m }
// DeleteCachePeerRequestValidationError is the validation error returned by
// DeleteCachePeerRequest.Validate if the designated constraints aren't met.
type DeleteCachePeerRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteCachePeerRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteCachePeerRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteCachePeerRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteCachePeerRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteCachePeerRequestValidationError) ErrorName() string {
return "DeleteCachePeerRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteCachePeerRequestValidationError) 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 %sDeleteCachePeerRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteCachePeerRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteCachePeerRequestValidationError{}
// Validate checks the field values on UploadCacheTaskStartedRequest 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 *UploadCacheTaskStartedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UploadCacheTaskStartedRequest 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
// UploadCacheTaskStartedRequestMultiError, or nil if none found.
func (m *UploadCacheTaskStartedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UploadCacheTaskStartedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := UploadCacheTaskStartedRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := UploadCacheTaskStartedRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetPeerId()) < 1 {
err := UploadCacheTaskStartedRequestValidationError{
field: "PeerId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPersistentReplicaCount() < 1 {
err := UploadCacheTaskStartedRequestValidationError{
field: "PersistentReplicaCount",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPieceLength() < 1 {
err := UploadCacheTaskStartedRequestValidationError{
field: "PieceLength",
reason: "value must be greater than or equal to 1",
}
if !all {
return err
}
errors = append(errors, err)
}
if d := m.GetTtl(); d != nil {
dur, err := d.AsDuration(), d.CheckValid()
if err != nil {
err = UploadCacheTaskStartedRequestValidationError{
field: "Ttl",
reason: "value is not a valid duration",
cause: err,
}
if !all {
return err
}
errors = append(errors, err)
} else {
lte := time.Duration(604800*time.Second + 0*time.Nanosecond)
gte := time.Duration(60*time.Second + 0*time.Nanosecond)
if dur < gte || dur > lte {
err := UploadCacheTaskStartedRequestValidationError{
field: "Ttl",
reason: "value must be inside range [1m0s, 168h0m0s]",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if m.Tag != nil {
// no validation rules for Tag
}
if m.Application != nil {
// no validation rules for Application
}
if m.Timeout != nil {
if all {
switch v := interface{}(m.GetTimeout()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, UploadCacheTaskStartedRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, UploadCacheTaskStartedRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return UploadCacheTaskStartedRequestValidationError{
field: "Timeout",
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return UploadCacheTaskStartedRequestMultiError(errors)
}
return nil
}
// UploadCacheTaskStartedRequestMultiError is an error wrapping multiple
// validation errors returned by UploadCacheTaskStartedRequest.ValidateAll()
// if the designated constraints aren't met.
type UploadCacheTaskStartedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UploadCacheTaskStartedRequestMultiError) 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 UploadCacheTaskStartedRequestMultiError) AllErrors() []error { return m }
// UploadCacheTaskStartedRequestValidationError is the validation error
// returned by UploadCacheTaskStartedRequest.Validate if the designated
// constraints aren't met.
type UploadCacheTaskStartedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UploadCacheTaskStartedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UploadCacheTaskStartedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UploadCacheTaskStartedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UploadCacheTaskStartedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UploadCacheTaskStartedRequestValidationError) ErrorName() string {
return "UploadCacheTaskStartedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UploadCacheTaskStartedRequestValidationError) 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 %sUploadCacheTaskStartedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UploadCacheTaskStartedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UploadCacheTaskStartedRequestValidationError{}
// Validate checks the field values on UploadCacheTaskFinishedRequest 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 *UploadCacheTaskFinishedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UploadCacheTaskFinishedRequest 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
// UploadCacheTaskFinishedRequestMultiError, or nil if none found.
func (m *UploadCacheTaskFinishedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UploadCacheTaskFinishedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return UploadCacheTaskFinishedRequestMultiError(errors)
}
return nil
}
// UploadCacheTaskFinishedRequestMultiError is an error wrapping multiple
// validation errors returned by UploadCacheTaskFinishedRequest.ValidateAll()
// if the designated constraints aren't met.
type UploadCacheTaskFinishedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UploadCacheTaskFinishedRequestMultiError) 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 UploadCacheTaskFinishedRequestMultiError) AllErrors() []error { return m }
// UploadCacheTaskFinishedRequestValidationError is the validation error
// returned by UploadCacheTaskFinishedRequest.Validate if the designated
// constraints aren't met.
type UploadCacheTaskFinishedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UploadCacheTaskFinishedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UploadCacheTaskFinishedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UploadCacheTaskFinishedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UploadCacheTaskFinishedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UploadCacheTaskFinishedRequestValidationError) ErrorName() string {
return "UploadCacheTaskFinishedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UploadCacheTaskFinishedRequestValidationError) 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 %sUploadCacheTaskFinishedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UploadCacheTaskFinishedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UploadCacheTaskFinishedRequestValidationError{}
// Validate checks the field values on UploadCacheTaskFailedRequest 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 *UploadCacheTaskFailedRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UploadCacheTaskFailedRequest 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
// UploadCacheTaskFailedRequestMultiError, or nil if none found.
func (m *UploadCacheTaskFailedRequest) ValidateAll() error {
return m.validate(true)
}
func (m *UploadCacheTaskFailedRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.Description != nil {
if m.GetDescription() != "" {
if utf8.RuneCountInString(m.GetDescription()) < 1 {
err := UploadCacheTaskFailedRequestValidationError{
field: "Description",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
}
}
if len(errors) > 0 {
return UploadCacheTaskFailedRequestMultiError(errors)
}
return nil
}
// UploadCacheTaskFailedRequestMultiError is an error wrapping multiple
// validation errors returned by UploadCacheTaskFailedRequest.ValidateAll() if
// the designated constraints aren't met.
type UploadCacheTaskFailedRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UploadCacheTaskFailedRequestMultiError) 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 UploadCacheTaskFailedRequestMultiError) AllErrors() []error { return m }
// UploadCacheTaskFailedRequestValidationError is the validation error returned
// by UploadCacheTaskFailedRequest.Validate if the designated constraints
// aren't met.
type UploadCacheTaskFailedRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UploadCacheTaskFailedRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UploadCacheTaskFailedRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UploadCacheTaskFailedRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UploadCacheTaskFailedRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UploadCacheTaskFailedRequestValidationError) ErrorName() string {
return "UploadCacheTaskFailedRequestValidationError"
}
// Error satisfies the builtin error interface
func (e UploadCacheTaskFailedRequestValidationError) 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 %sUploadCacheTaskFailedRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UploadCacheTaskFailedRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UploadCacheTaskFailedRequestValidationError{}
// Validate checks the field values on StatCacheTaskRequest 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 *StatCacheTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on StatCacheTaskRequest 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
// StatCacheTaskRequestMultiError, or nil if none found.
func (m *StatCacheTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *StatCacheTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := StatCacheTaskRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return StatCacheTaskRequestMultiError(errors)
}
return nil
}
// StatCacheTaskRequestMultiError is an error wrapping multiple validation
// errors returned by StatCacheTaskRequest.ValidateAll() if the designated
// constraints aren't met.
type StatCacheTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m StatCacheTaskRequestMultiError) 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 StatCacheTaskRequestMultiError) AllErrors() []error { return m }
// StatCacheTaskRequestValidationError is the validation error returned by
// StatCacheTaskRequest.Validate if the designated constraints aren't met.
type StatCacheTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e StatCacheTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e StatCacheTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e StatCacheTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e StatCacheTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e StatCacheTaskRequestValidationError) ErrorName() string {
return "StatCacheTaskRequestValidationError"
}
// Error satisfies the builtin error interface
func (e StatCacheTaskRequestValidationError) 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 %sStatCacheTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = StatCacheTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = StatCacheTaskRequestValidationError{}
// Validate checks the field values on DeleteCacheTaskRequest 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 *DeleteCacheTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteCacheTaskRequest 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
// DeleteCacheTaskRequestMultiError, or nil if none found.
func (m *DeleteCacheTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteCacheTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetHostId()) < 1 {
err := DeleteCacheTaskRequestValidationError{
field: "HostId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetTaskId()) < 1 {
err := DeleteCacheTaskRequestValidationError{
field: "TaskId",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return DeleteCacheTaskRequestMultiError(errors)
}
return nil
}
// DeleteCacheTaskRequestMultiError is an error wrapping multiple validation
// errors returned by DeleteCacheTaskRequest.ValidateAll() if the designated
// constraints aren't met.
type DeleteCacheTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteCacheTaskRequestMultiError) 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 DeleteCacheTaskRequestMultiError) AllErrors() []error { return m }
// DeleteCacheTaskRequestValidationError is the validation error returned by
// DeleteCacheTaskRequest.Validate if the designated constraints aren't met.
type DeleteCacheTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteCacheTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteCacheTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteCacheTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteCacheTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteCacheTaskRequestValidationError) ErrorName() string {
return "DeleteCacheTaskRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteCacheTaskRequestValidationError) 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 %sDeleteCacheTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteCacheTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteCacheTaskRequestValidationError{}