// Code generated by protoc-gen-validate. DO NOT EDIT. // source: pkg/apis/scheduler/v2/scheduler.proto package scheduler import ( "bytes" "errors" "fmt" "net" "net/mail" "net/url" "regexp" "sort" "strings" "time" "unicode/utf8" "google.golang.org/protobuf/types/known/anypb" ) // ensure the imports are used var ( _ = bytes.MinRead _ = errors.New("") _ = fmt.Print _ = utf8.UTFMax _ = (*regexp.Regexp)(nil) _ = (*strings.Reader)(nil) _ = net.IPv4len _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} _ = sort.Sort ) // Validate checks the field values on RegisterPeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *RegisterPeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RegisterPeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // RegisterPeerRequestMultiError, or nil if none found. func (m *RegisterPeerRequest) ValidateAll() error { return m.validate(true) } func (m *RegisterPeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetDownload() == nil { err := RegisterPeerRequestValidationError{ field: "Download", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetDownload()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterPeerRequestValidationError{ field: "Download", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterPeerRequestValidationError{ field: "Download", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownload()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterPeerRequestValidationError{ field: "Download", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return RegisterPeerRequestMultiError(errors) } return nil } // RegisterPeerRequestMultiError is an error wrapping multiple validation // errors returned by RegisterPeerRequest.ValidateAll() if the designated // constraints aren't met. type RegisterPeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RegisterPeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m RegisterPeerRequestMultiError) AllErrors() []error { return m } // RegisterPeerRequestValidationError is the validation error returned by // RegisterPeerRequest.Validate if the designated constraints aren't met. type RegisterPeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RegisterPeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RegisterPeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RegisterPeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RegisterPeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RegisterPeerRequestValidationError) ErrorName() string { return "RegisterPeerRequestValidationError" } // Error satisfies the builtin error interface func (e RegisterPeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRegisterPeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RegisterPeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RegisterPeerRequestValidationError{} // Validate checks the field values on DownloadPeerStartedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadPeerStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPeerStartedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DownloadPeerStartedRequestMultiError, or nil if none found. func (m *DownloadPeerStartedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerStartedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return DownloadPeerStartedRequestMultiError(errors) } return nil } // DownloadPeerStartedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadPeerStartedRequest.ValidateAll() if // the designated constraints aren't met. type DownloadPeerStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerStartedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerStartedRequestMultiError) AllErrors() []error { return m } // DownloadPeerStartedRequestValidationError is the validation error returned // by DownloadPeerStartedRequest.Validate if the designated constraints aren't met. type DownloadPeerStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerStartedRequestValidationError) ErrorName() string { return "DownloadPeerStartedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerStartedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerStartedRequestValidationError{} // Validate checks the field values on DownloadPeerBackToSourceStartedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the first error encountered is returned, or nil if // there are no violations. func (m *DownloadPeerBackToSourceStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPeerBackToSourceStartedRequest with the rules defined in the proto // definition for this message. If any rules are violated, the result is a // list of violation errors wrapped in // DownloadPeerBackToSourceStartedRequestMultiError, or nil if none found. func (m *DownloadPeerBackToSourceStartedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerBackToSourceStartedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := DownloadPeerBackToSourceStartedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadPeerBackToSourceStartedRequestMultiError(errors) } return nil } // DownloadPeerBackToSourceStartedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPeerBackToSourceStartedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPeerBackToSourceStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerBackToSourceStartedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerBackToSourceStartedRequestMultiError) AllErrors() []error { return m } // DownloadPeerBackToSourceStartedRequestValidationError is the validation // error returned by DownloadPeerBackToSourceStartedRequest.Validate if the // designated constraints aren't met. type DownloadPeerBackToSourceStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerBackToSourceStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerBackToSourceStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerBackToSourceStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerBackToSourceStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerBackToSourceStartedRequestValidationError) ErrorName() string { return "DownloadPeerBackToSourceStartedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerBackToSourceStartedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerBackToSourceStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerBackToSourceStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerBackToSourceStartedRequestValidationError{} // Validate checks the field values on ReschedulePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *ReschedulePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ReschedulePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // ReschedulePeerRequestMultiError, or nil if none found. func (m *ReschedulePeerRequest) ValidateAll() error { return m.validate(true) } func (m *ReschedulePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetCandidateParents() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ReschedulePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ReschedulePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReschedulePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := ReschedulePeerRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return ReschedulePeerRequestMultiError(errors) } return nil } // ReschedulePeerRequestMultiError is an error wrapping multiple validation // errors returned by ReschedulePeerRequest.ValidateAll() if the designated // constraints aren't met. type ReschedulePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ReschedulePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m ReschedulePeerRequestMultiError) AllErrors() []error { return m } // ReschedulePeerRequestValidationError is the validation error returned by // ReschedulePeerRequest.Validate if the designated constraints aren't met. type ReschedulePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ReschedulePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ReschedulePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ReschedulePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ReschedulePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ReschedulePeerRequestValidationError) ErrorName() string { return "ReschedulePeerRequestValidationError" } // Error satisfies the builtin error interface func (e ReschedulePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sReschedulePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ReschedulePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ReschedulePeerRequestValidationError{} // Validate checks the field values on DownloadPeerFinishedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadPeerFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPeerFinishedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DownloadPeerFinishedRequestMultiError, or nil if none found. func (m *DownloadPeerFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for ContentLength // no validation rules for PieceCount if len(errors) > 0 { return DownloadPeerFinishedRequestMultiError(errors) } return nil } // DownloadPeerFinishedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadPeerFinishedRequest.ValidateAll() if // the designated constraints aren't met. type DownloadPeerFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerFinishedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerFinishedRequestMultiError) AllErrors() []error { return m } // DownloadPeerFinishedRequestValidationError is the validation error returned // by DownloadPeerFinishedRequest.Validate if the designated constraints // aren't met. type DownloadPeerFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerFinishedRequestValidationError) ErrorName() string { return "DownloadPeerFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerFinishedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerFinishedRequestValidationError{} // Validate checks the field values on DownloadPeerBackToSourceFinishedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the first error encountered is returned, or nil if // there are no violations. func (m *DownloadPeerBackToSourceFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPeerBackToSourceFinishedRequest with the rules defined in the proto // definition for this message. If any rules are violated, the result is a // list of violation errors wrapped in // DownloadPeerBackToSourceFinishedRequestMultiError, or nil if none found. func (m *DownloadPeerBackToSourceFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerBackToSourceFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for ContentLength // no validation rules for PieceCount if len(errors) > 0 { return DownloadPeerBackToSourceFinishedRequestMultiError(errors) } return nil } // DownloadPeerBackToSourceFinishedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPeerBackToSourceFinishedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPeerBackToSourceFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerBackToSourceFinishedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerBackToSourceFinishedRequestMultiError) AllErrors() []error { return m } // DownloadPeerBackToSourceFinishedRequestValidationError is the validation // error returned by DownloadPeerBackToSourceFinishedRequest.Validate if the // designated constraints aren't met. type DownloadPeerBackToSourceFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerBackToSourceFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerBackToSourceFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerBackToSourceFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerBackToSourceFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerBackToSourceFinishedRequestValidationError) ErrorName() string { return "DownloadPeerBackToSourceFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerBackToSourceFinishedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerBackToSourceFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerBackToSourceFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerBackToSourceFinishedRequestValidationError{} // Validate checks the field values on DownloadPeerFailedRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadPeerFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPeerFailedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DownloadPeerFailedRequestMultiError, or nil if none found. func (m *DownloadPeerFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := DownloadPeerFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadPeerFailedRequestMultiError(errors) } return nil } // DownloadPeerFailedRequestMultiError is an error wrapping multiple validation // errors returned by DownloadPeerFailedRequest.ValidateAll() if the // designated constraints aren't met. type DownloadPeerFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerFailedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerFailedRequestMultiError) AllErrors() []error { return m } // DownloadPeerFailedRequestValidationError is the validation error returned by // DownloadPeerFailedRequest.Validate if the designated constraints aren't met. type DownloadPeerFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerFailedRequestValidationError) ErrorName() string { return "DownloadPeerFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerFailedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerFailedRequestValidationError{} // Validate checks the field values on DownloadPeerBackToSourceFailedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the first error encountered is returned, or nil if // there are no violations. func (m *DownloadPeerBackToSourceFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPeerBackToSourceFailedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the result is a list of violation errors wrapped in // DownloadPeerBackToSourceFailedRequestMultiError, or nil if none found. func (m *DownloadPeerBackToSourceFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPeerBackToSourceFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := DownloadPeerBackToSourceFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadPeerBackToSourceFailedRequestMultiError(errors) } return nil } // DownloadPeerBackToSourceFailedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPeerBackToSourceFailedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPeerBackToSourceFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPeerBackToSourceFailedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPeerBackToSourceFailedRequestMultiError) AllErrors() []error { return m } // DownloadPeerBackToSourceFailedRequestValidationError is the validation error // returned by DownloadPeerBackToSourceFailedRequest.Validate if the // designated constraints aren't met. type DownloadPeerBackToSourceFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPeerBackToSourceFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPeerBackToSourceFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPeerBackToSourceFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPeerBackToSourceFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPeerBackToSourceFailedRequestValidationError) ErrorName() string { return "DownloadPeerBackToSourceFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPeerBackToSourceFailedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPeerBackToSourceFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPeerBackToSourceFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPeerBackToSourceFailedRequestValidationError{} // Validate checks the field values on DownloadPieceFinishedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadPieceFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPieceFinishedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DownloadPieceFinishedRequestMultiError, or nil if none found. func (m *DownloadPieceFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := DownloadPieceFinishedRequestValidationError{ field: "Piece", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetPiece()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadPieceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadPieceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return DownloadPieceFinishedRequestMultiError(errors) } return nil } // DownloadPieceFinishedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadPieceFinishedRequest.ValidateAll() if // the designated constraints aren't met. type DownloadPieceFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceFinishedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPieceFinishedRequestMultiError) AllErrors() []error { return m } // DownloadPieceFinishedRequestValidationError is the validation error returned // by DownloadPieceFinishedRequest.Validate if the designated constraints // aren't met. type DownloadPieceFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceFinishedRequestValidationError) ErrorName() string { return "DownloadPieceFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceFinishedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPieceFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceFinishedRequestValidationError{} // Validate checks the field values on DownloadPieceBackToSourceFinishedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the first error encountered is returned, or nil if // there are no violations. func (m *DownloadPieceBackToSourceFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPieceBackToSourceFinishedRequest with the rules defined in the // proto definition for this message. If any rules are violated, the result is // a list of violation errors wrapped in // DownloadPieceBackToSourceFinishedRequestMultiError, or nil if none found. func (m *DownloadPieceBackToSourceFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceBackToSourceFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := DownloadPieceBackToSourceFinishedRequestValidationError{ field: "Piece", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetPiece()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadPieceBackToSourceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceBackToSourceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadPieceBackToSourceFinishedRequestValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return DownloadPieceBackToSourceFinishedRequestMultiError(errors) } return nil } // DownloadPieceBackToSourceFinishedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPieceBackToSourceFinishedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPieceBackToSourceFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceBackToSourceFinishedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPieceBackToSourceFinishedRequestMultiError) AllErrors() []error { return m } // DownloadPieceBackToSourceFinishedRequestValidationError is the validation // error returned by DownloadPieceBackToSourceFinishedRequest.Validate if the // designated constraints aren't met. type DownloadPieceBackToSourceFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceBackToSourceFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceBackToSourceFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceBackToSourceFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceBackToSourceFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceBackToSourceFinishedRequestValidationError) ErrorName() string { return "DownloadPieceBackToSourceFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceBackToSourceFinishedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPieceBackToSourceFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceBackToSourceFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceBackToSourceFinishedRequestValidationError{} // Validate checks the field values on DownloadPieceFailedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadPieceFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPieceFailedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DownloadPieceFailedRequestMultiError, or nil if none found. func (m *DownloadPieceFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetParentId()) < 1 { err := DownloadPieceFailedRequestValidationError{ field: "ParentId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } // no validation rules for Temporary if m.PieceNumber != nil { // no validation rules for PieceNumber } if len(errors) > 0 { return DownloadPieceFailedRequestMultiError(errors) } return nil } // DownloadPieceFailedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadPieceFailedRequest.ValidateAll() if // the designated constraints aren't met. type DownloadPieceFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceFailedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPieceFailedRequestMultiError) AllErrors() []error { return m } // DownloadPieceFailedRequestValidationError is the validation error returned // by DownloadPieceFailedRequest.Validate if the designated constraints aren't met. type DownloadPieceFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceFailedRequestValidationError) ErrorName() string { return "DownloadPieceFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceFailedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPieceFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceFailedRequestValidationError{} // Validate checks the field values on DownloadPieceBackToSourceFailedRequest // with the rules defined in the proto definition for this message. If any // rules are violated, the first error encountered is returned, or nil if // there are no violations. func (m *DownloadPieceBackToSourceFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPieceBackToSourceFailedRequest with the rules defined in the proto // definition for this message. If any rules are violated, the result is a // list of violation errors wrapped in // DownloadPieceBackToSourceFailedRequestMultiError, or nil if none found. func (m *DownloadPieceBackToSourceFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceBackToSourceFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error oneofResponsePresent := false switch v := m.Response.(type) { case *DownloadPieceBackToSourceFailedRequest_Backend: if v == nil { err := DownloadPieceBackToSourceFailedRequestValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetBackend()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{ field: "Backend", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{ field: "Backend", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetBackend()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadPieceBackToSourceFailedRequestValidationError{ field: "Backend", reason: "embedded message failed validation", cause: err, } } } case *DownloadPieceBackToSourceFailedRequest_Unknown: if v == nil { err := DownloadPieceBackToSourceFailedRequestValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetUnknown()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{ field: "Unknown", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceBackToSourceFailedRequestValidationError{ field: "Unknown", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetUnknown()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadPieceBackToSourceFailedRequestValidationError{ field: "Unknown", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := DownloadPieceBackToSourceFailedRequestValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if m.PieceNumber != nil { // no validation rules for PieceNumber } if len(errors) > 0 { return DownloadPieceBackToSourceFailedRequestMultiError(errors) } return nil } // DownloadPieceBackToSourceFailedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPieceBackToSourceFailedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPieceBackToSourceFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceBackToSourceFailedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadPieceBackToSourceFailedRequestMultiError) AllErrors() []error { return m } // DownloadPieceBackToSourceFailedRequestValidationError is the validation // error returned by DownloadPieceBackToSourceFailedRequest.Validate if the // designated constraints aren't met. type DownloadPieceBackToSourceFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceBackToSourceFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceBackToSourceFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceBackToSourceFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceBackToSourceFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceBackToSourceFailedRequestValidationError) ErrorName() string { return "DownloadPieceBackToSourceFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceBackToSourceFailedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadPieceBackToSourceFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceBackToSourceFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceBackToSourceFailedRequestValidationError{} // Validate checks the field values on AnnouncePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *AnnouncePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnouncePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // AnnouncePeerRequestMultiError, or nil if none found. func (m *AnnouncePeerRequest) ValidateAll() error { return m.validate(true) } func (m *AnnouncePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := AnnouncePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := AnnouncePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := AnnouncePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } oneofRequestPresent := false switch v := m.Request.(type) { case *AnnouncePeerRequest_RegisterPeerRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetRegisterPeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "RegisterPeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "RegisterPeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRegisterPeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "RegisterPeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerStartedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerStartedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerStartedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerStartedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerBackToSourceStartedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerBackToSourceStartedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerBackToSourceStartedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_ReschedulePeerRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetReschedulePeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "ReschedulePeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "ReschedulePeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetReschedulePeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "ReschedulePeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerFinishedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerBackToSourceFinishedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerBackToSourceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerBackToSourceFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerFailedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPeerBackToSourceFailedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPeerBackToSourceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPeerBackToSourceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceFinishedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceBackToSourceFinishedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceBackToSourceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceBackToSourceFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceFailedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerRequest_DownloadPieceBackToSourceFailedRequest: if v == nil { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceBackToSourceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceBackToSourceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofRequestPresent { err := AnnouncePeerRequestValidationError{ field: "Request", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnouncePeerRequestMultiError(errors) } return nil } // AnnouncePeerRequestMultiError is an error wrapping multiple validation // errors returned by AnnouncePeerRequest.ValidateAll() if the designated // constraints aren't met. type AnnouncePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnouncePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AnnouncePeerRequestMultiError) AllErrors() []error { return m } // AnnouncePeerRequestValidationError is the validation error returned by // AnnouncePeerRequest.Validate if the designated constraints aren't met. type AnnouncePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnouncePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnouncePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnouncePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnouncePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnouncePeerRequestValidationError) ErrorName() string { return "AnnouncePeerRequestValidationError" } // Error satisfies the builtin error interface func (e AnnouncePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAnnouncePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnouncePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnouncePeerRequestValidationError{} // Validate checks the field values on EmptyTaskResponse with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *EmptyTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on EmptyTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // EmptyTaskResponseMultiError, or nil if none found. func (m *EmptyTaskResponse) ValidateAll() error { return m.validate(true) } func (m *EmptyTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return EmptyTaskResponseMultiError(errors) } return nil } // EmptyTaskResponseMultiError is an error wrapping multiple validation errors // returned by EmptyTaskResponse.ValidateAll() if the designated constraints // aren't met. type EmptyTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m EmptyTaskResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m EmptyTaskResponseMultiError) AllErrors() []error { return m } // EmptyTaskResponseValidationError is the validation error returned by // EmptyTaskResponse.Validate if the designated constraints aren't met. type EmptyTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e EmptyTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e EmptyTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e EmptyTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e EmptyTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e EmptyTaskResponseValidationError) ErrorName() string { return "EmptyTaskResponseValidationError" } // Error satisfies the builtin error interface func (e EmptyTaskResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sEmptyTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = EmptyTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = EmptyTaskResponseValidationError{} // Validate checks the field values on NormalTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *NormalTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on NormalTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // NormalTaskResponseMultiError, or nil if none found. func (m *NormalTaskResponse) ValidateAll() error { return m.validate(true) } func (m *NormalTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetCandidateParents()) < 1 { err := NormalTaskResponseValidationError{ field: "CandidateParents", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } for idx, item := range m.GetCandidateParents() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, NormalTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, NormalTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NormalTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return NormalTaskResponseMultiError(errors) } return nil } // NormalTaskResponseMultiError is an error wrapping multiple validation errors // returned by NormalTaskResponse.ValidateAll() if the designated constraints // aren't met. type NormalTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m NormalTaskResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m NormalTaskResponseMultiError) AllErrors() []error { return m } // NormalTaskResponseValidationError is the validation error returned by // NormalTaskResponse.Validate if the designated constraints aren't met. type NormalTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NormalTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NormalTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NormalTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NormalTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NormalTaskResponseValidationError) ErrorName() string { return "NormalTaskResponseValidationError" } // Error satisfies the builtin error interface func (e NormalTaskResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sNormalTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NormalTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NormalTaskResponseValidationError{} // Validate checks the field values on NeedBackToSourceResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *NeedBackToSourceResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on NeedBackToSourceResponse with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // NeedBackToSourceResponseMultiError, or nil if none found. func (m *NeedBackToSourceResponse) ValidateAll() error { return m.validate(true) } func (m *NeedBackToSourceResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := NeedBackToSourceResponseValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return NeedBackToSourceResponseMultiError(errors) } return nil } // NeedBackToSourceResponseMultiError is an error wrapping multiple validation // errors returned by NeedBackToSourceResponse.ValidateAll() if the designated // constraints aren't met. type NeedBackToSourceResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m NeedBackToSourceResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m NeedBackToSourceResponseMultiError) AllErrors() []error { return m } // NeedBackToSourceResponseValidationError is the validation error returned by // NeedBackToSourceResponse.Validate if the designated constraints aren't met. type NeedBackToSourceResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NeedBackToSourceResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NeedBackToSourceResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NeedBackToSourceResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NeedBackToSourceResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NeedBackToSourceResponseValidationError) ErrorName() string { return "NeedBackToSourceResponseValidationError" } // Error satisfies the builtin error interface func (e NeedBackToSourceResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sNeedBackToSourceResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NeedBackToSourceResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NeedBackToSourceResponseValidationError{} // Validate checks the field values on AnnouncePeerResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *AnnouncePeerResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnouncePeerResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // AnnouncePeerResponseMultiError, or nil if none found. func (m *AnnouncePeerResponse) ValidateAll() error { return m.validate(true) } func (m *AnnouncePeerResponse) validate(all bool) error { if m == nil { return nil } var errors []error oneofResponsePresent := false switch v := m.Response.(type) { case *AnnouncePeerResponse_EmptyTaskResponse: if v == nil { err := AnnouncePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetEmptyTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "EmptyTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "EmptyTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEmptyTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "EmptyTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerResponse_NormalTaskResponse: if v == nil { err := AnnouncePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetNormalTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "NormalTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "NormalTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetNormalTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "NormalTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePeerResponse_NeedBackToSourceResponse: if v == nil { err := AnnouncePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetNeedBackToSourceResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "NeedBackToSourceResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePeerResponseValidationError{ field: "NeedBackToSourceResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetNeedBackToSourceResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePeerResponseValidationError{ field: "NeedBackToSourceResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := AnnouncePeerResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnouncePeerResponseMultiError(errors) } return nil } // AnnouncePeerResponseMultiError is an error wrapping multiple validation // errors returned by AnnouncePeerResponse.ValidateAll() if the designated // constraints aren't met. type AnnouncePeerResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnouncePeerResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AnnouncePeerResponseMultiError) AllErrors() []error { return m } // AnnouncePeerResponseValidationError is the validation error returned by // AnnouncePeerResponse.Validate if the designated constraints aren't met. type AnnouncePeerResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnouncePeerResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnouncePeerResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnouncePeerResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnouncePeerResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnouncePeerResponseValidationError) ErrorName() string { return "AnnouncePeerResponseValidationError" } // Error satisfies the builtin error interface func (e AnnouncePeerResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAnnouncePeerResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnouncePeerResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnouncePeerResponseValidationError{} // Validate checks the field values on StatPeerRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *StatPeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatPeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatPeerRequestMultiError, or nil if none found. func (m *StatPeerRequest) ValidateAll() error { return m.validate(true) } func (m *StatPeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatPeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatPeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := StatPeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatPeerRequestMultiError(errors) } return nil } // StatPeerRequestMultiError is an error wrapping multiple validation errors // returned by StatPeerRequest.ValidateAll() if the designated constraints // aren't met. type StatPeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatPeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatPeerRequestMultiError) AllErrors() []error { return m } // StatPeerRequestValidationError is the validation error returned by // StatPeerRequest.Validate if the designated constraints aren't met. type StatPeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatPeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatPeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatPeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatPeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatPeerRequestValidationError) ErrorName() string { return "StatPeerRequestValidationError" } // Error satisfies the builtin error interface func (e StatPeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatPeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatPeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatPeerRequestValidationError{} // Validate checks the field values on DeletePeerRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *DeletePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeletePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeletePeerRequestMultiError, or nil if none found. func (m *DeletePeerRequest) ValidateAll() error { return m.validate(true) } func (m *DeletePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeletePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeletePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := DeletePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeletePeerRequestMultiError(errors) } return nil } // DeletePeerRequestMultiError is an error wrapping multiple validation errors // returned by DeletePeerRequest.ValidateAll() if the designated constraints // aren't met. type DeletePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeletePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DeletePeerRequestMultiError) AllErrors() []error { return m } // DeletePeerRequestValidationError is the validation error returned by // DeletePeerRequest.Validate if the designated constraints aren't met. type DeletePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeletePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeletePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeletePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeletePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeletePeerRequestValidationError) ErrorName() string { return "DeletePeerRequestValidationError" } // Error satisfies the builtin error interface func (e DeletePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDeletePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeletePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeletePeerRequestValidationError{} // Validate checks the field values on StatTaskRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *StatTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatTaskRequestMultiError, or nil if none found. func (m *StatTaskRequest) ValidateAll() error { return m.validate(true) } func (m *StatTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatTaskRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatTaskRequestMultiError(errors) } return nil } // StatTaskRequestMultiError is an error wrapping multiple validation errors // returned by StatTaskRequest.ValidateAll() if the designated constraints // aren't met. type StatTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatTaskRequestMultiError) AllErrors() []error { return m } // StatTaskRequestValidationError is the validation error returned by // StatTaskRequest.Validate if the designated constraints aren't met. type StatTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatTaskRequestValidationError) ErrorName() string { return "StatTaskRequestValidationError" } // Error satisfies the builtin error interface func (e StatTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatTaskRequestValidationError{} // Validate checks the field values on DeleteTaskRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *DeleteTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteTaskRequestMultiError, or nil if none found. func (m *DeleteTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeleteTaskRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeleteTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeleteTaskRequestMultiError(errors) } return nil } // DeleteTaskRequestMultiError is an error wrapping multiple validation errors // returned by DeleteTaskRequest.ValidateAll() if the designated constraints // aren't met. type DeleteTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DeleteTaskRequestMultiError) AllErrors() []error { return m } // DeleteTaskRequestValidationError is the validation error returned by // DeleteTaskRequest.Validate if the designated constraints aren't met. type DeleteTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteTaskRequestValidationError) ErrorName() string { return "DeleteTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDeleteTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteTaskRequestValidationError{} // Validate checks the field values on AnnounceHostRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *AnnounceHostRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnounceHostRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // AnnounceHostRequestMultiError, or nil if none found. func (m *AnnounceHostRequest) ValidateAll() error { return m.validate(true) } func (m *AnnounceHostRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetHost() == nil { err := AnnounceHostRequestValidationError{ field: "Host", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetHost()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Host", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Host", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetHost()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Host", reason: "embedded message failed validation", cause: err, } } } if m.Interval != nil { if all { switch v := interface{}(m.GetInterval()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Interval", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceHostRequestValidationError{ field: "Interval", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetInterval()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceHostRequestValidationError{ field: "Interval", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return AnnounceHostRequestMultiError(errors) } return nil } // AnnounceHostRequestMultiError is an error wrapping multiple validation // errors returned by AnnounceHostRequest.ValidateAll() if the designated // constraints aren't met. type AnnounceHostRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnounceHostRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AnnounceHostRequestMultiError) AllErrors() []error { return m } // AnnounceHostRequestValidationError is the validation error returned by // AnnounceHostRequest.Validate if the designated constraints aren't met. type AnnounceHostRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnounceHostRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnounceHostRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnounceHostRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnounceHostRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnounceHostRequestValidationError) ErrorName() string { return "AnnounceHostRequestValidationError" } // Error satisfies the builtin error interface func (e AnnounceHostRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAnnounceHostRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnounceHostRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnounceHostRequestValidationError{} // Validate checks the field values on ListHostsResponse 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 *ListHostsResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListHostsResponse 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 // ListHostsResponseMultiError, or nil if none found. func (m *ListHostsResponse) ValidateAll() error { return m.validate(true) } func (m *ListHostsResponse) validate(all bool) error { if m == nil { return nil } var errors []error 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, ListHostsResponseValidationError{ 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, ListHostsResponseValidationError{ 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 ListHostsResponseValidationError{ field: fmt.Sprintf("Hosts[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ListHostsResponseMultiError(errors) } return nil } // ListHostsResponseMultiError is an error wrapping multiple validation errors // returned by ListHostsResponse.ValidateAll() if the designated constraints // aren't met. type ListHostsResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListHostsResponseMultiError) 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 ListHostsResponseMultiError) AllErrors() []error { return m } // ListHostsResponseValidationError is the validation error returned by // ListHostsResponse.Validate if the designated constraints aren't met. type ListHostsResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListHostsResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListHostsResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListHostsResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListHostsResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListHostsResponseValidationError) ErrorName() string { return "ListHostsResponseValidationError" } // Error satisfies the builtin error interface func (e ListHostsResponseValidationError) 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 %sListHostsResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListHostsResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListHostsResponseValidationError{} // Validate checks the field values on DeleteHostRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *DeleteHostRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteHostRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteHostRequestMultiError, or nil if none found. func (m *DeleteHostRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteHostRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeleteHostRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeleteHostRequestMultiError(errors) } return nil } // DeleteHostRequestMultiError is an error wrapping multiple validation errors // returned by DeleteHostRequest.ValidateAll() if the designated constraints // aren't met. type DeleteHostRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteHostRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DeleteHostRequestMultiError) AllErrors() []error { return m } // DeleteHostRequestValidationError is the validation error returned by // DeleteHostRequest.Validate if the designated constraints aren't met. type DeleteHostRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteHostRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteHostRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteHostRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteHostRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteHostRequestValidationError) ErrorName() string { return "DeleteHostRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteHostRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDeleteHostRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteHostRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteHostRequestValidationError{} // Validate checks the field values on RegisterPersistentCachePeerRequest 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 *RegisterPersistentCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RegisterPersistentCachePeerRequest // 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 // RegisterPersistentCachePeerRequestMultiError, or nil if none found. func (m *RegisterPersistentCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *RegisterPersistentCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := RegisterPersistentCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := RegisterPersistentCachePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.GetPieceLength() < 1 { err := RegisterPersistentCachePeerRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetOutputPath()) < 1 { err := RegisterPersistentCachePeerRequestValidationError{ field: "OutputPath", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.Tag != nil { // no validation rules for Tag } if m.Application != nil { // no validation rules for Application } if m.Timeout != nil { if all { switch v := interface{}(m.GetTimeout()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterPersistentCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterPersistentCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterPersistentCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return RegisterPersistentCachePeerRequestMultiError(errors) } return nil } // RegisterPersistentCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by // RegisterPersistentCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type RegisterPersistentCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RegisterPersistentCachePeerRequestMultiError) 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 RegisterPersistentCachePeerRequestMultiError) AllErrors() []error { return m } // RegisterPersistentCachePeerRequestValidationError is the validation error // returned by RegisterPersistentCachePeerRequest.Validate if the designated // constraints aren't met. type RegisterPersistentCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RegisterPersistentCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RegisterPersistentCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RegisterPersistentCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RegisterPersistentCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RegisterPersistentCachePeerRequestValidationError) ErrorName() string { return "RegisterPersistentCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e RegisterPersistentCachePeerRequestValidationError) 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 %sRegisterPersistentCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RegisterPersistentCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RegisterPersistentCachePeerRequestValidationError{} // Validate checks the field values on // DownloadPersistentCachePeerStartedRequest 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 *DownloadPersistentCachePeerStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPersistentCachePeerStartedRequest 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 // DownloadPersistentCachePeerStartedRequestMultiError, or nil if none found. func (m *DownloadPersistentCachePeerStartedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCachePeerStartedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return DownloadPersistentCachePeerStartedRequestMultiError(errors) } return nil } // DownloadPersistentCachePeerStartedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPersistentCachePeerStartedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCachePeerStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCachePeerStartedRequestMultiError) 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 DownloadPersistentCachePeerStartedRequestMultiError) AllErrors() []error { return m } // DownloadPersistentCachePeerStartedRequestValidationError is the validation // error returned by DownloadPersistentCachePeerStartedRequest.Validate if the // designated constraints aren't met. type DownloadPersistentCachePeerStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCachePeerStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCachePeerStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCachePeerStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCachePeerStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCachePeerStartedRequestValidationError) ErrorName() string { return "DownloadPersistentCachePeerStartedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCachePeerStartedRequestValidationError) 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 %sDownloadPersistentCachePeerStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCachePeerStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCachePeerStartedRequestValidationError{} // Validate checks the field values on ReschedulePersistentCachePeerRequest // 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 *ReschedulePersistentCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ReschedulePersistentCachePeerRequest // 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 // ReschedulePersistentCachePeerRequestMultiError, or nil if none found. func (m *ReschedulePersistentCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *ReschedulePersistentCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetCandidateParents() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ReschedulePersistentCachePeerRequestValidationError{ 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, ReschedulePersistentCachePeerRequestValidationError{ 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 ReschedulePersistentCachePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := ReschedulePersistentCachePeerRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return ReschedulePersistentCachePeerRequestMultiError(errors) } return nil } // ReschedulePersistentCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by // ReschedulePersistentCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type ReschedulePersistentCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ReschedulePersistentCachePeerRequestMultiError) 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 ReschedulePersistentCachePeerRequestMultiError) AllErrors() []error { return m } // ReschedulePersistentCachePeerRequestValidationError is the validation error // returned by ReschedulePersistentCachePeerRequest.Validate if the designated // constraints aren't met. type ReschedulePersistentCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ReschedulePersistentCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ReschedulePersistentCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ReschedulePersistentCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ReschedulePersistentCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ReschedulePersistentCachePeerRequestValidationError) ErrorName() string { return "ReschedulePersistentCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e ReschedulePersistentCachePeerRequestValidationError) 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 %sReschedulePersistentCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ReschedulePersistentCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ReschedulePersistentCachePeerRequestValidationError{} // Validate checks the field values on // DownloadPersistentCachePeerFinishedRequest 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 *DownloadPersistentCachePeerFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPersistentCachePeerFinishedRequest 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 // DownloadPersistentCachePeerFinishedRequestMultiError, or nil if none found. func (m *DownloadPersistentCachePeerFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCachePeerFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for PieceCount if len(errors) > 0 { return DownloadPersistentCachePeerFinishedRequestMultiError(errors) } return nil } // DownloadPersistentCachePeerFinishedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPersistentCachePeerFinishedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCachePeerFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCachePeerFinishedRequestMultiError) 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 DownloadPersistentCachePeerFinishedRequestMultiError) AllErrors() []error { return m } // DownloadPersistentCachePeerFinishedRequestValidationError is the validation // error returned by DownloadPersistentCachePeerFinishedRequest.Validate if // the designated constraints aren't met. type DownloadPersistentCachePeerFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCachePeerFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCachePeerFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCachePeerFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCachePeerFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCachePeerFinishedRequestValidationError) ErrorName() string { return "DownloadPersistentCachePeerFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCachePeerFinishedRequestValidationError) 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 %sDownloadPersistentCachePeerFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCachePeerFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCachePeerFinishedRequestValidationError{} // Validate checks the field values on DownloadPersistentCachePeerFailedRequest // 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 *DownloadPersistentCachePeerFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPersistentCachePeerFailedRequest 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 // DownloadPersistentCachePeerFailedRequestMultiError, or nil if none found. func (m *DownloadPersistentCachePeerFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCachePeerFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := DownloadPersistentCachePeerFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadPersistentCachePeerFailedRequestMultiError(errors) } return nil } // DownloadPersistentCachePeerFailedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadPersistentCachePeerFailedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCachePeerFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCachePeerFailedRequestMultiError) 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 DownloadPersistentCachePeerFailedRequestMultiError) AllErrors() []error { return m } // DownloadPersistentCachePeerFailedRequestValidationError is the validation // error returned by DownloadPersistentCachePeerFailedRequest.Validate if the // designated constraints aren't met. type DownloadPersistentCachePeerFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCachePeerFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCachePeerFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCachePeerFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCachePeerFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCachePeerFailedRequestValidationError) ErrorName() string { return "DownloadPersistentCachePeerFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCachePeerFailedRequestValidationError) 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 %sDownloadPersistentCachePeerFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCachePeerFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCachePeerFailedRequestValidationError{} // Validate checks the field values on AnnouncePersistentCachePeerRequest 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 *AnnouncePersistentCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnouncePersistentCachePeerRequest // 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 // AnnouncePersistentCachePeerRequestMultiError, or nil if none found. func (m *AnnouncePersistentCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *AnnouncePersistentCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := AnnouncePersistentCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := AnnouncePersistentCachePeerRequestValidationError{ 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 := AnnouncePersistentCachePeerRequestValidationError{ 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 *AnnouncePersistentCachePeerRequest_RegisterPersistentCachePeerRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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.GetRegisterPersistentCachePeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "RegisterPersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "RegisterPersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRegisterPersistentCachePeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "RegisterPersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_DownloadPersistentCachePeerStartedRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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.GetDownloadPersistentCachePeerStartedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPersistentCachePeerStartedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_ReschedulePersistentCachePeerRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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.GetReschedulePersistentCachePeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "ReschedulePersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "ReschedulePersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetReschedulePersistentCachePeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "ReschedulePersistentCachePeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_DownloadPersistentCachePeerFinishedRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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.GetDownloadPersistentCachePeerFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPersistentCachePeerFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_DownloadPersistentCachePeerFailedRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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.GetDownloadPersistentCachePeerFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPersistentCachePeerFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPersistentCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_DownloadPieceFinishedRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ 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, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ 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 AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerRequest_DownloadPieceFailedRequest: if v == nil { err := AnnouncePersistentCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofRequestPresent { err := AnnouncePersistentCachePeerRequestValidationError{ field: "Request", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnouncePersistentCachePeerRequestMultiError(errors) } return nil } // AnnouncePersistentCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by // AnnouncePersistentCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type AnnouncePersistentCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnouncePersistentCachePeerRequestMultiError) 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 AnnouncePersistentCachePeerRequestMultiError) AllErrors() []error { return m } // AnnouncePersistentCachePeerRequestValidationError is the validation error // returned by AnnouncePersistentCachePeerRequest.Validate if the designated // constraints aren't met. type AnnouncePersistentCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnouncePersistentCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnouncePersistentCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnouncePersistentCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnouncePersistentCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnouncePersistentCachePeerRequestValidationError) ErrorName() string { return "AnnouncePersistentCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e AnnouncePersistentCachePeerRequestValidationError) 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 %sAnnouncePersistentCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnouncePersistentCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnouncePersistentCachePeerRequestValidationError{} // Validate checks the field values on EmptyPersistentCacheTaskResponse 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 *EmptyPersistentCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on EmptyPersistentCacheTaskResponse 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 // EmptyPersistentCacheTaskResponseMultiError, or nil if none found. func (m *EmptyPersistentCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *EmptyPersistentCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return EmptyPersistentCacheTaskResponseMultiError(errors) } return nil } // EmptyPersistentCacheTaskResponseMultiError is an error wrapping multiple // validation errors returned by // EmptyPersistentCacheTaskResponse.ValidateAll() if the designated // constraints aren't met. type EmptyPersistentCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m EmptyPersistentCacheTaskResponseMultiError) 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 EmptyPersistentCacheTaskResponseMultiError) AllErrors() []error { return m } // EmptyPersistentCacheTaskResponseValidationError is the validation error // returned by EmptyPersistentCacheTaskResponse.Validate if the designated // constraints aren't met. type EmptyPersistentCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e EmptyPersistentCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e EmptyPersistentCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e EmptyPersistentCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e EmptyPersistentCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e EmptyPersistentCacheTaskResponseValidationError) ErrorName() string { return "EmptyPersistentCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e EmptyPersistentCacheTaskResponseValidationError) 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 %sEmptyPersistentCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = EmptyPersistentCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = EmptyPersistentCacheTaskResponseValidationError{} // Validate checks the field values on NormalPersistentCacheTaskResponse 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 *NormalPersistentCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on NormalPersistentCacheTaskResponse // 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 // NormalPersistentCacheTaskResponseMultiError, or nil if none found. func (m *NormalPersistentCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *NormalPersistentCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetCandidateParents()) < 1 { err := NormalPersistentCacheTaskResponseValidationError{ 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, NormalPersistentCacheTaskResponseValidationError{ 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, NormalPersistentCacheTaskResponseValidationError{ 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 NormalPersistentCacheTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return NormalPersistentCacheTaskResponseMultiError(errors) } return nil } // NormalPersistentCacheTaskResponseMultiError is an error wrapping multiple // validation errors returned by // NormalPersistentCacheTaskResponse.ValidateAll() if the designated // constraints aren't met. type NormalPersistentCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m NormalPersistentCacheTaskResponseMultiError) 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 NormalPersistentCacheTaskResponseMultiError) AllErrors() []error { return m } // NormalPersistentCacheTaskResponseValidationError is the validation error // returned by NormalPersistentCacheTaskResponse.Validate if the designated // constraints aren't met. type NormalPersistentCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NormalPersistentCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NormalPersistentCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NormalPersistentCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NormalPersistentCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NormalPersistentCacheTaskResponseValidationError) ErrorName() string { return "NormalPersistentCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e NormalPersistentCacheTaskResponseValidationError) 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 %sNormalPersistentCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NormalPersistentCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NormalPersistentCacheTaskResponseValidationError{} // Validate checks the field values on AnnouncePersistentCachePeerResponse 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 *AnnouncePersistentCachePeerResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnouncePersistentCachePeerResponse // 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 // AnnouncePersistentCachePeerResponseMultiError, or nil if none found. func (m *AnnouncePersistentCachePeerResponse) ValidateAll() error { return m.validate(true) } func (m *AnnouncePersistentCachePeerResponse) validate(all bool) error { if m == nil { return nil } var errors []error oneofResponsePresent := false switch v := m.Response.(type) { case *AnnouncePersistentCachePeerResponse_EmptyPersistentCacheTaskResponse: if v == nil { err := AnnouncePersistentCachePeerResponseValidationError{ 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.GetEmptyPersistentCacheTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerResponseValidationError{ field: "EmptyPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerResponseValidationError{ field: "EmptyPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEmptyPersistentCacheTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerResponseValidationError{ field: "EmptyPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnouncePersistentCachePeerResponse_NormalPersistentCacheTaskResponse: if v == nil { err := AnnouncePersistentCachePeerResponseValidationError{ 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.GetNormalPersistentCacheTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnouncePersistentCachePeerResponseValidationError{ field: "NormalPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnouncePersistentCachePeerResponseValidationError{ field: "NormalPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetNormalPersistentCacheTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnouncePersistentCachePeerResponseValidationError{ field: "NormalPersistentCacheTaskResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := AnnouncePersistentCachePeerResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnouncePersistentCachePeerResponseMultiError(errors) } return nil } // AnnouncePersistentCachePeerResponseMultiError is an error wrapping multiple // validation errors returned by // AnnouncePersistentCachePeerResponse.ValidateAll() if the designated // constraints aren't met. type AnnouncePersistentCachePeerResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnouncePersistentCachePeerResponseMultiError) 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 AnnouncePersistentCachePeerResponseMultiError) AllErrors() []error { return m } // AnnouncePersistentCachePeerResponseValidationError is the validation error // returned by AnnouncePersistentCachePeerResponse.Validate if the designated // constraints aren't met. type AnnouncePersistentCachePeerResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnouncePersistentCachePeerResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnouncePersistentCachePeerResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnouncePersistentCachePeerResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnouncePersistentCachePeerResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnouncePersistentCachePeerResponseValidationError) ErrorName() string { return "AnnouncePersistentCachePeerResponseValidationError" } // Error satisfies the builtin error interface func (e AnnouncePersistentCachePeerResponseValidationError) 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 %sAnnouncePersistentCachePeerResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnouncePersistentCachePeerResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnouncePersistentCachePeerResponseValidationError{} // Validate checks the field values on StatPersistentCachePeerRequest 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 *StatPersistentCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatPersistentCachePeerRequest 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 // StatPersistentCachePeerRequestMultiError, or nil if none found. func (m *StatPersistentCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *StatPersistentCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatPersistentCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatPersistentCachePeerRequestValidationError{ 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 := StatPersistentCachePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatPersistentCachePeerRequestMultiError(errors) } return nil } // StatPersistentCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by StatPersistentCachePeerRequest.ValidateAll() // if the designated constraints aren't met. type StatPersistentCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatPersistentCachePeerRequestMultiError) 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 StatPersistentCachePeerRequestMultiError) AllErrors() []error { return m } // StatPersistentCachePeerRequestValidationError is the validation error // returned by StatPersistentCachePeerRequest.Validate if the designated // constraints aren't met. type StatPersistentCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatPersistentCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatPersistentCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatPersistentCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatPersistentCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatPersistentCachePeerRequestValidationError) ErrorName() string { return "StatPersistentCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e StatPersistentCachePeerRequestValidationError) 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 %sStatPersistentCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatPersistentCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatPersistentCachePeerRequestValidationError{} // Validate checks the field values on DeletePersistentCachePeerRequest 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 *DeletePersistentCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeletePersistentCachePeerRequest 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 // DeletePersistentCachePeerRequestMultiError, or nil if none found. func (m *DeletePersistentCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *DeletePersistentCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeletePersistentCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeletePersistentCachePeerRequestValidationError{ 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 := DeletePersistentCachePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeletePersistentCachePeerRequestMultiError(errors) } return nil } // DeletePersistentCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by // DeletePersistentCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type DeletePersistentCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeletePersistentCachePeerRequestMultiError) 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 DeletePersistentCachePeerRequestMultiError) AllErrors() []error { return m } // DeletePersistentCachePeerRequestValidationError is the validation error // returned by DeletePersistentCachePeerRequest.Validate if the designated // constraints aren't met. type DeletePersistentCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeletePersistentCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeletePersistentCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeletePersistentCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeletePersistentCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeletePersistentCachePeerRequestValidationError) ErrorName() string { return "DeletePersistentCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e DeletePersistentCachePeerRequestValidationError) 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 %sDeletePersistentCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeletePersistentCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeletePersistentCachePeerRequestValidationError{} // Validate checks the field values on UploadPersistentCacheTaskStartedRequest // 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 *UploadPersistentCacheTaskStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // UploadPersistentCacheTaskStartedRequest 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 // UploadPersistentCacheTaskStartedRequestMultiError, or nil if none found. func (m *UploadPersistentCacheTaskStartedRequest) ValidateAll() error { return m.validate(true) } func (m *UploadPersistentCacheTaskStartedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := UploadPersistentCacheTaskStartedRequestValidationError{ 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 := UploadPersistentCacheTaskStartedRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.GetPersistentReplicaCount() < 1 { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "PersistentReplicaCount", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if !_UploadPersistentCacheTaskStartedRequest_Digest_Pattern.MatchString(m.GetDigest()) { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "Digest", reason: "value does not match regex pattern \"^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$\"", } if !all { return err } errors = append(errors, err) } if m.GetPieceLength() < 1 { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } // no validation rules for ContentLength // no validation rules for PieceCount if d := m.GetTtl(); d != nil { dur, err := d.AsDuration(), d.CheckValid() if err != nil { err = UploadPersistentCacheTaskStartedRequestValidationError{ field: "Ttl", reason: "value is not a valid duration", cause: err, } if !all { return err } errors = append(errors, err) } else { lte := time.Duration(604800*time.Second + 0*time.Nanosecond) gte := time.Duration(60*time.Second + 0*time.Nanosecond) if dur < gte || dur > lte { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "Ttl", reason: "value must be inside range [1m0s, 168h0m0s]", } if !all { return err } errors = append(errors, err) } } } if m.Tag != nil { // no validation rules for Tag } if m.Application != nil { // no validation rules for Application } if len(errors) > 0 { return UploadPersistentCacheTaskStartedRequestMultiError(errors) } return nil } // UploadPersistentCacheTaskStartedRequestMultiError is an error wrapping // multiple validation errors returned by // UploadPersistentCacheTaskStartedRequest.ValidateAll() if the designated // constraints aren't met. type UploadPersistentCacheTaskStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadPersistentCacheTaskStartedRequestMultiError) 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 UploadPersistentCacheTaskStartedRequestMultiError) AllErrors() []error { return m } // UploadPersistentCacheTaskStartedRequestValidationError is the validation // error returned by UploadPersistentCacheTaskStartedRequest.Validate if the // designated constraints aren't met. type UploadPersistentCacheTaskStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadPersistentCacheTaskStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadPersistentCacheTaskStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadPersistentCacheTaskStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadPersistentCacheTaskStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadPersistentCacheTaskStartedRequestValidationError) ErrorName() string { return "UploadPersistentCacheTaskStartedRequestValidationError" } // Error satisfies the builtin error interface func (e UploadPersistentCacheTaskStartedRequestValidationError) 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 %sUploadPersistentCacheTaskStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadPersistentCacheTaskStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadPersistentCacheTaskStartedRequestValidationError{} var _UploadPersistentCacheTaskStartedRequest_Digest_Pattern = regexp.MustCompile("^(md5:[a-fA-F0-9]{32}|sha1:[a-fA-F0-9]{40}|sha256:[a-fA-F0-9]{64}|sha512:[a-fA-F0-9]{128}|blake3:[a-fA-F0-9]{64}|crc32:[a-fA-F0-9]+)$") // Validate checks the field values on UploadPersistentCacheTaskFinishedRequest // 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 *UploadPersistentCacheTaskFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // UploadPersistentCacheTaskFinishedRequest 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 // UploadPersistentCacheTaskFinishedRequestMultiError, or nil if none found. func (m *UploadPersistentCacheTaskFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *UploadPersistentCacheTaskFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := UploadPersistentCacheTaskFinishedRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := UploadPersistentCacheTaskFinishedRequestValidationError{ 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 := UploadPersistentCacheTaskFinishedRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return UploadPersistentCacheTaskFinishedRequestMultiError(errors) } return nil } // UploadPersistentCacheTaskFinishedRequestMultiError is an error wrapping // multiple validation errors returned by // UploadPersistentCacheTaskFinishedRequest.ValidateAll() if the designated // constraints aren't met. type UploadPersistentCacheTaskFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadPersistentCacheTaskFinishedRequestMultiError) 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 UploadPersistentCacheTaskFinishedRequestMultiError) AllErrors() []error { return m } // UploadPersistentCacheTaskFinishedRequestValidationError is the validation // error returned by UploadPersistentCacheTaskFinishedRequest.Validate if the // designated constraints aren't met. type UploadPersistentCacheTaskFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadPersistentCacheTaskFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadPersistentCacheTaskFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadPersistentCacheTaskFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadPersistentCacheTaskFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadPersistentCacheTaskFinishedRequestValidationError) ErrorName() string { return "UploadPersistentCacheTaskFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e UploadPersistentCacheTaskFinishedRequestValidationError) 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 %sUploadPersistentCacheTaskFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadPersistentCacheTaskFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadPersistentCacheTaskFinishedRequestValidationError{} // Validate checks the field values on UploadPersistentCacheTaskFailedRequest // 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 *UploadPersistentCacheTaskFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // UploadPersistentCacheTaskFailedRequest 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 // UploadPersistentCacheTaskFailedRequestMultiError, or nil if none found. func (m *UploadPersistentCacheTaskFailedRequest) ValidateAll() error { return m.validate(true) } func (m *UploadPersistentCacheTaskFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := UploadPersistentCacheTaskFailedRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := UploadPersistentCacheTaskFailedRequestValidationError{ 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 := UploadPersistentCacheTaskFailedRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := UploadPersistentCacheTaskFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return UploadPersistentCacheTaskFailedRequestMultiError(errors) } return nil } // UploadPersistentCacheTaskFailedRequestMultiError is an error wrapping // multiple validation errors returned by // UploadPersistentCacheTaskFailedRequest.ValidateAll() if the designated // constraints aren't met. type UploadPersistentCacheTaskFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadPersistentCacheTaskFailedRequestMultiError) 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 UploadPersistentCacheTaskFailedRequestMultiError) AllErrors() []error { return m } // UploadPersistentCacheTaskFailedRequestValidationError is the validation // error returned by UploadPersistentCacheTaskFailedRequest.Validate if the // designated constraints aren't met. type UploadPersistentCacheTaskFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadPersistentCacheTaskFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadPersistentCacheTaskFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadPersistentCacheTaskFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadPersistentCacheTaskFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadPersistentCacheTaskFailedRequestValidationError) ErrorName() string { return "UploadPersistentCacheTaskFailedRequestValidationError" } // Error satisfies the builtin error interface func (e UploadPersistentCacheTaskFailedRequestValidationError) 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 %sUploadPersistentCacheTaskFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadPersistentCacheTaskFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadPersistentCacheTaskFailedRequestValidationError{} // Validate checks the field values on StatPersistentCacheTaskRequest 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 *StatPersistentCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatPersistentCacheTaskRequest 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 // StatPersistentCacheTaskRequestMultiError, or nil if none found. func (m *StatPersistentCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *StatPersistentCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatPersistentCacheTaskRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatPersistentCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatPersistentCacheTaskRequestMultiError(errors) } return nil } // StatPersistentCacheTaskRequestMultiError is an error wrapping multiple // validation errors returned by StatPersistentCacheTaskRequest.ValidateAll() // if the designated constraints aren't met. type StatPersistentCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatPersistentCacheTaskRequestMultiError) 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 StatPersistentCacheTaskRequestMultiError) AllErrors() []error { return m } // StatPersistentCacheTaskRequestValidationError is the validation error // returned by StatPersistentCacheTaskRequest.Validate if the designated // constraints aren't met. type StatPersistentCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatPersistentCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatPersistentCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatPersistentCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatPersistentCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatPersistentCacheTaskRequestValidationError) ErrorName() string { return "StatPersistentCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e StatPersistentCacheTaskRequestValidationError) 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 %sStatPersistentCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatPersistentCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatPersistentCacheTaskRequestValidationError{} // Validate checks the field values on DeletePersistentCacheTaskRequest 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 *DeletePersistentCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeletePersistentCacheTaskRequest 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 // DeletePersistentCacheTaskRequestMultiError, or nil if none found. func (m *DeletePersistentCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DeletePersistentCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeletePersistentCacheTaskRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeletePersistentCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeletePersistentCacheTaskRequestMultiError(errors) } return nil } // DeletePersistentCacheTaskRequestMultiError is an error wrapping multiple // validation errors returned by // DeletePersistentCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type DeletePersistentCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeletePersistentCacheTaskRequestMultiError) 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 DeletePersistentCacheTaskRequestMultiError) AllErrors() []error { return m } // DeletePersistentCacheTaskRequestValidationError is the validation error // returned by DeletePersistentCacheTaskRequest.Validate if the designated // constraints aren't met. type DeletePersistentCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeletePersistentCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeletePersistentCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeletePersistentCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeletePersistentCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeletePersistentCacheTaskRequestValidationError) ErrorName() string { return "DeletePersistentCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DeletePersistentCacheTaskRequestValidationError) 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 %sDeletePersistentCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeletePersistentCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeletePersistentCacheTaskRequestValidationError{}