// Code generated by protoc-gen-validate. DO NOT EDIT. // source: pkg/apis/dfdaemon/v2/dfdaemon.proto package dfdaemon import ( "bytes" "errors" "fmt" "net" "net/mail" "net/url" "regexp" "sort" "strings" "time" "unicode/utf8" "google.golang.org/protobuf/types/known/anypb" ) // ensure the imports are used var ( _ = bytes.MinRead _ = errors.New("") _ = fmt.Print _ = utf8.UTFMax _ = (*regexp.Regexp)(nil) _ = (*strings.Reader)(nil) _ = net.IPv4len _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} _ = sort.Sort ) // Validate checks the field values on DownloadTaskRequest 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 *DownloadTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadTaskRequest 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 // DownloadTaskRequestMultiError, or nil if none found. func (m *DownloadTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetDownload() == nil { err := DownloadTaskRequestValidationError{ 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, DownloadTaskRequestValidationError{ field: "Download", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadTaskRequestValidationError{ 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 DownloadTaskRequestValidationError{ field: "Download", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return DownloadTaskRequestMultiError(errors) } return nil } // DownloadTaskRequestMultiError is an error wrapping multiple validation // errors returned by DownloadTaskRequest.ValidateAll() if the designated // constraints aren't met. type DownloadTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadTaskRequestMultiError) 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 DownloadTaskRequestMultiError) AllErrors() []error { return m } // DownloadTaskRequestValidationError is the validation error returned by // DownloadTaskRequest.Validate if the designated constraints aren't met. type DownloadTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadTaskRequestValidationError) ErrorName() string { return "DownloadTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadTaskRequestValidationError) 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 %sDownloadTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadTaskRequestValidationError{} // Validate checks the field values on DownloadTaskStartedResponse 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 *DownloadTaskStartedResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadTaskStartedResponse 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 // DownloadTaskStartedResponseMultiError, or nil if none found. func (m *DownloadTaskStartedResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadTaskStartedResponse) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for ContentLength // no validation rules for ResponseHeader for idx, item := range m.GetPieces() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadTaskStartedResponseValidationError{ field: fmt.Sprintf("Pieces[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadTaskStartedResponseValidationError{ field: fmt.Sprintf("Pieces[%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 DownloadTaskStartedResponseValidationError{ field: fmt.Sprintf("Pieces[%v]", idx), reason: "embedded message failed validation", cause: 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, DownloadTaskStartedResponseValidationError{ field: "Range", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadTaskStartedResponseValidationError{ 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 DownloadTaskStartedResponseValidationError{ field: "Range", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return DownloadTaskStartedResponseMultiError(errors) } return nil } // DownloadTaskStartedResponseMultiError is an error wrapping multiple // validation errors returned by DownloadTaskStartedResponse.ValidateAll() if // the designated constraints aren't met. type DownloadTaskStartedResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadTaskStartedResponseMultiError) 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 DownloadTaskStartedResponseMultiError) AllErrors() []error { return m } // DownloadTaskStartedResponseValidationError is the validation error returned // by DownloadTaskStartedResponse.Validate if the designated constraints // aren't met. type DownloadTaskStartedResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadTaskStartedResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadTaskStartedResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadTaskStartedResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadTaskStartedResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadTaskStartedResponseValidationError) ErrorName() string { return "DownloadTaskStartedResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadTaskStartedResponseValidationError) 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 %sDownloadTaskStartedResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadTaskStartedResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadTaskStartedResponseValidationError{} // Validate checks the field values on DownloadPieceFinishedResponse 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 *DownloadPieceFinishedResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPieceFinishedResponse 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 // DownloadPieceFinishedResponseMultiError, or nil if none found. func (m *DownloadPieceFinishedResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceFinishedResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := DownloadPieceFinishedResponseValidationError{ 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, DownloadPieceFinishedResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceFinishedResponseValidationError{ 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 DownloadPieceFinishedResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return DownloadPieceFinishedResponseMultiError(errors) } return nil } // DownloadPieceFinishedResponseMultiError is an error wrapping multiple // validation errors returned by DownloadPieceFinishedResponse.ValidateAll() // if the designated constraints aren't met. type DownloadPieceFinishedResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceFinishedResponseMultiError) 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 DownloadPieceFinishedResponseMultiError) AllErrors() []error { return m } // DownloadPieceFinishedResponseValidationError is the validation error // returned by DownloadPieceFinishedResponse.Validate if the designated // constraints aren't met. type DownloadPieceFinishedResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceFinishedResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceFinishedResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceFinishedResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceFinishedResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceFinishedResponseValidationError) ErrorName() string { return "DownloadPieceFinishedResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceFinishedResponseValidationError) 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 %sDownloadPieceFinishedResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceFinishedResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceFinishedResponseValidationError{} // Validate checks the field values on DownloadTaskResponse 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 *DownloadTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadTaskResponse 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 // DownloadTaskResponseMultiError, or nil if none found. func (m *DownloadTaskResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadTaskResponseValidationError{ 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 := DownloadTaskResponseValidationError{ 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 := DownloadTaskResponseValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } oneofResponsePresent := false switch v := m.Response.(type) { case *DownloadTaskResponse_DownloadTaskStartedResponse: if v == nil { err := DownloadTaskResponseValidationError{ 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.GetDownloadTaskStartedResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadTaskResponseValidationError{ field: "DownloadTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadTaskResponseValidationError{ field: "DownloadTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadTaskStartedResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadTaskResponseValidationError{ field: "DownloadTaskStartedResponse", reason: "embedded message failed validation", cause: err, } } } case *DownloadTaskResponse_DownloadPieceFinishedResponse: if v == nil { err := DownloadTaskResponseValidationError{ 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.GetDownloadPieceFinishedResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFinishedResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := DownloadTaskResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DownloadTaskResponseMultiError(errors) } return nil } // DownloadTaskResponseMultiError is an error wrapping multiple validation // errors returned by DownloadTaskResponse.ValidateAll() if the designated // constraints aren't met. type DownloadTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadTaskResponseMultiError) 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 DownloadTaskResponseMultiError) AllErrors() []error { return m } // DownloadTaskResponseValidationError is the validation error returned by // DownloadTaskResponse.Validate if the designated constraints aren't met. type DownloadTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadTaskResponseValidationError) ErrorName() string { return "DownloadTaskResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadTaskResponseValidationError) 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 %sDownloadTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadTaskResponseValidationError{} // Validate checks the field values on SyncPiecesRequest 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 *SyncPiecesRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncPiecesRequest 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 // SyncPiecesRequestMultiError, or nil if none found. func (m *SyncPiecesRequest) ValidateAll() error { return m.validate(true) } func (m *SyncPiecesRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := SyncPiecesRequestValidationError{ 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 := SyncPiecesRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(m.GetInterestedPieceNumbers()) < 1 { err := SyncPiecesRequestValidationError{ field: "InterestedPieceNumbers", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return SyncPiecesRequestMultiError(errors) } return nil } // SyncPiecesRequestMultiError is an error wrapping multiple validation errors // returned by SyncPiecesRequest.ValidateAll() if the designated constraints // aren't met. type SyncPiecesRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncPiecesRequestMultiError) 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 SyncPiecesRequestMultiError) AllErrors() []error { return m } // SyncPiecesRequestValidationError is the validation error returned by // SyncPiecesRequest.Validate if the designated constraints aren't met. type SyncPiecesRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncPiecesRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncPiecesRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncPiecesRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncPiecesRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncPiecesRequestValidationError) ErrorName() string { return "SyncPiecesRequestValidationError" } // Error satisfies the builtin error interface func (e SyncPiecesRequestValidationError) 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 %sSyncPiecesRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncPiecesRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncPiecesRequestValidationError{} // Validate checks the field values on SyncPiecesResponse 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 *SyncPiecesResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncPiecesResponse 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 // SyncPiecesResponseMultiError, or nil if none found. func (m *SyncPiecesResponse) ValidateAll() error { return m.validate(true) } func (m *SyncPiecesResponse) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Number // no validation rules for Offset // no validation rules for Length if len(errors) > 0 { return SyncPiecesResponseMultiError(errors) } return nil } // SyncPiecesResponseMultiError is an error wrapping multiple validation errors // returned by SyncPiecesResponse.ValidateAll() if the designated constraints // aren't met. type SyncPiecesResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncPiecesResponseMultiError) 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 SyncPiecesResponseMultiError) AllErrors() []error { return m } // SyncPiecesResponseValidationError is the validation error returned by // SyncPiecesResponse.Validate if the designated constraints aren't met. type SyncPiecesResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncPiecesResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncPiecesResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncPiecesResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncPiecesResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncPiecesResponseValidationError) ErrorName() string { return "SyncPiecesResponseValidationError" } // Error satisfies the builtin error interface func (e SyncPiecesResponseValidationError) 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 %sSyncPiecesResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncPiecesResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncPiecesResponseValidationError{} // Validate checks the field values on DownloadPieceRequest 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 *DownloadPieceRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPieceRequest 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 // DownloadPieceRequestMultiError, or nil if none found. func (m *DownloadPieceRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadPieceRequestValidationError{ 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 := DownloadPieceRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } // no validation rules for PieceNumber if len(errors) > 0 { return DownloadPieceRequestMultiError(errors) } return nil } // DownloadPieceRequestMultiError is an error wrapping multiple validation // errors returned by DownloadPieceRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPieceRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceRequestMultiError) 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 DownloadPieceRequestMultiError) AllErrors() []error { return m } // DownloadPieceRequestValidationError is the validation error returned by // DownloadPieceRequest.Validate if the designated constraints aren't met. type DownloadPieceRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceRequestValidationError) ErrorName() string { return "DownloadPieceRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceRequestValidationError) 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 %sDownloadPieceRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceRequestValidationError{} // Validate checks the field values on DownloadPieceResponse 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 *DownloadPieceResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPieceResponse 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 // DownloadPieceResponseMultiError, or nil if none found. func (m *DownloadPieceResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadPieceResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := DownloadPieceResponseValidationError{ 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, DownloadPieceResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPieceResponseValidationError{ 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 DownloadPieceResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return DownloadPieceResponseMultiError(errors) } return nil } // DownloadPieceResponseMultiError is an error wrapping multiple validation // errors returned by DownloadPieceResponse.ValidateAll() if the designated // constraints aren't met. type DownloadPieceResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPieceResponseMultiError) 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 DownloadPieceResponseMultiError) AllErrors() []error { return m } // DownloadPieceResponseValidationError is the validation error returned by // DownloadPieceResponse.Validate if the designated constraints aren't met. type DownloadPieceResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPieceResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPieceResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPieceResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPieceResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPieceResponseValidationError) ErrorName() string { return "DownloadPieceResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadPieceResponseValidationError) 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 %sDownloadPieceResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPieceResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPieceResponseValidationError{} // Validate checks the field values on UploadTaskRequest 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 *UploadTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UploadTaskRequest 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 // UploadTaskRequestMultiError, or nil if none found. func (m *UploadTaskRequest) ValidateAll() error { return m.validate(true) } func (m *UploadTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetTask() == nil { err := UploadTaskRequestValidationError{ field: "Task", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetTask()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, UploadTaskRequestValidationError{ field: "Task", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, UploadTaskRequestValidationError{ field: "Task", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTask()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UploadTaskRequestValidationError{ field: "Task", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return UploadTaskRequestMultiError(errors) } return nil } // UploadTaskRequestMultiError is an error wrapping multiple validation errors // returned by UploadTaskRequest.ValidateAll() if the designated constraints // aren't met. type UploadTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadTaskRequestMultiError) 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 UploadTaskRequestMultiError) AllErrors() []error { return m } // UploadTaskRequestValidationError is the validation error returned by // UploadTaskRequest.Validate if the designated constraints aren't met. type UploadTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadTaskRequestValidationError) ErrorName() string { return "UploadTaskRequestValidationError" } // Error satisfies the builtin error interface func (e UploadTaskRequestValidationError) 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 %sUploadTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadTaskRequestValidationError{} // Validate checks the field values on StatTaskRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *StatTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatTaskRequestMultiError, or nil if none found. func (m *StatTaskRequest) ValidateAll() error { return m.validate(true) } func (m *StatTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatTaskRequestMultiError(errors) } return nil } // StatTaskRequestMultiError is an error wrapping multiple validation errors // returned by StatTaskRequest.ValidateAll() if the designated constraints // aren't met. type StatTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatTaskRequestMultiError) AllErrors() []error { return m } // StatTaskRequestValidationError is the validation error returned by // StatTaskRequest.Validate if the designated constraints aren't met. type StatTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatTaskRequestValidationError) ErrorName() string { return "StatTaskRequestValidationError" } // Error satisfies the builtin error interface func (e StatTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatTaskRequestValidationError{} // Validate checks the field values on DeleteTaskRequest with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. func (m *DeleteTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteTaskRequestMultiError, or nil if none found. func (m *DeleteTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.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 DownloadCacheTaskRequest 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 *DownloadCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCacheTaskRequest 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 // DownloadCacheTaskRequestMultiError, or nil if none found. func (m *DownloadCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadCacheTaskRequestValidationError{ 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 := DownloadCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.GetPieceLength() < 1 { err := DownloadCacheTaskRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetOutputPath()) < 1 { err := DownloadCacheTaskRequestValidationError{ field: "OutputPath", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.Tag != nil { // no validation rules for Tag } if m.Application != nil { // no validation rules for Application } if m.Timeout != nil { if all { switch v := interface{}(m.GetTimeout()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadCacheTaskRequestValidationError{ 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 DownloadCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return DownloadCacheTaskRequestMultiError(errors) } return nil } // DownloadCacheTaskRequestMultiError is an error wrapping multiple validation // errors returned by DownloadCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type DownloadCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCacheTaskRequestMultiError) 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 DownloadCacheTaskRequestMultiError) AllErrors() []error { return m } // DownloadCacheTaskRequestValidationError is the validation error returned by // DownloadCacheTaskRequest.Validate if the designated constraints aren't met. type DownloadCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCacheTaskRequestValidationError) ErrorName() string { return "DownloadCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadCacheTaskRequestValidationError) 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 %sDownloadCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCacheTaskRequestValidationError{} // Validate checks the field values on DownloadCacheTaskStartedResponse 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 *DownloadCacheTaskStartedResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCacheTaskStartedResponse 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 // DownloadCacheTaskStartedResponseMultiError, or nil if none found. func (m *DownloadCacheTaskStartedResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadCacheTaskStartedResponse) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return DownloadCacheTaskStartedResponseMultiError(errors) } return nil } // DownloadCacheTaskStartedResponseMultiError is an error wrapping multiple // validation errors returned by // DownloadCacheTaskStartedResponse.ValidateAll() if the designated // constraints aren't met. type DownloadCacheTaskStartedResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCacheTaskStartedResponseMultiError) 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 DownloadCacheTaskStartedResponseMultiError) AllErrors() []error { return m } // DownloadCacheTaskStartedResponseValidationError is the validation error // returned by DownloadCacheTaskStartedResponse.Validate if the designated // constraints aren't met. type DownloadCacheTaskStartedResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCacheTaskStartedResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCacheTaskStartedResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCacheTaskStartedResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCacheTaskStartedResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCacheTaskStartedResponseValidationError) ErrorName() string { return "DownloadCacheTaskStartedResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadCacheTaskStartedResponseValidationError) 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 %sDownloadCacheTaskStartedResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCacheTaskStartedResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCacheTaskStartedResponseValidationError{} // Validate checks the field values on DownloadCacheTaskResponse 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 *DownloadCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadCacheTaskResponse 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 // DownloadCacheTaskResponseMultiError, or nil if none found. func (m *DownloadCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadCacheTaskResponseValidationError{ 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 := DownloadCacheTaskResponseValidationError{ 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 := DownloadCacheTaskResponseValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } oneofResponsePresent := false switch v := m.Response.(type) { case *DownloadCacheTaskResponse_DownloadCacheTaskStartedResponse: if v == nil { err := DownloadCacheTaskResponseValidationError{ 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.GetDownloadCacheTaskStartedResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadCacheTaskResponseValidationError{ field: "DownloadCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadCacheTaskResponseValidationError{ field: "DownloadCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadCacheTaskStartedResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadCacheTaskResponseValidationError{ field: "DownloadCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, } } } case *DownloadCacheTaskResponse_DownloadPieceFinishedResponse: if v == nil { err := DownloadCacheTaskResponseValidationError{ 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.GetDownloadPieceFinishedResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadCacheTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadCacheTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPieceFinishedResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadCacheTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := DownloadCacheTaskResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DownloadCacheTaskResponseMultiError(errors) } return nil } // DownloadCacheTaskResponseMultiError is an error wrapping multiple validation // errors returned by DownloadCacheTaskResponse.ValidateAll() if the // designated constraints aren't met. type DownloadCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadCacheTaskResponseMultiError) 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 DownloadCacheTaskResponseMultiError) AllErrors() []error { return m } // DownloadCacheTaskResponseValidationError is the validation error returned by // DownloadCacheTaskResponse.Validate if the designated constraints aren't met. type DownloadCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadCacheTaskResponseValidationError) ErrorName() string { return "DownloadCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadCacheTaskResponseValidationError) 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 %sDownloadCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadCacheTaskResponseValidationError{} // Validate checks the field values on UploadCacheTaskRequest 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 *UploadCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UploadCacheTaskRequest 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 // UploadCacheTaskRequestMultiError, or nil if none found. func (m *UploadCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *UploadCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetPath()) < 1 { err := UploadCacheTaskRequestValidationError{ field: "Path", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if m.GetPersistentReplicaCount() < 1 { err := UploadCacheTaskRequestValidationError{ field: "PersistentReplicaCount", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.GetPieceLength() < 1 { err := UploadCacheTaskRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.Tag != nil { // no validation rules for Tag } if m.Application != nil { // no validation rules for Application } if m.Timeout != nil { if all { switch v := interface{}(m.GetTimeout()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, UploadCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, UploadCacheTaskRequestValidationError{ 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 UploadCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return UploadCacheTaskRequestMultiError(errors) } return nil } // UploadCacheTaskRequestMultiError is an error wrapping multiple validation // errors returned by UploadCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type UploadCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadCacheTaskRequestMultiError) 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 UploadCacheTaskRequestMultiError) AllErrors() []error { return m } // UploadCacheTaskRequestValidationError is the validation error returned by // UploadCacheTaskRequest.Validate if the designated constraints aren't met. type UploadCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadCacheTaskRequestValidationError) ErrorName() string { return "UploadCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e UploadCacheTaskRequestValidationError) 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 %sUploadCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadCacheTaskRequestValidationError{} // Validate checks the field values on StatCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *StatCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // StatCacheTaskRequestMultiError, or nil if none found. func (m *StatCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *StatCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := StatCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatCacheTaskRequestMultiError(errors) } return nil } // StatCacheTaskRequestMultiError is an error wrapping multiple validation // errors returned by StatCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type StatCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatCacheTaskRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m StatCacheTaskRequestMultiError) AllErrors() []error { return m } // StatCacheTaskRequestValidationError is the validation error returned by // StatCacheTaskRequest.Validate if the designated constraints aren't met. type StatCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatCacheTaskRequestValidationError) ErrorName() string { return "StatCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e StatCacheTaskRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sStatCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatCacheTaskRequestValidationError{} // Validate checks the field values on DeleteCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. func (m *DeleteCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteCacheTaskRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in // DeleteCacheTaskRequestMultiError, or nil if none found. func (m *DeleteCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.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{}