// 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 utf8.RuneCountInString(m.GetReason()) < 1 { err := DownloadPeerBackToSourceStartedRequestValidationError{ field: "Reason", 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 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 if m.GetContentLength() < 0 { err := DownloadPeerFinishedRequestValidationError{ field: "ContentLength", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetPieceCount() < 0 { err := DownloadPeerFinishedRequestValidationError{ field: "PieceCount", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } 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 if m.GetContentLength() < 0 { err := DownloadPeerBackToSourceFinishedRequestValidationError{ field: "ContentLength", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetPieceCount() < 0 { err := DownloadPeerBackToSourceFinishedRequestValidationError{ field: "PieceCount", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } 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 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 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.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_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_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, } } } default: _ = v // ensures v is used } if !oneofRequestPresent { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "value is required", } if !all { return err } errors = append(errors, err) } switch v := m.Errordetails.(type) { case *AnnouncePeerRequest_DownloadPeerBackToSourceFailed: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetDownloadPeerBackToSourceFailed()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailed", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailed", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerBackToSourceFailed()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailed", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceBackToSourceFailed: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetDownloadPieceBackToSourceFailed()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailed", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailed", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceBackToSourceFailed()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailed", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_SyncPiecesFailed: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetSyncPiecesFailed()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "SyncPiecesFailed", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "SyncPiecesFailed", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSyncPiecesFailed()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "SyncPiecesFailed", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceFailed: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetDownloadPieceFailed()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFailed", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFailed", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFailed()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceFailed", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } 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 TinyTaskResponse 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 *TinyTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on TinyTaskResponse 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 // TinyTaskResponseMultiError, or nil if none found. func (m *TinyTaskResponse) ValidateAll() error { return m.validate(true) } func (m *TinyTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetData()) < 1 { err := TinyTaskResponseValidationError{ field: "Data", reason: "value length must be at least 1 bytes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return TinyTaskResponseMultiError(errors) } return nil } // TinyTaskResponseMultiError is an error wrapping multiple validation errors // returned by TinyTaskResponse.ValidateAll() if the designated constraints // aren't met. type TinyTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m TinyTaskResponseMultiError) 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 TinyTaskResponseMultiError) AllErrors() []error { return m } // TinyTaskResponseValidationError is the validation error returned by // TinyTaskResponse.Validate if the designated constraints aren't met. type TinyTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e TinyTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e TinyTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e TinyTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e TinyTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e TinyTaskResponseValidationError) ErrorName() string { return "TinyTaskResponseValidationError" } // Error satisfies the builtin error interface func (e TinyTaskResponseValidationError) 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 %sTinyTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = TinyTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = TinyTaskResponseValidationError{} // Validate checks the field values on SmallTaskResponse 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 *SmallTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SmallTaskResponse 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 // SmallTaskResponseMultiError, or nil if none found. func (m *SmallTaskResponse) ValidateAll() error { return m.validate(true) } func (m *SmallTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := SmallTaskResponseValidationError{ 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, SmallTaskResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SmallTaskResponseValidationError{ 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 SmallTaskResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return SmallTaskResponseMultiError(errors) } return nil } // SmallTaskResponseMultiError is an error wrapping multiple validation errors // returned by SmallTaskResponse.ValidateAll() if the designated constraints // aren't met. type SmallTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SmallTaskResponseMultiError) 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 SmallTaskResponseMultiError) AllErrors() []error { return m } // SmallTaskResponseValidationError is the validation error returned by // SmallTaskResponse.Validate if the designated constraints aren't met. type SmallTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SmallTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SmallTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SmallTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SmallTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SmallTaskResponseValidationError) ErrorName() string { return "SmallTaskResponseValidationError" } // Error satisfies the builtin error interface func (e SmallTaskResponseValidationError) 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 %sSmallTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SmallTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SmallTaskResponseValidationError{} // 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 m.GetParallelPieceCount() < 1 { err := NormalTaskResponseValidationError{ field: "ParallelPieceCount", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, 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 utf8.RuneCountInString(m.GetReason()) < 1 { err := NeedBackToSourceResponseValidationError{ field: "Reason", 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_TinyTaskResponse: 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.GetTinyTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "TinyTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "TinyTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTinyTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "TinyTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerResponse_SmallTaskResponse: 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.GetSmallTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SmallTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SmallTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSmallTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "SmallTaskResponse", 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) } switch v := m.Errordetails.(type) { case *AnnouncePeerResponse_SchedulePeerForbidden: if v == nil { err := AnnouncePeerResponseValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetSchedulePeerForbidden()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SchedulePeerForbidden", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SchedulePeerForbidden", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSchedulePeerForbidden()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "SchedulePeerForbidden", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerResponse_SchedulePeerFailed: if v == nil { err := AnnouncePeerResponseValidationError{ field: "Errordetails", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetSchedulePeerFailed()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SchedulePeerFailed", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "SchedulePeerFailed", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSchedulePeerFailed()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "SchedulePeerFailed", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } 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.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 ExchangePeerRequest 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 *ExchangePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ExchangePeerRequest 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 // ExchangePeerRequestMultiError, or nil if none found. func (m *ExchangePeerRequest) ValidateAll() error { return m.validate(true) } func (m *ExchangePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := ExchangePeerRequestValidationError{ 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 := ExchangePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return ExchangePeerRequestMultiError(errors) } return nil } // ExchangePeerRequestMultiError is an error wrapping multiple validation // errors returned by ExchangePeerRequest.ValidateAll() if the designated // constraints aren't met. type ExchangePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ExchangePeerRequestMultiError) 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 ExchangePeerRequestMultiError) AllErrors() []error { return m } // ExchangePeerRequestValidationError is the validation error returned by // ExchangePeerRequest.Validate if the designated constraints aren't met. type ExchangePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ExchangePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ExchangePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ExchangePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ExchangePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ExchangePeerRequestValidationError) ErrorName() string { return "ExchangePeerRequestValidationError" } // Error satisfies the builtin error interface func (e ExchangePeerRequestValidationError) 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 %sExchangePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ExchangePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ExchangePeerRequestValidationError{} // Validate checks the field values on ExchangePeerResponse 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 *ExchangePeerResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ExchangePeerResponse 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 // ExchangePeerResponseMultiError, or nil if none found. func (m *ExchangePeerResponse) ValidateAll() error { return m.validate(true) } func (m *ExchangePeerResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return ExchangePeerResponseMultiError(errors) } return nil } // ExchangePeerResponseMultiError is an error wrapping multiple validation // errors returned by ExchangePeerResponse.ValidateAll() if the designated // constraints aren't met. type ExchangePeerResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ExchangePeerResponseMultiError) 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 ExchangePeerResponseMultiError) AllErrors() []error { return m } // ExchangePeerResponseValidationError is the validation error returned by // ExchangePeerResponse.Validate if the designated constraints aren't met. type ExchangePeerResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ExchangePeerResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ExchangePeerResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ExchangePeerResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ExchangePeerResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ExchangePeerResponseValidationError) ErrorName() string { return "ExchangePeerResponseValidationError" } // Error satisfies the builtin error interface func (e ExchangePeerResponseValidationError) 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 %sExchangePeerResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ExchangePeerResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ExchangePeerResponseValidationError{} // Validate checks the field values on LeavePeerRequest 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 *LeavePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on LeavePeerRequest 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 // LeavePeerRequestMultiError, or nil if none found. func (m *LeavePeerRequest) ValidateAll() error { return m.validate(true) } func (m *LeavePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := LeavePeerRequestValidationError{ 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 := LeavePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return LeavePeerRequestMultiError(errors) } return nil } // LeavePeerRequestMultiError is an error wrapping multiple validation errors // returned by LeavePeerRequest.ValidateAll() if the designated constraints // aren't met. type LeavePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m LeavePeerRequestMultiError) 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 LeavePeerRequestMultiError) AllErrors() []error { return m } // LeavePeerRequestValidationError is the validation error returned by // LeavePeerRequest.Validate if the designated constraints aren't met. type LeavePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e LeavePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e LeavePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e LeavePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e LeavePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e LeavePeerRequestValidationError) ErrorName() string { return "LeavePeerRequestValidationError" } // Error satisfies the builtin error interface func (e LeavePeerRequestValidationError) 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 %sLeavePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = LeavePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = LeavePeerRequestValidationError{} // 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.GetId()) < 1 { err := StatTaskRequestValidationError{ field: "Id", 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 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 utf8.RuneCountInString(m.GetId()) < 1 { err := AnnounceHostRequestValidationError{ field: "Id", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.GetType() > 3 { err := AnnounceHostRequestValidationError{ field: "Type", reason: "value must be less than or equal to 3", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetHostname()) < 1 { err := AnnounceHostRequestValidationError{ field: "Hostname", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := AnnounceHostRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if val := m.GetPort(); val < 1024 || val >= 65535 { err := AnnounceHostRequestValidationError{ field: "Port", reason: "value must be inside range [1024, 65535)", } if !all { return err } errors = append(errors, err) } if val := m.GetDownloadPort(); val < 1024 || val >= 65535 { err := AnnounceHostRequestValidationError{ field: "DownloadPort", reason: "value must be inside range [1024, 65535)", } if !all { return err } errors = append(errors, err) } // no validation rules for Os // no validation rules for Platform // no validation rules for PlatformFamily // no validation rules for PlatformVersion // no validation rules for KernelVersion if m.GetCpu() == nil { err := AnnounceHostRequestValidationError{ field: "Cpu", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetCpu()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Cpu", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Cpu", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetCpu()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Cpu", reason: "embedded message failed validation", cause: err, } } } if m.GetMemory() == nil { err := AnnounceHostRequestValidationError{ field: "Memory", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetMemory()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Memory", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Memory", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetMemory()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Memory", reason: "embedded message failed validation", cause: err, } } } if m.GetNetwork() == nil { err := AnnounceHostRequestValidationError{ field: "Network", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetNetwork()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Network", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Network", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetNetwork()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Network", reason: "embedded message failed validation", cause: err, } } } if m.GetDisk() == nil { err := AnnounceHostRequestValidationError{ field: "Disk", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetDisk()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Disk", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Disk", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDisk()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Disk", reason: "embedded message failed validation", cause: err, } } } if m.GetBuild() == nil { err := AnnounceHostRequestValidationError{ field: "Build", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetBuild()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Build", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Build", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetBuild()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Build", 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 CPU 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 *CPU) Validate() error { return m.validate(false) } // ValidateAll checks the field values on CPU 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 CPUMultiError, or nil if none found. func (m *CPU) ValidateAll() error { return m.validate(true) } func (m *CPU) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for LogicalCount // no validation rules for PhysicalCount if val := m.GetPercent(); val < 0 || val > 100 { err := CPUValidationError{ field: "Percent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } if val := m.GetProcessPercent(); val < 0 || val > 100 { err := CPUValidationError{ field: "ProcessPercent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } if m.GetTimes() == nil { err := CPUValidationError{ field: "Times", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetTimes()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, CPUValidationError{ field: "Times", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, CPUValidationError{ field: "Times", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTimes()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CPUValidationError{ field: "Times", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return CPUMultiError(errors) } return nil } // CPUMultiError is an error wrapping multiple validation errors returned by // CPU.ValidateAll() if the designated constraints aren't met. type CPUMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m CPUMultiError) 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 CPUMultiError) AllErrors() []error { return m } // CPUValidationError is the validation error returned by CPU.Validate if the // designated constraints aren't met. type CPUValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e CPUValidationError) Field() string { return e.field } // Reason function returns reason value. func (e CPUValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e CPUValidationError) Cause() error { return e.cause } // Key function returns key value. func (e CPUValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e CPUValidationError) ErrorName() string { return "CPUValidationError" } // Error satisfies the builtin error interface func (e CPUValidationError) 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 %sCPU.%s: %s%s", key, e.field, e.reason, cause) } var _ error = CPUValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = CPUValidationError{} // Validate checks the field values on CPUTimes 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 *CPUTimes) Validate() error { return m.validate(false) } // ValidateAll checks the field values on CPUTimes 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 CPUTimesMultiError, or nil // if none found. func (m *CPUTimes) ValidateAll() error { return m.validate(true) } func (m *CPUTimes) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetUser() < 0 { err := CPUTimesValidationError{ field: "User", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetSystem() < 0 { err := CPUTimesValidationError{ field: "System", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetIdle() < 0 { err := CPUTimesValidationError{ field: "Idle", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetNice() < 0 { err := CPUTimesValidationError{ field: "Nice", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetIowait() < 0 { err := CPUTimesValidationError{ field: "Iowait", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetIrq() < 0 { err := CPUTimesValidationError{ field: "Irq", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetSoftirq() < 0 { err := CPUTimesValidationError{ field: "Softirq", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetSteal() < 0 { err := CPUTimesValidationError{ field: "Steal", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetGuest() < 0 { err := CPUTimesValidationError{ field: "Guest", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if m.GetGuestNice() < 0 { err := CPUTimesValidationError{ field: "GuestNice", reason: "value must be greater than or equal to 0", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return CPUTimesMultiError(errors) } return nil } // CPUTimesMultiError is an error wrapping multiple validation errors returned // by CPUTimes.ValidateAll() if the designated constraints aren't met. type CPUTimesMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m CPUTimesMultiError) 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 CPUTimesMultiError) AllErrors() []error { return m } // CPUTimesValidationError is the validation error returned by // CPUTimes.Validate if the designated constraints aren't met. type CPUTimesValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e CPUTimesValidationError) Field() string { return e.field } // Reason function returns reason value. func (e CPUTimesValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e CPUTimesValidationError) Cause() error { return e.cause } // Key function returns key value. func (e CPUTimesValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e CPUTimesValidationError) ErrorName() string { return "CPUTimesValidationError" } // Error satisfies the builtin error interface func (e CPUTimesValidationError) 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 %sCPUTimes.%s: %s%s", key, e.field, e.reason, cause) } var _ error = CPUTimesValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = CPUTimesValidationError{} // Validate checks the field values on Memory 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 *Memory) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Memory 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 MemoryMultiError, or nil if none found. func (m *Memory) ValidateAll() error { return m.validate(true) } func (m *Memory) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Total // no validation rules for Available // no validation rules for Used if val := m.GetUsedPercent(); val < 0 || val > 100 { err := MemoryValidationError{ field: "UsedPercent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } if val := m.GetProcessUsedPercent(); val < 0 || val > 100 { err := MemoryValidationError{ field: "ProcessUsedPercent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } // no validation rules for Free if len(errors) > 0 { return MemoryMultiError(errors) } return nil } // MemoryMultiError is an error wrapping multiple validation errors returned by // Memory.ValidateAll() if the designated constraints aren't met. type MemoryMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m MemoryMultiError) 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 MemoryMultiError) AllErrors() []error { return m } // MemoryValidationError is the validation error returned by Memory.Validate if // the designated constraints aren't met. type MemoryValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e MemoryValidationError) Field() string { return e.field } // Reason function returns reason value. func (e MemoryValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e MemoryValidationError) Cause() error { return e.cause } // Key function returns key value. func (e MemoryValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e MemoryValidationError) ErrorName() string { return "MemoryValidationError" } // Error satisfies the builtin error interface func (e MemoryValidationError) 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 %sMemory.%s: %s%s", key, e.field, e.reason, cause) } var _ error = MemoryValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = MemoryValidationError{} // Validate checks the field values on Network 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 *Network) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Network 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 NetworkMultiError, or nil if none found. func (m *Network) ValidateAll() error { return m.validate(true) } func (m *Network) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for TcpConnectionCount // no validation rules for UploadTcpConnectionCount // no validation rules for SecurityDomain // no validation rules for Location // no validation rules for Idc if len(errors) > 0 { return NetworkMultiError(errors) } return nil } // NetworkMultiError is an error wrapping multiple validation errors returned // by Network.ValidateAll() if the designated constraints aren't met. type NetworkMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m NetworkMultiError) 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 NetworkMultiError) AllErrors() []error { return m } // NetworkValidationError is the validation error returned by Network.Validate // if the designated constraints aren't met. type NetworkValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NetworkValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NetworkValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NetworkValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NetworkValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NetworkValidationError) ErrorName() string { return "NetworkValidationError" } // Error satisfies the builtin error interface func (e NetworkValidationError) 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 %sNetwork.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NetworkValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NetworkValidationError{} // Validate checks the field values on Disk 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 *Disk) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Disk 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 DiskMultiError, or nil if none found. func (m *Disk) ValidateAll() error { return m.validate(true) } func (m *Disk) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Total // no validation rules for Free // no validation rules for Used if val := m.GetUsedPercent(); val < 0 || val > 100 { err := DiskValidationError{ field: "UsedPercent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } // no validation rules for InodesTotal // no validation rules for InodesUsed // no validation rules for InodesFree if val := m.GetInodesUsedPercent(); val < 0 || val > 100 { err := DiskValidationError{ field: "InodesUsedPercent", reason: "value must be inside range [0, 100]", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DiskMultiError(errors) } return nil } // DiskMultiError is an error wrapping multiple validation errors returned by // Disk.ValidateAll() if the designated constraints aren't met. type DiskMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DiskMultiError) 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 DiskMultiError) AllErrors() []error { return m } // DiskValidationError is the validation error returned by Disk.Validate if the // designated constraints aren't met. type DiskValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DiskValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DiskValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DiskValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DiskValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DiskValidationError) ErrorName() string { return "DiskValidationError" } // Error satisfies the builtin error interface func (e DiskValidationError) 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 %sDisk.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DiskValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DiskValidationError{} // Validate checks the field values on Build 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 *Build) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Build 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 BuildMultiError, or nil if none found. func (m *Build) ValidateAll() error { return m.validate(true) } func (m *Build) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for GitVersion // no validation rules for GitCommit // no validation rules for GoVersion // no validation rules for Platform if len(errors) > 0 { return BuildMultiError(errors) } return nil } // BuildMultiError is an error wrapping multiple validation errors returned by // Build.ValidateAll() if the designated constraints aren't met. type BuildMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m BuildMultiError) 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 BuildMultiError) AllErrors() []error { return m } // BuildValidationError is the validation error returned by Build.Validate if // the designated constraints aren't met. type BuildValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e BuildValidationError) Field() string { return e.field } // Reason function returns reason value. func (e BuildValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e BuildValidationError) Cause() error { return e.cause } // Key function returns key value. func (e BuildValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e BuildValidationError) ErrorName() string { return "BuildValidationError" } // Error satisfies the builtin error interface func (e BuildValidationError) 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 %sBuild.%s: %s%s", key, e.field, e.reason, cause) } var _ error = BuildValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = BuildValidationError{} // Validate checks the field values on LeaveHostRequest 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 *LeaveHostRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on LeaveHostRequest 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 // LeaveHostRequestMultiError, or nil if none found. func (m *LeaveHostRequest) ValidateAll() error { return m.validate(true) } func (m *LeaveHostRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetId()) < 1 { err := LeaveHostRequestValidationError{ field: "Id", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return LeaveHostRequestMultiError(errors) } return nil } // LeaveHostRequestMultiError is an error wrapping multiple validation errors // returned by LeaveHostRequest.ValidateAll() if the designated constraints // aren't met. type LeaveHostRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m LeaveHostRequestMultiError) 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 LeaveHostRequestMultiError) AllErrors() []error { return m } // LeaveHostRequestValidationError is the validation error returned by // LeaveHostRequest.Validate if the designated constraints aren't met. type LeaveHostRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e LeaveHostRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e LeaveHostRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e LeaveHostRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e LeaveHostRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e LeaveHostRequestValidationError) ErrorName() string { return "LeaveHostRequestValidationError" } // Error satisfies the builtin error interface func (e LeaveHostRequestValidationError) 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 %sLeaveHostRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = LeaveHostRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = LeaveHostRequestValidationError{} // 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.GetUpdatedAt() == nil { err := ProbeValidationError{ field: "UpdatedAt", 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 ProbesOfHost 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 *ProbesOfHost) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ProbesOfHost 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 ProbesOfHostMultiError, or // nil if none found. func (m *ProbesOfHost) ValidateAll() error { return m.validate(true) } func (m *ProbesOfHost) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetHost() == nil { err := ProbesOfHostValidationError{ 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, ProbesOfHostValidationError{ field: "Host", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ProbesOfHostValidationError{ 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 ProbesOfHostValidationError{ field: "Host", reason: "embedded message failed validation", cause: err, } } } if len(m.GetProbes()) > 0 { if len(m.GetProbes()) < 1 { err := ProbesOfHostValidationError{ 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, ProbesOfHostValidationError{ 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, ProbesOfHostValidationError{ 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 ProbesOfHostValidationError{ field: fmt.Sprintf("Probes[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } } if len(errors) > 0 { return ProbesOfHostMultiError(errors) } return nil } // ProbesOfHostMultiError is an error wrapping multiple validation errors // returned by ProbesOfHost.ValidateAll() if the designated constraints aren't met. type ProbesOfHostMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ProbesOfHostMultiError) 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 ProbesOfHostMultiError) AllErrors() []error { return m } // ProbesOfHostValidationError is the validation error returned by // ProbesOfHost.Validate if the designated constraints aren't met. type ProbesOfHostValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ProbesOfHostValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ProbesOfHostValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ProbesOfHostValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ProbesOfHostValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ProbesOfHostValidationError) ErrorName() string { return "ProbesOfHostValidationError" } // Error satisfies the builtin error interface func (e ProbesOfHostValidationError) 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 %sProbesOfHost.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ProbesOfHostValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ProbesOfHostValidationError{} // 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.GetProbesOfHost() == nil { err := SyncProbesRequestValidationError{ field: "ProbesOfHost", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetProbesOfHost()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SyncProbesRequestValidationError{ field: "ProbesOfHost", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SyncProbesRequestValidationError{ field: "ProbesOfHost", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetProbesOfHost()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SyncProbesRequestValidationError{ field: "ProbesOfHost", reason: "embedded message failed validation", cause: 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 m.GetProbeInterval() == nil { err := SyncProbesResponseValidationError{ field: "ProbeInterval", reason: "value is required", } if !all { return err } errors = append(errors, 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 UpdateHostsRequest 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 *UpdateHostsRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UpdateHostsRequest 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 // UpdateHostsRequestMultiError, or nil if none found. func (m *UpdateHostsRequest) ValidateAll() error { return m.validate(true) } func (m *UpdateHostsRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetProbesOfHosts()) < 1 { err := UpdateHostsRequestValidationError{ field: "ProbesOfHosts", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } for idx, item := range m.GetProbesOfHosts() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, UpdateHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, UpdateHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%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 UpdateHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return UpdateHostsRequestMultiError(errors) } return nil } // UpdateHostsRequestMultiError is an error wrapping multiple validation errors // returned by UpdateHostsRequest.ValidateAll() if the designated constraints // aren't met. type UpdateHostsRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UpdateHostsRequestMultiError) 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 UpdateHostsRequestMultiError) AllErrors() []error { return m } // UpdateHostsRequestValidationError is the validation error returned by // UpdateHostsRequest.Validate if the designated constraints aren't met. type UpdateHostsRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UpdateHostsRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UpdateHostsRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UpdateHostsRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UpdateHostsRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UpdateHostsRequestValidationError) ErrorName() string { return "UpdateHostsRequestValidationError" } // Error satisfies the builtin error interface func (e UpdateHostsRequestValidationError) 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 %sUpdateHostsRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UpdateHostsRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UpdateHostsRequestValidationError{} // Validate checks the field values on DeleteHostsRequest 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 *DeleteHostsRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteHostsRequest 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 // DeleteHostsRequestMultiError, or nil if none found. func (m *DeleteHostsRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteHostsRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetProbesOfHosts()) < 1 { err := DeleteHostsRequestValidationError{ field: "ProbesOfHosts", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } for idx, item := range m.GetProbesOfHosts() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DeleteHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DeleteHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%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 DeleteHostsRequestValidationError{ field: fmt.Sprintf("ProbesOfHosts[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return DeleteHostsRequestMultiError(errors) } return nil } // DeleteHostsRequestMultiError is an error wrapping multiple validation errors // returned by DeleteHostsRequest.ValidateAll() if the designated constraints // aren't met. type DeleteHostsRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteHostsRequestMultiError) 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 DeleteHostsRequestMultiError) AllErrors() []error { return m } // DeleteHostsRequestValidationError is the validation error returned by // DeleteHostsRequest.Validate if the designated constraints aren't met. type DeleteHostsRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteHostsRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteHostsRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteHostsRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteHostsRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteHostsRequestValidationError) ErrorName() string { return "DeleteHostsRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteHostsRequestValidationError) 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 %sDeleteHostsRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteHostsRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteHostsRequestValidationError{} // Validate checks the field values on SyncNetworkTopologyRequest 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 *SyncNetworkTopologyRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncNetworkTopologyRequest 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 // SyncNetworkTopologyRequestMultiError, or nil if none found. func (m *SyncNetworkTopologyRequest) ValidateAll() error { return m.validate(true) } func (m *SyncNetworkTopologyRequest) validate(all bool) error { if m == nil { return nil } var errors []error oneofRequestPresent := false switch v := m.Request.(type) { case *SyncNetworkTopologyRequest_UpdateProbesOfHostsRequest: if v == nil { err := SyncNetworkTopologyRequestValidationError{ 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.GetUpdateProbesOfHostsRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SyncNetworkTopologyRequestValidationError{ field: "UpdateProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SyncNetworkTopologyRequestValidationError{ field: "UpdateProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetUpdateProbesOfHostsRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SyncNetworkTopologyRequestValidationError{ field: "UpdateProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, } } } case *SyncNetworkTopologyRequest_DeleteProbesOfHostsRequest: if v == nil { err := SyncNetworkTopologyRequestValidationError{ 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.GetDeleteProbesOfHostsRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SyncNetworkTopologyRequestValidationError{ field: "DeleteProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SyncNetworkTopologyRequestValidationError{ field: "DeleteProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDeleteProbesOfHostsRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SyncNetworkTopologyRequestValidationError{ field: "DeleteProbesOfHostsRequest", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofRequestPresent { err := SyncNetworkTopologyRequestValidationError{ field: "Request", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return SyncNetworkTopologyRequestMultiError(errors) } return nil } // SyncNetworkTopologyRequestMultiError is an error wrapping multiple // validation errors returned by SyncNetworkTopologyRequest.ValidateAll() if // the designated constraints aren't met. type SyncNetworkTopologyRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncNetworkTopologyRequestMultiError) 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 SyncNetworkTopologyRequestMultiError) AllErrors() []error { return m } // SyncNetworkTopologyRequestValidationError is the validation error returned // by SyncNetworkTopologyRequest.Validate if the designated constraints aren't met. type SyncNetworkTopologyRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncNetworkTopologyRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncNetworkTopologyRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncNetworkTopologyRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncNetworkTopologyRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncNetworkTopologyRequestValidationError) ErrorName() string { return "SyncNetworkTopologyRequestValidationError" } // Error satisfies the builtin error interface func (e SyncNetworkTopologyRequestValidationError) 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 %sSyncNetworkTopologyRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncNetworkTopologyRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncNetworkTopologyRequestValidationError{}