// 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" common "d7y.io/api/v2/pkg/apis/common/v2" ) // 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 _ = common.Priority(0) ) // 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 RegisterCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *RegisterCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RegisterCachePeerRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // RegisterCachePeerRequestMultiError, or nil if none found. func (m *RegisterCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *RegisterCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if uri, err := url.Parse(m.GetUrl()); err != nil { err = RegisterCachePeerRequestValidationError{ field: "Url", reason: "value must be a valid URI", cause: err, } if !all { return err } errors = append(errors, err) } else if !uri.IsAbs() { err := RegisterCachePeerRequestValidationError{ field: "Url", reason: "value must be absolute", } if !all { return err } errors = append(errors, err) } if _, ok := common.TaskType_name[int32(m.GetType())]; !ok { err := RegisterCachePeerRequestValidationError{ field: "Type", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if _, ok := common.Priority_name[int32(m.GetPriority())]; !ok { err := RegisterCachePeerRequestValidationError{ field: "Priority", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } // no validation rules for RequestHeader // no validation rules for DisableBackToSource // no validation rules for NeedBackToSource // no validation rules for Prefetch // no validation rules for IsPrefetch // no validation rules for NeedPieceContent if m.Digest != nil { if m.GetDigest() != "" { if !_RegisterCachePeerRequest_Digest_Pattern.MatchString(m.GetDigest()) { err := RegisterCachePeerRequestValidationError{ 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.Range != nil { if all { switch v := interface{}(m.GetRange()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Range", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Range", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRange()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterCachePeerRequestValidationError{ field: "Range", reason: "embedded message failed validation", cause: err, } } } } if m.Tag != nil { // no validation rules for Tag } if m.Application != nil { // no validation rules for Application } if m.PieceLength != nil { if m.GetPieceLength() != 0 { if m.GetPieceLength() < 4194304 { err := RegisterCachePeerRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 4194304", } if !all { return err } errors = append(errors, err) } } } if m.OutputPath != nil { if m.GetOutputPath() != "" { if utf8.RuneCountInString(m.GetOutputPath()) < 1 { err := RegisterCachePeerRequestValidationError{ field: "OutputPath", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if m.Timeout != nil { if all { switch v := interface{}(m.GetTimeout()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterCachePeerRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if m.ObjectStorage != nil { if all { switch v := interface{}(m.GetObjectStorage()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "ObjectStorage", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "ObjectStorage", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetObjectStorage()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterCachePeerRequestValidationError{ field: "ObjectStorage", reason: "embedded message failed validation", cause: err, } } } } if m.Hdfs != nil { if all { switch v := interface{}(m.GetHdfs()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Hdfs", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RegisterCachePeerRequestValidationError{ field: "Hdfs", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetHdfs()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RegisterCachePeerRequestValidationError{ field: "Hdfs", reason: "embedded message failed validation", cause: err, } } } } if m.ContentForCalculatingTaskId != nil { // no validation rules for ContentForCalculatingTaskId } if m.RemoteIp != nil { if m.GetRemoteIp() != "" { if ip := net.ParseIP(m.GetRemoteIp()); ip == nil { err := RegisterCachePeerRequestValidationError{ field: "RemoteIp", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return RegisterCachePeerRequestMultiError(errors) } return nil } // RegisterCachePeerRequestMultiError is an error wrapping multiple validation // errors returned by RegisterCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type RegisterCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RegisterCachePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m RegisterCachePeerRequestMultiError) AllErrors() []error { return m } // RegisterCachePeerRequestValidationError is the validation error returned by // RegisterCachePeerRequest.Validate if the designated constraints aren't met. type RegisterCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RegisterCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RegisterCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RegisterCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RegisterCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RegisterCachePeerRequestValidationError) ErrorName() string { return "RegisterCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e RegisterCachePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRegisterCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RegisterCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RegisterCachePeerRequestValidationError{} var _RegisterCachePeerRequest_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 DownloadCachePeerStartedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadCachePeerStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCachePeerStartedRequest with // the rules defined in the proto definition for this message. If any rules // are violated, the result is a list of violation errors wrapped in // DownloadCachePeerStartedRequestMultiError, or nil if none found. func (m *DownloadCachePeerStartedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerStartedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return DownloadCachePeerStartedRequestMultiError(errors) } return nil } // DownloadCachePeerStartedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadCachePeerStartedRequest.ValidateAll() // if the designated constraints aren't met. type DownloadCachePeerStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerStartedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadCachePeerStartedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerStartedRequestValidationError is the validation error // returned by DownloadCachePeerStartedRequest.Validate if the designated // constraints aren't met. type DownloadCachePeerStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerStartedRequestValidationError) ErrorName() string { return "DownloadCachePeerStartedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerStartedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadCachePeerStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerStartedRequestValidationError{} // Validate checks the field values on // DownloadCachePeerBackToSourceStartedRequest 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 *DownloadCachePeerBackToSourceStartedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadCachePeerBackToSourceStartedRequest 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 // DownloadCachePeerBackToSourceStartedRequestMultiError, or nil if none found. func (m *DownloadCachePeerBackToSourceStartedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerBackToSourceStartedRequest) 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 := DownloadCachePeerBackToSourceStartedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadCachePeerBackToSourceStartedRequestMultiError(errors) } return nil } // DownloadCachePeerBackToSourceStartedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadCachePeerBackToSourceStartedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadCachePeerBackToSourceStartedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerBackToSourceStartedRequestMultiError) 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 DownloadCachePeerBackToSourceStartedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerBackToSourceStartedRequestValidationError is the validation // error returned by DownloadCachePeerBackToSourceStartedRequest.Validate if // the designated constraints aren't met. type DownloadCachePeerBackToSourceStartedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerBackToSourceStartedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerBackToSourceStartedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerBackToSourceStartedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerBackToSourceStartedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerBackToSourceStartedRequestValidationError) ErrorName() string { return "DownloadCachePeerBackToSourceStartedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerBackToSourceStartedRequestValidationError) 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 %sDownloadCachePeerBackToSourceStartedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerBackToSourceStartedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerBackToSourceStartedRequestValidationError{} // Validate checks the field values on RescheduleCachePeerRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *RescheduleCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RescheduleCachePeerRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // RescheduleCachePeerRequestMultiError, or nil if none found. func (m *RescheduleCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *RescheduleCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetCandidateParents() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RescheduleCachePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RescheduleCachePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RescheduleCachePeerRequestValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := RescheduleCachePeerRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return RescheduleCachePeerRequestMultiError(errors) } return nil } // RescheduleCachePeerRequestMultiError is an error wrapping multiple // validation errors returned by RescheduleCachePeerRequest.ValidateAll() if // the designated constraints aren't met. type RescheduleCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RescheduleCachePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m RescheduleCachePeerRequestMultiError) AllErrors() []error { return m } // RescheduleCachePeerRequestValidationError is the validation error returned // by RescheduleCachePeerRequest.Validate if the designated constraints aren't met. type RescheduleCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RescheduleCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RescheduleCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RescheduleCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RescheduleCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RescheduleCachePeerRequestValidationError) ErrorName() string { return "RescheduleCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e RescheduleCachePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRescheduleCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RescheduleCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RescheduleCachePeerRequestValidationError{} // Validate checks the field values on DownloadCachePeerFinishedRequest with // the rules defined in the proto definition for this message. If any rules // are violated, the first error encountered is returned, or nil if there are // no violations. func (m *DownloadCachePeerFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCachePeerFinishedRequest with // the rules defined in the proto definition for this message. If any rules // are violated, the result is a list of violation errors wrapped in // DownloadCachePeerFinishedRequestMultiError, or nil if none found. func (m *DownloadCachePeerFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerFinishedRequest) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for ContentLength // no validation rules for PieceCount if len(errors) > 0 { return DownloadCachePeerFinishedRequestMultiError(errors) } return nil } // DownloadCachePeerFinishedRequestMultiError is an error wrapping multiple // validation errors returned by // DownloadCachePeerFinishedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadCachePeerFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerFinishedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadCachePeerFinishedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerFinishedRequestValidationError is the validation error // returned by DownloadCachePeerFinishedRequest.Validate if the designated // constraints aren't met. type DownloadCachePeerFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerFinishedRequestValidationError) ErrorName() string { return "DownloadCachePeerFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerFinishedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadCachePeerFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerFinishedRequestValidationError{} // Validate checks the field values on // DownloadCachePeerBackToSourceFinishedRequest 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 *DownloadCachePeerBackToSourceFinishedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadCachePeerBackToSourceFinishedRequest 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 // DownloadCachePeerBackToSourceFinishedRequestMultiError, or nil if none found. func (m *DownloadCachePeerBackToSourceFinishedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerBackToSourceFinishedRequest) 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 DownloadCachePeerBackToSourceFinishedRequestMultiError(errors) } return nil } // DownloadCachePeerBackToSourceFinishedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadCachePeerBackToSourceFinishedRequest.ValidateAll() if the // designated constraints aren't met. type DownloadCachePeerBackToSourceFinishedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerBackToSourceFinishedRequestMultiError) 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 DownloadCachePeerBackToSourceFinishedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerBackToSourceFinishedRequestValidationError is the // validation error returned by // DownloadCachePeerBackToSourceFinishedRequest.Validate if the designated // constraints aren't met. type DownloadCachePeerBackToSourceFinishedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) ErrorName() string { return "DownloadCachePeerBackToSourceFinishedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerBackToSourceFinishedRequestValidationError) 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 %sDownloadCachePeerBackToSourceFinishedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerBackToSourceFinishedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerBackToSourceFinishedRequestValidationError{} // Validate checks the field values on DownloadCachePeerFailedRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DownloadCachePeerFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCachePeerFailedRequest with // the rules defined in the proto definition for this message. If any rules // are violated, the result is a list of violation errors wrapped in // DownloadCachePeerFailedRequestMultiError, or nil if none found. func (m *DownloadCachePeerFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerFailedRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.Description != nil { if m.GetDescription() != "" { if utf8.RuneCountInString(m.GetDescription()) < 1 { err := DownloadCachePeerFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadCachePeerFailedRequestMultiError(errors) } return nil } // DownloadCachePeerFailedRequestMultiError is an error wrapping multiple // validation errors returned by DownloadCachePeerFailedRequest.ValidateAll() // if the designated constraints aren't met. type DownloadCachePeerFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerFailedRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DownloadCachePeerFailedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerFailedRequestValidationError is the validation error // returned by DownloadCachePeerFailedRequest.Validate if the designated // constraints aren't met. type DownloadCachePeerFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerFailedRequestValidationError) ErrorName() string { return "DownloadCachePeerFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerFailedRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDownloadCachePeerFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerFailedRequestValidationError{} // Validate checks the field values on // DownloadCachePeerBackToSourceFailedRequest 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 *DownloadCachePeerBackToSourceFailedRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadCachePeerBackToSourceFailedRequest 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 // DownloadCachePeerBackToSourceFailedRequestMultiError, or nil if none found. func (m *DownloadCachePeerBackToSourceFailedRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCachePeerBackToSourceFailedRequest) 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 := DownloadCachePeerBackToSourceFailedRequestValidationError{ field: "Description", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return DownloadCachePeerBackToSourceFailedRequestMultiError(errors) } return nil } // DownloadCachePeerBackToSourceFailedRequestMultiError is an error wrapping // multiple validation errors returned by // DownloadCachePeerBackToSourceFailedRequest.ValidateAll() if the designated // constraints aren't met. type DownloadCachePeerBackToSourceFailedRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCachePeerBackToSourceFailedRequestMultiError) 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 DownloadCachePeerBackToSourceFailedRequestMultiError) AllErrors() []error { return m } // DownloadCachePeerBackToSourceFailedRequestValidationError is the validation // error returned by DownloadCachePeerBackToSourceFailedRequest.Validate if // the designated constraints aren't met. type DownloadCachePeerBackToSourceFailedRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCachePeerBackToSourceFailedRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCachePeerBackToSourceFailedRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCachePeerBackToSourceFailedRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCachePeerBackToSourceFailedRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCachePeerBackToSourceFailedRequestValidationError) ErrorName() string { return "DownloadCachePeerBackToSourceFailedRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCachePeerBackToSourceFailedRequestValidationError) 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 %sDownloadCachePeerBackToSourceFailedRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCachePeerBackToSourceFailedRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCachePeerBackToSourceFailedRequestValidationError{} // Validate checks the field values on AnnounceCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *AnnounceCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnounceCachePeerRequest with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // AnnounceCachePeerRequestMultiError, or nil if none found. func (m *AnnounceCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *AnnounceCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := AnnounceCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := AnnounceCachePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := AnnounceCachePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } oneofRequestPresent := false switch v := m.Request.(type) { case *AnnounceCachePeerRequest_RegisterCachePeerRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetRegisterCachePeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "RegisterCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "RegisterCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRegisterCachePeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "RegisterCachePeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerStartedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerStartedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerStartedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerStartedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerBackToSourceStartedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerBackToSourceStartedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerBackToSourceStartedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceStartedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_RescheduleCachePeerRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetRescheduleCachePeerRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "RescheduleCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "RescheduleCachePeerRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRescheduleCachePeerRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "RescheduleCachePeerRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerFinishedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerBackToSourceFinishedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerBackToSourceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerBackToSourceFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerFailedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadCachePeerBackToSourceFailedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadCachePeerBackToSourceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCachePeerBackToSourceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadCachePeerBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadPieceFinishedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFinishedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadPieceBackToSourceFinishedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceBackToSourceFinishedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ 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 AnnounceCachePeerRequestValidationError{ field: "DownloadPieceBackToSourceFinishedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadPieceFailedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFailedRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerRequestValidationError{ field: "DownloadPieceFailedRequest", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerRequest_DownloadPieceBackToSourceFailedRequest: if v == nil { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofRequestPresent = true if all { switch v := interface{}(m.GetDownloadPieceBackToSourceFailedRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerRequestValidationError{ 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 AnnounceCachePeerRequestValidationError{ field: "DownloadPieceBackToSourceFailedRequest", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofRequestPresent { err := AnnounceCachePeerRequestValidationError{ field: "Request", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnounceCachePeerRequestMultiError(errors) } return nil } // AnnounceCachePeerRequestMultiError is an error wrapping multiple validation // errors returned by AnnounceCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type AnnounceCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnounceCachePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AnnounceCachePeerRequestMultiError) AllErrors() []error { return m } // AnnounceCachePeerRequestValidationError is the validation error returned by // AnnounceCachePeerRequest.Validate if the designated constraints aren't met. type AnnounceCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnounceCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnounceCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnounceCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnounceCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnounceCachePeerRequestValidationError) ErrorName() string { return "AnnounceCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e AnnounceCachePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAnnounceCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnounceCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnounceCachePeerRequestValidationError{} // Validate checks the field values on EmptyCacheTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *EmptyCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on EmptyCacheTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // EmptyCacheTaskResponseMultiError, or nil if none found. func (m *EmptyCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *EmptyCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return EmptyCacheTaskResponseMultiError(errors) } return nil } // EmptyCacheTaskResponseMultiError is an error wrapping multiple validation // errors returned by EmptyCacheTaskResponse.ValidateAll() if the designated // constraints aren't met. type EmptyCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m EmptyCacheTaskResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m EmptyCacheTaskResponseMultiError) AllErrors() []error { return m } // EmptyCacheTaskResponseValidationError is the validation error returned by // EmptyCacheTaskResponse.Validate if the designated constraints aren't met. type EmptyCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e EmptyCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e EmptyCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e EmptyCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e EmptyCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e EmptyCacheTaskResponseValidationError) ErrorName() string { return "EmptyCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e EmptyCacheTaskResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sEmptyCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = EmptyCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = EmptyCacheTaskResponseValidationError{} // Validate checks the field values on NormalCacheTaskResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *NormalCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on NormalCacheTaskResponse with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // NormalCacheTaskResponseMultiError, or nil if none found. func (m *NormalCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *NormalCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(m.GetCandidateParents()) < 1 { err := NormalCacheTaskResponseValidationError{ field: "CandidateParents", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } for idx, item := range m.GetCandidateParents() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, NormalCacheTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, NormalCacheTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NormalCacheTaskResponseValidationError{ field: fmt.Sprintf("CandidateParents[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return NormalCacheTaskResponseMultiError(errors) } return nil } // NormalCacheTaskResponseMultiError is an error wrapping multiple validation // errors returned by NormalCacheTaskResponse.ValidateAll() if the designated // constraints aren't met. type NormalCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m NormalCacheTaskResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m NormalCacheTaskResponseMultiError) AllErrors() []error { return m } // NormalCacheTaskResponseValidationError is the validation error returned by // NormalCacheTaskResponse.Validate if the designated constraints aren't met. type NormalCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NormalCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NormalCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NormalCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NormalCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NormalCacheTaskResponseValidationError) ErrorName() string { return "NormalCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e NormalCacheTaskResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sNormalCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NormalCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NormalCacheTaskResponseValidationError{} // Validate checks the field values on AnnounceCachePeerResponse with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *AnnounceCachePeerResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AnnounceCachePeerResponse with the // rules defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // AnnounceCachePeerResponseMultiError, or nil if none found. func (m *AnnounceCachePeerResponse) ValidateAll() error { return m.validate(true) } func (m *AnnounceCachePeerResponse) validate(all bool) error { if m == nil { return nil } var errors []error oneofResponsePresent := false switch v := m.Response.(type) { case *AnnounceCachePeerResponse_EmptyCacheTaskResponse: if v == nil { err := AnnounceCachePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetEmptyCacheTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ field: "EmptyCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ field: "EmptyCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEmptyCacheTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerResponseValidationError{ field: "EmptyCacheTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerResponse_NormalCacheTaskResponse: if v == nil { err := AnnounceCachePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetNormalCacheTaskResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ field: "NormalCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ field: "NormalCacheTaskResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetNormalCacheTaskResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AnnounceCachePeerResponseValidationError{ field: "NormalCacheTaskResponse", reason: "embedded message failed validation", cause: err, } } } case *AnnounceCachePeerResponse_NeedBackToSourceResponse: if v == nil { err := AnnounceCachePeerResponseValidationError{ field: "Response", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofResponsePresent = true if all { switch v := interface{}(m.GetNeedBackToSourceResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ field: "NeedBackToSourceResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AnnounceCachePeerResponseValidationError{ 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 AnnounceCachePeerResponseValidationError{ field: "NeedBackToSourceResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := AnnounceCachePeerResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return AnnounceCachePeerResponseMultiError(errors) } return nil } // AnnounceCachePeerResponseMultiError is an error wrapping multiple validation // errors returned by AnnounceCachePeerResponse.ValidateAll() if the // designated constraints aren't met. type AnnounceCachePeerResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AnnounceCachePeerResponseMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AnnounceCachePeerResponseMultiError) AllErrors() []error { return m } // AnnounceCachePeerResponseValidationError is the validation error returned by // AnnounceCachePeerResponse.Validate if the designated constraints aren't met. type AnnounceCachePeerResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AnnounceCachePeerResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AnnounceCachePeerResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AnnounceCachePeerResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AnnounceCachePeerResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AnnounceCachePeerResponseValidationError) ErrorName() string { return "AnnounceCachePeerResponseValidationError" } // Error satisfies the builtin error interface func (e AnnounceCachePeerResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAnnounceCachePeerResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AnnounceCachePeerResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AnnounceCachePeerResponseValidationError{} // Validate checks the field values on StatCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *StatCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatCachePeerRequestMultiError, or nil if none found. func (m *StatCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *StatCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatCachePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := StatCachePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatCachePeerRequestMultiError(errors) } return nil } // StatCachePeerRequestMultiError is an error wrapping multiple validation // errors returned by StatCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type StatCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatCachePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatCachePeerRequestMultiError) AllErrors() []error { return m } // StatCachePeerRequestValidationError is the validation error returned by // StatCachePeerRequest.Validate if the designated constraints aren't met. type StatCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatCachePeerRequestValidationError) ErrorName() string { return "StatCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e StatCachePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatCachePeerRequestValidationError{} // Validate checks the field values on DeleteCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteCachePeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteCachePeerRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteCachePeerRequestMultiError, or nil if none found. func (m *DeleteCachePeerRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteCachePeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeleteCachePeerRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeleteCachePeerRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := DeleteCachePeerRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeleteCachePeerRequestMultiError(errors) } return nil } // DeleteCachePeerRequestMultiError is an error wrapping multiple validation // errors returned by DeleteCachePeerRequest.ValidateAll() if the designated // constraints aren't met. type DeleteCachePeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteCachePeerRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DeleteCachePeerRequestMultiError) AllErrors() []error { return m } // DeleteCachePeerRequestValidationError is the validation error returned by // DeleteCachePeerRequest.Validate if the designated constraints aren't met. type DeleteCachePeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteCachePeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteCachePeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteCachePeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteCachePeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteCachePeerRequestValidationError) ErrorName() string { return "DeleteCachePeerRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteCachePeerRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDeleteCachePeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteCachePeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteCachePeerRequestValidationError{} // Validate checks the field values on StatCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *StatCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatCacheTaskRequestMultiError, or nil if none found. func (m *StatCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *StatCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := StatCacheTaskRequestValidationError{ 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 := StatCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatCacheTaskRequestMultiError(errors) } return nil } // StatCacheTaskRequestMultiError is an error wrapping multiple validation // errors returned by StatCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type StatCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatCacheTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatCacheTaskRequestMultiError) AllErrors() []error { return m } // StatCacheTaskRequestValidationError is the validation error returned by // StatCacheTaskRequest.Validate if the designated constraints aren't met. type StatCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatCacheTaskRequestValidationError) ErrorName() string { return "StatCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e StatCacheTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatCacheTaskRequestValidationError{} // Validate checks the field values on DeleteCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteCacheTaskRequestMultiError, or nil if none found. func (m *DeleteCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DeleteCacheTaskRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DeleteCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DeleteCacheTaskRequestMultiError(errors) } return nil } // DeleteCacheTaskRequestMultiError is an error wrapping multiple validation // errors returned by DeleteCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type DeleteCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteCacheTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m DeleteCacheTaskRequestMultiError) AllErrors() []error { return m } // DeleteCacheTaskRequestValidationError is the validation error returned by // DeleteCacheTaskRequest.Validate if the designated constraints aren't met. type DeleteCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteCacheTaskRequestValidationError) ErrorName() string { return "DeleteCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteCacheTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDeleteCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteCacheTaskRequestValidationError{} // 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 // no validation rules for Persistent if m.GetPieceLength() < 4194304 { err := RegisterPersistentCachePeerRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 4194304", } 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.OutputPath != nil { if m.GetOutputPath() != "" { 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.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 m.GetPieceLength() < 4194304 { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 4194304", } 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(300*time.Second + 0*time.Nanosecond) if dur < gte || dur > lte { err := UploadPersistentCacheTaskStartedRequestValidationError{ field: "Ttl", reason: "value must be inside range [5m0s, 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{} // 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{} // Validate checks the field values on PreheatImageRequest 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 *PreheatImageRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on PreheatImageRequest 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 // PreheatImageRequestMultiError, or nil if none found. func (m *PreheatImageRequest) ValidateAll() error { return m.validate(true) } func (m *PreheatImageRequest) validate(all bool) error { if m == nil { return nil } var errors []error if uri, err := url.Parse(m.GetUrl()); err != nil { err = PreheatImageRequestValidationError{ field: "Url", reason: "value must be a valid URI", cause: err, } if !all { return err } errors = append(errors, err) } else if !uri.IsAbs() { err := PreheatImageRequestValidationError{ field: "Url", reason: "value must be absolute", } if !all { return err } errors = append(errors, err) } // no validation rules for Header if !_PreheatImageRequest_Scope_Pattern.MatchString(m.GetScope()) { err := PreheatImageRequestValidationError{ field: "Scope", reason: "value does not match regex pattern \"^(single_seed_peer|all_seed_peers|all_peers)$\"", } if !all { return err } errors = append(errors, err) } if _, ok := common.Priority_name[int32(m.GetPriority())]; !ok { err := PreheatImageRequestValidationError{ field: "Priority", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } // no validation rules for InsecureSkipVerify if m.PieceLength != nil { if m.GetPieceLength() != 0 { if val := m.GetPieceLength(); val < 4194304 || val > 67108864 { err := PreheatImageRequestValidationError{ field: "PieceLength", reason: "value must be inside range [4194304, 67108864]", } 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.Username != nil { // no validation rules for Username } if m.Password != nil { // no validation rules for Password } if m.Platform != nil { // no validation rules for Platform } if m.Percentage != nil { if m.GetPercentage() != 0 { if val := m.GetPercentage(); val < 1 || val > 100 { err := PreheatImageRequestValidationError{ field: "Percentage", reason: "value must be inside range [1, 100]", } if !all { return err } errors = append(errors, err) } } } if m.Count != nil { if m.GetCount() != 0 { if val := m.GetCount(); val < 1 || val > 200 { err := PreheatImageRequestValidationError{ field: "Count", reason: "value must be inside range [1, 200]", } if !all { return err } errors = append(errors, err) } } } if m.ConcurrentTaskCount != nil { if m.GetConcurrentTaskCount() != 0 { if val := m.GetConcurrentTaskCount(); val < 1 || val > 100 { err := PreheatImageRequestValidationError{ field: "ConcurrentTaskCount", reason: "value must be inside range [1, 100]", } if !all { return err } errors = append(errors, err) } } } if m.ConcurrentPeerCount != nil { if m.GetConcurrentPeerCount() != 0 { if val := m.GetConcurrentPeerCount(); val < 1 || val > 1000 { err := PreheatImageRequestValidationError{ field: "ConcurrentPeerCount", reason: "value must be inside range [1, 1000]", } if !all { return err } errors = append(errors, err) } } } 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, PreheatImageRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, PreheatImageRequestValidationError{ 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 PreheatImageRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return PreheatImageRequestMultiError(errors) } return nil } // PreheatImageRequestMultiError is an error wrapping multiple validation // errors returned by PreheatImageRequest.ValidateAll() if the designated // constraints aren't met. type PreheatImageRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m PreheatImageRequestMultiError) 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 PreheatImageRequestMultiError) AllErrors() []error { return m } // PreheatImageRequestValidationError is the validation error returned by // PreheatImageRequest.Validate if the designated constraints aren't met. type PreheatImageRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e PreheatImageRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e PreheatImageRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e PreheatImageRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e PreheatImageRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e PreheatImageRequestValidationError) ErrorName() string { return "PreheatImageRequestValidationError" } // Error satisfies the builtin error interface func (e PreheatImageRequestValidationError) 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 %sPreheatImageRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = PreheatImageRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = PreheatImageRequestValidationError{} var _PreheatImageRequest_Scope_Pattern = regexp.MustCompile("^(single_seed_peer|all_seed_peers|all_peers)$") // Validate checks the field values on StatImageRequest 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 *StatImageRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatImageRequest 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 // StatImageRequestMultiError, or nil if none found. func (m *StatImageRequest) ValidateAll() error { return m.validate(true) } func (m *StatImageRequest) validate(all bool) error { if m == nil { return nil } var errors []error if uri, err := url.Parse(m.GetUrl()); err != nil { err = StatImageRequestValidationError{ field: "Url", reason: "value must be a valid URI", cause: err, } if !all { return err } errors = append(errors, err) } else if !uri.IsAbs() { err := StatImageRequestValidationError{ field: "Url", reason: "value must be absolute", } if !all { return err } errors = append(errors, err) } // no validation rules for Header if m.PieceLength != nil { if m.GetPieceLength() != 0 { if val := m.GetPieceLength(); val < 4194304 || val > 67108864 { err := StatImageRequestValidationError{ field: "PieceLength", reason: "value must be inside range [4194304, 67108864]", } 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.Username != nil { // no validation rules for Username } if m.Password != nil { // no validation rules for Password } if m.Platform != nil { // no validation rules for Platform } if m.ConcurrentLayerCount != nil { if m.GetConcurrentLayerCount() != 0 { if val := m.GetConcurrentLayerCount(); val < 1 || val > 100 { err := StatImageRequestValidationError{ field: "ConcurrentLayerCount", reason: "value must be inside range [1, 100]", } if !all { return err } errors = append(errors, err) } } } if m.ConcurrentPeerCount != nil { if m.GetConcurrentPeerCount() != 0 { if val := m.GetConcurrentPeerCount(); val < 1 || val > 1000 { err := StatImageRequestValidationError{ field: "ConcurrentPeerCount", reason: "value must be inside range [1, 1000]", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return StatImageRequestMultiError(errors) } return nil } // StatImageRequestMultiError is an error wrapping multiple validation errors // returned by StatImageRequest.ValidateAll() if the designated constraints // aren't met. type StatImageRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatImageRequestMultiError) 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 StatImageRequestMultiError) AllErrors() []error { return m } // StatImageRequestValidationError is the validation error returned by // StatImageRequest.Validate if the designated constraints aren't met. type StatImageRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatImageRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatImageRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatImageRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatImageRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatImageRequestValidationError) ErrorName() string { return "StatImageRequestValidationError" } // Error satisfies the builtin error interface func (e StatImageRequestValidationError) 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 %sStatImageRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatImageRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatImageRequestValidationError{} // Validate checks the field values on StatImageResponse 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 *StatImageResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatImageResponse 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 // StatImageResponseMultiError, or nil if none found. func (m *StatImageResponse) ValidateAll() error { return m.validate(true) } func (m *StatImageResponse) validate(all bool) error { if m == nil { return nil } var errors []error if all { switch v := interface{}(m.GetImage()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatImageResponseValidationError{ field: "Image", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatImageResponseValidationError{ field: "Image", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetImage()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatImageResponseValidationError{ field: "Image", reason: "embedded message failed validation", cause: err, } } } for idx, item := range m.GetPeers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatImageResponseValidationError{ field: fmt.Sprintf("Peers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatImageResponseValidationError{ field: fmt.Sprintf("Peers[%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 StatImageResponseValidationError{ field: fmt.Sprintf("Peers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return StatImageResponseMultiError(errors) } return nil } // StatImageResponseMultiError is an error wrapping multiple validation errors // returned by StatImageResponse.ValidateAll() if the designated constraints // aren't met. type StatImageResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatImageResponseMultiError) 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 StatImageResponseMultiError) AllErrors() []error { return m } // StatImageResponseValidationError is the validation error returned by // StatImageResponse.Validate if the designated constraints aren't met. type StatImageResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatImageResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatImageResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatImageResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatImageResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatImageResponseValidationError) ErrorName() string { return "StatImageResponseValidationError" } // Error satisfies the builtin error interface func (e StatImageResponseValidationError) 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 %sStatImageResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatImageResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatImageResponseValidationError{} // Validate checks the field values on PeerImage 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 *PeerImage) Validate() error { return m.validate(false) } // ValidateAll checks the field values on PeerImage 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 PeerImageMultiError, or nil // if none found. func (m *PeerImage) ValidateAll() error { return m.validate(true) } func (m *PeerImage) validate(all bool) error { if m == nil { return nil } var errors []error if ip := net.ParseIP(m.GetIp()); ip == nil { err := PeerImageValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetHostname()) < 1 { err := PeerImageValidationError{ field: "Hostname", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } for idx, item := range m.GetCachedLayers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, PeerImageValidationError{ field: fmt.Sprintf("CachedLayers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, PeerImageValidationError{ field: fmt.Sprintf("CachedLayers[%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 PeerImageValidationError{ field: fmt.Sprintf("CachedLayers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return PeerImageMultiError(errors) } return nil } // PeerImageMultiError is an error wrapping multiple validation errors returned // by PeerImage.ValidateAll() if the designated constraints aren't met. type PeerImageMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m PeerImageMultiError) 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 PeerImageMultiError) AllErrors() []error { return m } // PeerImageValidationError is the validation error returned by // PeerImage.Validate if the designated constraints aren't met. type PeerImageValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e PeerImageValidationError) Field() string { return e.field } // Reason function returns reason value. func (e PeerImageValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e PeerImageValidationError) Cause() error { return e.cause } // Key function returns key value. func (e PeerImageValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e PeerImageValidationError) ErrorName() string { return "PeerImageValidationError" } // Error satisfies the builtin error interface func (e PeerImageValidationError) 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 %sPeerImage.%s: %s%s", key, e.field, e.reason, cause) } var _ error = PeerImageValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = PeerImageValidationError{} // Validate checks the field values on Image 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 *Image) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Image 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 ImageMultiError, or nil if none found. func (m *Image) ValidateAll() error { return m.validate(true) } func (m *Image) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetLayers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ImageValidationError{ field: fmt.Sprintf("Layers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ImageValidationError{ field: fmt.Sprintf("Layers[%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 ImageValidationError{ field: fmt.Sprintf("Layers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ImageMultiError(errors) } return nil } // ImageMultiError is an error wrapping multiple validation errors returned by // Image.ValidateAll() if the designated constraints aren't met. type ImageMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ImageMultiError) 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 ImageMultiError) AllErrors() []error { return m } // ImageValidationError is the validation error returned by Image.Validate if // the designated constraints aren't met. type ImageValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ImageValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ImageValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ImageValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ImageValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ImageValidationError) ErrorName() string { return "ImageValidationError" } // Error satisfies the builtin error interface func (e ImageValidationError) 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 %sImage.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ImageValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ImageValidationError{} // Validate checks the field values on Layer 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 *Layer) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Layer 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 LayerMultiError, or nil if none found. func (m *Layer) ValidateAll() error { return m.validate(true) } func (m *Layer) validate(all bool) error { if m == nil { return nil } var errors []error if uri, err := url.Parse(m.GetUrl()); err != nil { err = LayerValidationError{ field: "Url", reason: "value must be a valid URI", cause: err, } if !all { return err } errors = append(errors, err) } else if !uri.IsAbs() { err := LayerValidationError{ field: "Url", reason: "value must be absolute", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return LayerMultiError(errors) } return nil } // LayerMultiError is an error wrapping multiple validation errors returned by // Layer.ValidateAll() if the designated constraints aren't met. type LayerMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m LayerMultiError) 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 LayerMultiError) AllErrors() []error { return m } // LayerValidationError is the validation error returned by Layer.Validate if // the designated constraints aren't met. type LayerValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e LayerValidationError) Field() string { return e.field } // Reason function returns reason value. func (e LayerValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e LayerValidationError) Cause() error { return e.cause } // Key function returns key value. func (e LayerValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e LayerValidationError) ErrorName() string { return "LayerValidationError" } // Error satisfies the builtin error interface func (e LayerValidationError) 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 %sLayer.%s: %s%s", key, e.field, e.reason, cause) } var _ error = LayerValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = LayerValidationError{}