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