// 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 m.Digest != nil { if m.GetDigest() != "" { if !_DownloadPieceResponse_Digest_Pattern.MatchString(m.GetDigest()) { err := DownloadPieceResponseValidationError{ 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 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{} var _DownloadPieceResponse_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 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 DownloadPersistentCacheTaskRequest 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 *DownloadPersistentCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPersistentCacheTaskRequest // 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 // DownloadPersistentCacheTaskRequestMultiError, or nil if none found. func (m *DownloadPersistentCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := DownloadPersistentCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } // no validation rules for Persistent // no validation rules for NeedPieceContent // no validation rules for ForceHardLink 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 := DownloadPersistentCacheTaskRequestValidationError{ 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, DownloadPersistentCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPersistentCacheTaskRequestValidationError{ 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 DownloadPersistentCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return DownloadPersistentCacheTaskRequestMultiError(errors) } return nil } // DownloadPersistentCacheTaskRequestMultiError is an error wrapping multiple // validation errors returned by // DownloadPersistentCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCacheTaskRequestMultiError) 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 DownloadPersistentCacheTaskRequestMultiError) AllErrors() []error { return m } // DownloadPersistentCacheTaskRequestValidationError is the validation error // returned by DownloadPersistentCacheTaskRequest.Validate if the designated // constraints aren't met. type DownloadPersistentCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCacheTaskRequestValidationError) ErrorName() string { return "DownloadPersistentCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCacheTaskRequestValidationError) 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 %sDownloadPersistentCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCacheTaskRequestValidationError{} // Validate checks the field values on // DownloadPersistentCacheTaskStartedResponse 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 *DownloadPersistentCacheTaskStartedResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // DownloadPersistentCacheTaskStartedResponse 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 // DownloadPersistentCacheTaskStartedResponseMultiError, or nil if none found. func (m *DownloadPersistentCacheTaskStartedResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCacheTaskStartedResponse) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for ContentLength if len(errors) > 0 { return DownloadPersistentCacheTaskStartedResponseMultiError(errors) } return nil } // DownloadPersistentCacheTaskStartedResponseMultiError is an error wrapping // multiple validation errors returned by // DownloadPersistentCacheTaskStartedResponse.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCacheTaskStartedResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCacheTaskStartedResponseMultiError) 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 DownloadPersistentCacheTaskStartedResponseMultiError) AllErrors() []error { return m } // DownloadPersistentCacheTaskStartedResponseValidationError is the validation // error returned by DownloadPersistentCacheTaskStartedResponse.Validate if // the designated constraints aren't met. type DownloadPersistentCacheTaskStartedResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCacheTaskStartedResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCacheTaskStartedResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCacheTaskStartedResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCacheTaskStartedResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCacheTaskStartedResponseValidationError) ErrorName() string { return "DownloadPersistentCacheTaskStartedResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCacheTaskStartedResponseValidationError) 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 %sDownloadPersistentCacheTaskStartedResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCacheTaskStartedResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCacheTaskStartedResponseValidationError{} // Validate checks the field values on DownloadPersistentCacheTaskResponse 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 *DownloadPersistentCacheTaskResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPersistentCacheTaskResponse // 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 // DownloadPersistentCacheTaskResponseMultiError, or nil if none found. func (m *DownloadPersistentCacheTaskResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCacheTaskResponse) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadPersistentCacheTaskResponseValidationError{ 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 := DownloadPersistentCacheTaskResponseValidationError{ 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 := DownloadPersistentCacheTaskResponseValidationError{ 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 *DownloadPersistentCacheTaskResponse_DownloadPersistentCacheTaskStartedResponse: if v == nil { err := DownloadPersistentCacheTaskResponseValidationError{ 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.GetDownloadPersistentCacheTaskStartedResponse()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DownloadPersistentCacheTaskResponseValidationError{ field: "DownloadPersistentCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPersistentCacheTaskResponseValidationError{ field: "DownloadPersistentCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDownloadPersistentCacheTaskStartedResponse()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DownloadPersistentCacheTaskResponseValidationError{ field: "DownloadPersistentCacheTaskStartedResponse", reason: "embedded message failed validation", cause: err, } } } case *DownloadPersistentCacheTaskResponse_DownloadPieceFinishedResponse: if v == nil { err := DownloadPersistentCacheTaskResponseValidationError{ 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, DownloadPersistentCacheTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPersistentCacheTaskResponseValidationError{ 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 DownloadPersistentCacheTaskResponseValidationError{ field: "DownloadPieceFinishedResponse", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofResponsePresent { err := DownloadPersistentCacheTaskResponseValidationError{ field: "Response", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DownloadPersistentCacheTaskResponseMultiError(errors) } return nil } // DownloadPersistentCacheTaskResponseMultiError is an error wrapping multiple // validation errors returned by // DownloadPersistentCacheTaskResponse.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCacheTaskResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCacheTaskResponseMultiError) 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 DownloadPersistentCacheTaskResponseMultiError) AllErrors() []error { return m } // DownloadPersistentCacheTaskResponseValidationError is the validation error // returned by DownloadPersistentCacheTaskResponse.Validate if the designated // constraints aren't met. type DownloadPersistentCacheTaskResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCacheTaskResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCacheTaskResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCacheTaskResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCacheTaskResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCacheTaskResponseValidationError) ErrorName() string { return "DownloadPersistentCacheTaskResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCacheTaskResponseValidationError) 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 %sDownloadPersistentCacheTaskResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCacheTaskResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCacheTaskResponseValidationError{} // Validate checks the field values on UploadPersistentCacheTaskRequest 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 *UploadPersistentCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UploadPersistentCacheTaskRequest 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 // UploadPersistentCacheTaskRequestMultiError, or nil if none found. func (m *UploadPersistentCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *UploadPersistentCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetPath()) < 1 { err := UploadPersistentCacheTaskRequestValidationError{ field: "Path", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if val := m.GetPersistentReplicaCount(); val < 1 || val > 5 { err := UploadPersistentCacheTaskRequestValidationError{ field: "PersistentReplicaCount", reason: "value must be inside range [1, 5]", } if !all { return err } errors = append(errors, err) } if d := m.GetTtl(); d != nil { dur, err := d.AsDuration(), d.CheckValid() if err != nil { err = UploadPersistentCacheTaskRequestValidationError{ field: "Ttl", reason: "value is not a valid duration", cause: err, } if !all { return err } errors = append(errors, err) } else { lte := time.Duration(604800*time.Second + 0*time.Nanosecond) gte := time.Duration(60*time.Second + 0*time.Nanosecond) if dur < gte || dur > lte { err := UploadPersistentCacheTaskRequestValidationError{ field: "Ttl", reason: "value must be inside range [1m0s, 168h0m0s]", } if !all { return err } errors = append(errors, err) } } } if m.ContentForCalculatingTaskId != nil { // no validation rules for ContentForCalculatingTaskId } 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 := UploadPersistentCacheTaskRequestValidationError{ field: "PieceLength", reason: "value must be greater than or equal to 4194304", } 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, UploadPersistentCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, UploadPersistentCacheTaskRequestValidationError{ 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 UploadPersistentCacheTaskRequestValidationError{ field: "Timeout", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return UploadPersistentCacheTaskRequestMultiError(errors) } return nil } // UploadPersistentCacheTaskRequestMultiError is an error wrapping multiple // validation errors returned by // UploadPersistentCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type UploadPersistentCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UploadPersistentCacheTaskRequestMultiError) 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 UploadPersistentCacheTaskRequestMultiError) AllErrors() []error { return m } // UploadPersistentCacheTaskRequestValidationError is the validation error // returned by UploadPersistentCacheTaskRequest.Validate if the designated // constraints aren't met. type UploadPersistentCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UploadPersistentCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UploadPersistentCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UploadPersistentCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UploadPersistentCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UploadPersistentCacheTaskRequestValidationError) ErrorName() string { return "UploadPersistentCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e UploadPersistentCacheTaskRequestValidationError) 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 %sUploadPersistentCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UploadPersistentCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UploadPersistentCacheTaskRequestValidationError{} // Validate checks the field values on UpdatePersistentCacheTaskRequest 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 *UpdatePersistentCacheTaskRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UpdatePersistentCacheTaskRequest 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 // UpdatePersistentCacheTaskRequestMultiError, or nil if none found. func (m *UpdatePersistentCacheTaskRequest) ValidateAll() error { return m.validate(true) } func (m *UpdatePersistentCacheTaskRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetTaskId()) < 1 { err := UpdatePersistentCacheTaskRequestValidationError{ field: "TaskId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } // no validation rules for Persistent if len(errors) > 0 { return UpdatePersistentCacheTaskRequestMultiError(errors) } return nil } // UpdatePersistentCacheTaskRequestMultiError is an error wrapping multiple // validation errors returned by // UpdatePersistentCacheTaskRequest.ValidateAll() if the designated // constraints aren't met. type UpdatePersistentCacheTaskRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UpdatePersistentCacheTaskRequestMultiError) 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 UpdatePersistentCacheTaskRequestMultiError) AllErrors() []error { return m } // UpdatePersistentCacheTaskRequestValidationError is the validation error // returned by UpdatePersistentCacheTaskRequest.Validate if the designated // constraints aren't met. type UpdatePersistentCacheTaskRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UpdatePersistentCacheTaskRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UpdatePersistentCacheTaskRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UpdatePersistentCacheTaskRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UpdatePersistentCacheTaskRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UpdatePersistentCacheTaskRequestValidationError) ErrorName() string { return "UpdatePersistentCacheTaskRequestValidationError" } // Error satisfies the builtin error interface func (e UpdatePersistentCacheTaskRequestValidationError) 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 %sUpdatePersistentCacheTaskRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UpdatePersistentCacheTaskRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UpdatePersistentCacheTaskRequestValidationError{} // 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.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.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 SyncPersistentCachePiecesRequest 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 *SyncPersistentCachePiecesRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncPersistentCachePiecesRequest 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 // SyncPersistentCachePiecesRequestMultiError, or nil if none found. func (m *SyncPersistentCachePiecesRequest) ValidateAll() error { return m.validate(true) } func (m *SyncPersistentCachePiecesRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := SyncPersistentCachePiecesRequestValidationError{ 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 := SyncPersistentCachePiecesRequestValidationError{ 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 := SyncPersistentCachePiecesRequestValidationError{ field: "InterestedPieceNumbers", reason: "value must contain at least 1 item(s)", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return SyncPersistentCachePiecesRequestMultiError(errors) } return nil } // SyncPersistentCachePiecesRequestMultiError is an error wrapping multiple // validation errors returned by // SyncPersistentCachePiecesRequest.ValidateAll() if the designated // constraints aren't met. type SyncPersistentCachePiecesRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncPersistentCachePiecesRequestMultiError) 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 SyncPersistentCachePiecesRequestMultiError) AllErrors() []error { return m } // SyncPersistentCachePiecesRequestValidationError is the validation error // returned by SyncPersistentCachePiecesRequest.Validate if the designated // constraints aren't met. type SyncPersistentCachePiecesRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncPersistentCachePiecesRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncPersistentCachePiecesRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncPersistentCachePiecesRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncPersistentCachePiecesRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncPersistentCachePiecesRequestValidationError) ErrorName() string { return "SyncPersistentCachePiecesRequestValidationError" } // Error satisfies the builtin error interface func (e SyncPersistentCachePiecesRequestValidationError) 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 %sSyncPersistentCachePiecesRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncPersistentCachePiecesRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncPersistentCachePiecesRequestValidationError{} // Validate checks the field values on SyncPersistentCachePiecesResponse 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 *SyncPersistentCachePiecesResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncPersistentCachePiecesResponse // 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 // SyncPersistentCachePiecesResponseMultiError, or nil if none found. func (m *SyncPersistentCachePiecesResponse) ValidateAll() error { return m.validate(true) } func (m *SyncPersistentCachePiecesResponse) 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 SyncPersistentCachePiecesResponseMultiError(errors) } return nil } // SyncPersistentCachePiecesResponseMultiError is an error wrapping multiple // validation errors returned by // SyncPersistentCachePiecesResponse.ValidateAll() if the designated // constraints aren't met. type SyncPersistentCachePiecesResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncPersistentCachePiecesResponseMultiError) 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 SyncPersistentCachePiecesResponseMultiError) AllErrors() []error { return m } // SyncPersistentCachePiecesResponseValidationError is the validation error // returned by SyncPersistentCachePiecesResponse.Validate if the designated // constraints aren't met. type SyncPersistentCachePiecesResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncPersistentCachePiecesResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncPersistentCachePiecesResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncPersistentCachePiecesResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncPersistentCachePiecesResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncPersistentCachePiecesResponseValidationError) ErrorName() string { return "SyncPersistentCachePiecesResponseValidationError" } // Error satisfies the builtin error interface func (e SyncPersistentCachePiecesResponseValidationError) 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 %sSyncPersistentCachePiecesResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncPersistentCachePiecesResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncPersistentCachePiecesResponseValidationError{} // Validate checks the field values on DownloadPersistentCachePieceRequest 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 *DownloadPersistentCachePieceRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPersistentCachePieceRequest // 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 // DownloadPersistentCachePieceRequestMultiError, or nil if none found. func (m *DownloadPersistentCachePieceRequest) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCachePieceRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := DownloadPersistentCachePieceRequestValidationError{ 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 := DownloadPersistentCachePieceRequestValidationError{ 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 DownloadPersistentCachePieceRequestMultiError(errors) } return nil } // DownloadPersistentCachePieceRequestMultiError is an error wrapping multiple // validation errors returned by // DownloadPersistentCachePieceRequest.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCachePieceRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCachePieceRequestMultiError) 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 DownloadPersistentCachePieceRequestMultiError) AllErrors() []error { return m } // DownloadPersistentCachePieceRequestValidationError is the validation error // returned by DownloadPersistentCachePieceRequest.Validate if the designated // constraints aren't met. type DownloadPersistentCachePieceRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCachePieceRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCachePieceRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCachePieceRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCachePieceRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCachePieceRequestValidationError) ErrorName() string { return "DownloadPersistentCachePieceRequestValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCachePieceRequestValidationError) 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 %sDownloadPersistentCachePieceRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCachePieceRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCachePieceRequestValidationError{} // Validate checks the field values on DownloadPersistentCachePieceResponse // 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 *DownloadPersistentCachePieceResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DownloadPersistentCachePieceResponse // 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 // DownloadPersistentCachePieceResponseMultiError, or nil if none found. func (m *DownloadPersistentCachePieceResponse) ValidateAll() error { return m.validate(true) } func (m *DownloadPersistentCachePieceResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetPiece() == nil { err := DownloadPersistentCachePieceResponseValidationError{ 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, DownloadPersistentCachePieceResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DownloadPersistentCachePieceResponseValidationError{ 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 DownloadPersistentCachePieceResponseValidationError{ field: "Piece", reason: "embedded message failed validation", cause: err, } } } if m.Digest != nil { if m.GetDigest() != "" { if !_DownloadPersistentCachePieceResponse_Digest_Pattern.MatchString(m.GetDigest()) { err := DownloadPersistentCachePieceResponseValidationError{ 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 len(errors) > 0 { return DownloadPersistentCachePieceResponseMultiError(errors) } return nil } // DownloadPersistentCachePieceResponseMultiError is an error wrapping multiple // validation errors returned by // DownloadPersistentCachePieceResponse.ValidateAll() if the designated // constraints aren't met. type DownloadPersistentCachePieceResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DownloadPersistentCachePieceResponseMultiError) 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 DownloadPersistentCachePieceResponseMultiError) AllErrors() []error { return m } // DownloadPersistentCachePieceResponseValidationError is the validation error // returned by DownloadPersistentCachePieceResponse.Validate if the designated // constraints aren't met. type DownloadPersistentCachePieceResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DownloadPersistentCachePieceResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DownloadPersistentCachePieceResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DownloadPersistentCachePieceResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DownloadPersistentCachePieceResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DownloadPersistentCachePieceResponseValidationError) ErrorName() string { return "DownloadPersistentCachePieceResponseValidationError" } // Error satisfies the builtin error interface func (e DownloadPersistentCachePieceResponseValidationError) 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 %sDownloadPersistentCachePieceResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DownloadPersistentCachePieceResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DownloadPersistentCachePieceResponseValidationError{} var _DownloadPersistentCachePieceResponse_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 SyncHostRequest 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 *SyncHostRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SyncHostRequest 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 // SyncHostRequestMultiError, or nil if none found. func (m *SyncHostRequest) ValidateAll() error { return m.validate(true) } func (m *SyncHostRequest) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetHostId()) < 1 { err := SyncHostRequestValidationError{ field: "HostId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetPeerId()) < 1 { err := SyncHostRequestValidationError{ field: "PeerId", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return SyncHostRequestMultiError(errors) } return nil } // SyncHostRequestMultiError is an error wrapping multiple validation errors // returned by SyncHostRequest.ValidateAll() if the designated constraints // aren't met. type SyncHostRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SyncHostRequestMultiError) 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 SyncHostRequestMultiError) AllErrors() []error { return m } // SyncHostRequestValidationError is the validation error returned by // SyncHostRequest.Validate if the designated constraints aren't met. type SyncHostRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SyncHostRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SyncHostRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SyncHostRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SyncHostRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SyncHostRequestValidationError) ErrorName() string { return "SyncHostRequestValidationError" } // Error satisfies the builtin error interface func (e SyncHostRequestValidationError) 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 %sSyncHostRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SyncHostRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SyncHostRequestValidationError{} // Validate checks the field values on IBVerbsQueuePairEndpoint 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 *IBVerbsQueuePairEndpoint) Validate() error { return m.validate(false) } // ValidateAll checks the field values on IBVerbsQueuePairEndpoint 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 // IBVerbsQueuePairEndpointMultiError, or nil if none found. func (m *IBVerbsQueuePairEndpoint) ValidateAll() error { return m.validate(true) } func (m *IBVerbsQueuePairEndpoint) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Num // no validation rules for Lid if len(m.GetGid()) != 16 { err := IBVerbsQueuePairEndpointValidationError{ field: "Gid", reason: "value length must be 16 bytes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return IBVerbsQueuePairEndpointMultiError(errors) } return nil } // IBVerbsQueuePairEndpointMultiError is an error wrapping multiple validation // errors returned by IBVerbsQueuePairEndpoint.ValidateAll() if the designated // constraints aren't met. type IBVerbsQueuePairEndpointMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m IBVerbsQueuePairEndpointMultiError) 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 IBVerbsQueuePairEndpointMultiError) AllErrors() []error { return m } // IBVerbsQueuePairEndpointValidationError is the validation error returned by // IBVerbsQueuePairEndpoint.Validate if the designated constraints aren't met. type IBVerbsQueuePairEndpointValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e IBVerbsQueuePairEndpointValidationError) Field() string { return e.field } // Reason function returns reason value. func (e IBVerbsQueuePairEndpointValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e IBVerbsQueuePairEndpointValidationError) Cause() error { return e.cause } // Key function returns key value. func (e IBVerbsQueuePairEndpointValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e IBVerbsQueuePairEndpointValidationError) ErrorName() string { return "IBVerbsQueuePairEndpointValidationError" } // Error satisfies the builtin error interface func (e IBVerbsQueuePairEndpointValidationError) 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 %sIBVerbsQueuePairEndpoint.%s: %s%s", key, e.field, e.reason, cause) } var _ error = IBVerbsQueuePairEndpointValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = IBVerbsQueuePairEndpointValidationError{} // Validate checks the field values on ExchangeIBVerbsQueuePairEndpointRequest // 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 *ExchangeIBVerbsQueuePairEndpointRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // ExchangeIBVerbsQueuePairEndpointRequest 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 // ExchangeIBVerbsQueuePairEndpointRequestMultiError, or nil if none found. func (m *ExchangeIBVerbsQueuePairEndpointRequest) ValidateAll() error { return m.validate(true) } func (m *ExchangeIBVerbsQueuePairEndpointRequest) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetEndpoint() == nil { err := ExchangeIBVerbsQueuePairEndpointRequestValidationError{ field: "Endpoint", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetEndpoint()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ExchangeIBVerbsQueuePairEndpointRequestValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ExchangeIBVerbsQueuePairEndpointRequestValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExchangeIBVerbsQueuePairEndpointRequestValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return ExchangeIBVerbsQueuePairEndpointRequestMultiError(errors) } return nil } // ExchangeIBVerbsQueuePairEndpointRequestMultiError is an error wrapping // multiple validation errors returned by // ExchangeIBVerbsQueuePairEndpointRequest.ValidateAll() if the designated // constraints aren't met. type ExchangeIBVerbsQueuePairEndpointRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ExchangeIBVerbsQueuePairEndpointRequestMultiError) 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 ExchangeIBVerbsQueuePairEndpointRequestMultiError) AllErrors() []error { return m } // ExchangeIBVerbsQueuePairEndpointRequestValidationError is the validation // error returned by ExchangeIBVerbsQueuePairEndpointRequest.Validate if the // designated constraints aren't met. type ExchangeIBVerbsQueuePairEndpointRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) ErrorName() string { return "ExchangeIBVerbsQueuePairEndpointRequestValidationError" } // Error satisfies the builtin error interface func (e ExchangeIBVerbsQueuePairEndpointRequestValidationError) 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 %sExchangeIBVerbsQueuePairEndpointRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ExchangeIBVerbsQueuePairEndpointRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ExchangeIBVerbsQueuePairEndpointRequestValidationError{} // Validate checks the field values on ExchangeIBVerbsQueuePairEndpointResponse // 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 *ExchangeIBVerbsQueuePairEndpointResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on // ExchangeIBVerbsQueuePairEndpointResponse 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 // ExchangeIBVerbsQueuePairEndpointResponseMultiError, or nil if none found. func (m *ExchangeIBVerbsQueuePairEndpointResponse) ValidateAll() error { return m.validate(true) } func (m *ExchangeIBVerbsQueuePairEndpointResponse) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetEndpoint() == nil { err := ExchangeIBVerbsQueuePairEndpointResponseValidationError{ field: "Endpoint", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetEndpoint()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ExchangeIBVerbsQueuePairEndpointResponseValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ExchangeIBVerbsQueuePairEndpointResponseValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExchangeIBVerbsQueuePairEndpointResponseValidationError{ field: "Endpoint", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return ExchangeIBVerbsQueuePairEndpointResponseMultiError(errors) } return nil } // ExchangeIBVerbsQueuePairEndpointResponseMultiError is an error wrapping // multiple validation errors returned by // ExchangeIBVerbsQueuePairEndpointResponse.ValidateAll() if the designated // constraints aren't met. type ExchangeIBVerbsQueuePairEndpointResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ExchangeIBVerbsQueuePairEndpointResponseMultiError) 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 ExchangeIBVerbsQueuePairEndpointResponseMultiError) AllErrors() []error { return m } // ExchangeIBVerbsQueuePairEndpointResponseValidationError is the validation // error returned by ExchangeIBVerbsQueuePairEndpointResponse.Validate if the // designated constraints aren't met. type ExchangeIBVerbsQueuePairEndpointResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) ErrorName() string { return "ExchangeIBVerbsQueuePairEndpointResponseValidationError" } // Error satisfies the builtin error interface func (e ExchangeIBVerbsQueuePairEndpointResponseValidationError) 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 %sExchangeIBVerbsQueuePairEndpointResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ExchangeIBVerbsQueuePairEndpointResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ExchangeIBVerbsQueuePairEndpointResponseValidationError{}