// Code generated by protoc-gen-validate. DO NOT EDIT. // source: pkg/apis/manager/v2/manager.proto package manager import ( "bytes" "errors" "fmt" "net" "net/mail" "net/url" "regexp" "sort" "strings" "time" "unicode/utf8" "google.golang.org/protobuf/types/known/anypb" common "d7y.io/api/v2/pkg/apis/common/v2" ) // ensure the imports are used var ( _ = bytes.MinRead _ = errors.New("") _ = fmt.Print _ = utf8.UTFMax _ = (*regexp.Regexp)(nil) _ = (*strings.Reader)(nil) _ = net.IPv4len _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = anypb.Any{} _ = sort.Sort _ = common.Priority(0) ) // Validate checks the field values on SeedPeerCluster 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 *SeedPeerCluster) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SeedPeerCluster 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 // SeedPeerClusterMultiError, or nil if none found. func (m *SeedPeerCluster) ValidateAll() error { return m.validate(true) } func (m *SeedPeerCluster) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for Name // no validation rules for Bio // no validation rules for Config if len(errors) > 0 { return SeedPeerClusterMultiError(errors) } return nil } // SeedPeerClusterMultiError is an error wrapping multiple validation errors // returned by SeedPeerCluster.ValidateAll() if the designated constraints // aren't met. type SeedPeerClusterMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SeedPeerClusterMultiError) 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 SeedPeerClusterMultiError) AllErrors() []error { return m } // SeedPeerClusterValidationError is the validation error returned by // SeedPeerCluster.Validate if the designated constraints aren't met. type SeedPeerClusterValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SeedPeerClusterValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SeedPeerClusterValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SeedPeerClusterValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SeedPeerClusterValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SeedPeerClusterValidationError) ErrorName() string { return "SeedPeerClusterValidationError" } // Error satisfies the builtin error interface func (e SeedPeerClusterValidationError) 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 %sSeedPeerCluster.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SeedPeerClusterValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SeedPeerClusterValidationError{} // Validate checks the field values on SeedPeer 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 *SeedPeer) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SeedPeer 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 SeedPeerMultiError, or nil // if none found. func (m *SeedPeer) ValidateAll() error { return m.validate(true) } func (m *SeedPeer) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for Hostname // no validation rules for Type // no validation rules for Ip // no validation rules for Port // no validation rules for DownloadPort // no validation rules for State // no validation rules for SeedPeerClusterId if all { switch v := interface{}(m.GetSeedPeerCluster()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SeedPeerValidationError{ field: "SeedPeerCluster", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SeedPeerValidationError{ field: "SeedPeerCluster", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSeedPeerCluster()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SeedPeerValidationError{ field: "SeedPeerCluster", reason: "embedded message failed validation", cause: err, } } } for idx, item := range m.GetSchedulers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SeedPeerValidationError{ field: fmt.Sprintf("Schedulers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SeedPeerValidationError{ field: fmt.Sprintf("Schedulers[%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 SeedPeerValidationError{ field: fmt.Sprintf("Schedulers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.Idc != nil { // no validation rules for Idc } if m.Location != nil { // no validation rules for Location } if len(errors) > 0 { return SeedPeerMultiError(errors) } return nil } // SeedPeerMultiError is an error wrapping multiple validation errors returned // by SeedPeer.ValidateAll() if the designated constraints aren't met. type SeedPeerMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SeedPeerMultiError) 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 SeedPeerMultiError) AllErrors() []error { return m } // SeedPeerValidationError is the validation error returned by // SeedPeer.Validate if the designated constraints aren't met. type SeedPeerValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SeedPeerValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SeedPeerValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SeedPeerValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SeedPeerValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SeedPeerValidationError) ErrorName() string { return "SeedPeerValidationError" } // Error satisfies the builtin error interface func (e SeedPeerValidationError) 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 %sSeedPeer.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SeedPeerValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SeedPeerValidationError{} // Validate checks the field values on GetSeedPeerRequest 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 *GetSeedPeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on GetSeedPeerRequest 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 // GetSeedPeerRequestMultiError, or nil if none found. func (m *GetSeedPeerRequest) ValidateAll() error { return m.validate(true) } func (m *GetSeedPeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := GetSeedPeerRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = GetSeedPeerRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if m.GetSeedPeerClusterId() < 1 { err := GetSeedPeerRequestValidationError{ field: "SeedPeerClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.GetIp() != "" { if ip := net.ParseIP(m.GetIp()); ip == nil { err := GetSeedPeerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } } if len(errors) > 0 { return GetSeedPeerRequestMultiError(errors) } return nil } func (m *GetSeedPeerRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // GetSeedPeerRequestMultiError is an error wrapping multiple validation errors // returned by GetSeedPeerRequest.ValidateAll() if the designated constraints // aren't met. type GetSeedPeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m GetSeedPeerRequestMultiError) 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 GetSeedPeerRequestMultiError) AllErrors() []error { return m } // GetSeedPeerRequestValidationError is the validation error returned by // GetSeedPeerRequest.Validate if the designated constraints aren't met. type GetSeedPeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e GetSeedPeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e GetSeedPeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e GetSeedPeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e GetSeedPeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e GetSeedPeerRequestValidationError) ErrorName() string { return "GetSeedPeerRequestValidationError" } // Error satisfies the builtin error interface func (e GetSeedPeerRequestValidationError) 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 %sGetSeedPeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = GetSeedPeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = GetSeedPeerRequestValidationError{} // Validate checks the field values on ListSeedPeersRequest 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 *ListSeedPeersRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListSeedPeersRequest 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 // ListSeedPeersRequestMultiError, or nil if none found. func (m *ListSeedPeersRequest) ValidateAll() error { return m.validate(true) } func (m *ListSeedPeersRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := ListSeedPeersRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = ListSeedPeersRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := ListSeedPeersRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if m.GetVersion() != "" { if l := utf8.RuneCountInString(m.GetVersion()); l < 1 || l > 1024 { err := ListSeedPeersRequestValidationError{ field: "Version", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } if m.GetCommit() != "" { if l := utf8.RuneCountInString(m.GetCommit()); l < 1 || l > 1024 { err := ListSeedPeersRequestValidationError{ field: "Commit", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } if len(errors) > 0 { return ListSeedPeersRequestMultiError(errors) } return nil } func (m *ListSeedPeersRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // ListSeedPeersRequestMultiError is an error wrapping multiple validation // errors returned by ListSeedPeersRequest.ValidateAll() if the designated // constraints aren't met. type ListSeedPeersRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListSeedPeersRequestMultiError) 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 ListSeedPeersRequestMultiError) AllErrors() []error { return m } // ListSeedPeersRequestValidationError is the validation error returned by // ListSeedPeersRequest.Validate if the designated constraints aren't met. type ListSeedPeersRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListSeedPeersRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListSeedPeersRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListSeedPeersRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListSeedPeersRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListSeedPeersRequestValidationError) ErrorName() string { return "ListSeedPeersRequestValidationError" } // Error satisfies the builtin error interface func (e ListSeedPeersRequestValidationError) 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 %sListSeedPeersRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListSeedPeersRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListSeedPeersRequestValidationError{} // Validate checks the field values on ListSeedPeersResponse 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 *ListSeedPeersResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListSeedPeersResponse 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 // ListSeedPeersResponseMultiError, or nil if none found. func (m *ListSeedPeersResponse) ValidateAll() error { return m.validate(true) } func (m *ListSeedPeersResponse) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetSeedPeers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ListSeedPeersResponseValidationError{ field: fmt.Sprintf("SeedPeers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ListSeedPeersResponseValidationError{ field: fmt.Sprintf("SeedPeers[%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 ListSeedPeersResponseValidationError{ field: fmt.Sprintf("SeedPeers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ListSeedPeersResponseMultiError(errors) } return nil } // ListSeedPeersResponseMultiError is an error wrapping multiple validation // errors returned by ListSeedPeersResponse.ValidateAll() if the designated // constraints aren't met. type ListSeedPeersResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListSeedPeersResponseMultiError) 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 ListSeedPeersResponseMultiError) AllErrors() []error { return m } // ListSeedPeersResponseValidationError is the validation error returned by // ListSeedPeersResponse.Validate if the designated constraints aren't met. type ListSeedPeersResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListSeedPeersResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListSeedPeersResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListSeedPeersResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListSeedPeersResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListSeedPeersResponseValidationError) ErrorName() string { return "ListSeedPeersResponseValidationError" } // Error satisfies the builtin error interface func (e ListSeedPeersResponseValidationError) 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 %sListSeedPeersResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListSeedPeersResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListSeedPeersResponseValidationError{} // Validate checks the field values on UpdateSeedPeerRequest 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 *UpdateSeedPeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UpdateSeedPeerRequest 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 // UpdateSeedPeerRequestMultiError, or nil if none found. func (m *UpdateSeedPeerRequest) ValidateAll() error { return m.validate(true) } func (m *UpdateSeedPeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := UpdateSeedPeerRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = UpdateSeedPeerRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if _, ok := _UpdateSeedPeerRequest_Type_InLookup[m.GetType()]; !ok { err := UpdateSeedPeerRequestValidationError{ field: "Type", reason: "value must be in list [super strong weak]", } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := UpdateSeedPeerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if val := m.GetPort(); val < 1024 || val >= 65535 { err := UpdateSeedPeerRequestValidationError{ field: "Port", reason: "value must be inside range [1024, 65535)", } if !all { return err } errors = append(errors, err) } if val := m.GetDownloadPort(); val < 1024 || val >= 65535 { err := UpdateSeedPeerRequestValidationError{ field: "DownloadPort", reason: "value must be inside range [1024, 65535)", } if !all { return err } errors = append(errors, err) } if m.GetSeedPeerClusterId() < 1 { err := UpdateSeedPeerRequestValidationError{ field: "SeedPeerClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.Idc != nil { if m.GetIdc() != "" { if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { err := UpdateSeedPeerRequestValidationError{ field: "Idc", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } } if m.Location != nil { if m.GetLocation() != "" { if utf8.RuneCountInString(m.GetLocation()) > 1024 { err := UpdateSeedPeerRequestValidationError{ field: "Location", reason: "value length must be at most 1024 runes", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return UpdateSeedPeerRequestMultiError(errors) } return nil } func (m *UpdateSeedPeerRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // UpdateSeedPeerRequestMultiError is an error wrapping multiple validation // errors returned by UpdateSeedPeerRequest.ValidateAll() if the designated // constraints aren't met. type UpdateSeedPeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UpdateSeedPeerRequestMultiError) 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 UpdateSeedPeerRequestMultiError) AllErrors() []error { return m } // UpdateSeedPeerRequestValidationError is the validation error returned by // UpdateSeedPeerRequest.Validate if the designated constraints aren't met. type UpdateSeedPeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UpdateSeedPeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UpdateSeedPeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UpdateSeedPeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UpdateSeedPeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UpdateSeedPeerRequestValidationError) ErrorName() string { return "UpdateSeedPeerRequestValidationError" } // Error satisfies the builtin error interface func (e UpdateSeedPeerRequestValidationError) 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 %sUpdateSeedPeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UpdateSeedPeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UpdateSeedPeerRequestValidationError{} var _UpdateSeedPeerRequest_Type_InLookup = map[string]struct{}{ "super": {}, "strong": {}, "weak": {}, } // Validate checks the field values on DeleteSeedPeerRequest 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 *DeleteSeedPeerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DeleteSeedPeerRequest 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 // DeleteSeedPeerRequestMultiError, or nil if none found. func (m *DeleteSeedPeerRequest) ValidateAll() error { return m.validate(true) } func (m *DeleteSeedPeerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := DeleteSeedPeerRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = DeleteSeedPeerRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if m.GetSeedPeerClusterId() < 1 { err := DeleteSeedPeerRequestValidationError{ field: "SeedPeerClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.GetIp() != "" { if ip := net.ParseIP(m.GetIp()); ip == nil { err := DeleteSeedPeerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } } if len(errors) > 0 { return DeleteSeedPeerRequestMultiError(errors) } return nil } func (m *DeleteSeedPeerRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // DeleteSeedPeerRequestMultiError is an error wrapping multiple validation // errors returned by DeleteSeedPeerRequest.ValidateAll() if the designated // constraints aren't met. type DeleteSeedPeerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DeleteSeedPeerRequestMultiError) 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 DeleteSeedPeerRequestMultiError) AllErrors() []error { return m } // DeleteSeedPeerRequestValidationError is the validation error returned by // DeleteSeedPeerRequest.Validate if the designated constraints aren't met. type DeleteSeedPeerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DeleteSeedPeerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DeleteSeedPeerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DeleteSeedPeerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DeleteSeedPeerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DeleteSeedPeerRequestValidationError) ErrorName() string { return "DeleteSeedPeerRequestValidationError" } // Error satisfies the builtin error interface func (e DeleteSeedPeerRequestValidationError) 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 %sDeleteSeedPeerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DeleteSeedPeerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DeleteSeedPeerRequestValidationError{} // Validate checks the field values on SchedulerCluster 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 *SchedulerCluster) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SchedulerCluster 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 // SchedulerClusterMultiError, or nil if none found. func (m *SchedulerCluster) ValidateAll() error { return m.validate(true) } func (m *SchedulerCluster) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for Name // no validation rules for Bio // no validation rules for Config // no validation rules for ClientConfig // no validation rules for Scopes if len(errors) > 0 { return SchedulerClusterMultiError(errors) } return nil } // SchedulerClusterMultiError is an error wrapping multiple validation errors // returned by SchedulerCluster.ValidateAll() if the designated constraints // aren't met. type SchedulerClusterMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SchedulerClusterMultiError) 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 SchedulerClusterMultiError) AllErrors() []error { return m } // SchedulerClusterValidationError is the validation error returned by // SchedulerCluster.Validate if the designated constraints aren't met. type SchedulerClusterValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SchedulerClusterValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SchedulerClusterValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SchedulerClusterValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SchedulerClusterValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SchedulerClusterValidationError) ErrorName() string { return "SchedulerClusterValidationError" } // Error satisfies the builtin error interface func (e SchedulerClusterValidationError) 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 %sSchedulerCluster.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SchedulerClusterValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SchedulerClusterValidationError{} // Validate checks the field values on Scheduler 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 *Scheduler) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Scheduler 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 SchedulerMultiError, or nil // if none found. func (m *Scheduler) ValidateAll() error { return m.validate(true) } func (m *Scheduler) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for Hostname // no validation rules for Ip // no validation rules for Port // no validation rules for State // no validation rules for SchedulerClusterId if all { switch v := interface{}(m.GetSchedulerCluster()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SchedulerValidationError{ field: "SchedulerCluster", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SchedulerValidationError{ field: "SchedulerCluster", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSchedulerCluster()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SchedulerValidationError{ field: "SchedulerCluster", reason: "embedded message failed validation", cause: err, } } } for idx, item := range m.GetSeedPeers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, SchedulerValidationError{ field: fmt.Sprintf("SeedPeers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, SchedulerValidationError{ field: fmt.Sprintf("SeedPeers[%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 SchedulerValidationError{ field: fmt.Sprintf("SeedPeers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } // no validation rules for Features if m.Idc != nil { // no validation rules for Idc } if m.Location != nil { // no validation rules for Location } if len(errors) > 0 { return SchedulerMultiError(errors) } return nil } // SchedulerMultiError is an error wrapping multiple validation errors returned // by Scheduler.ValidateAll() if the designated constraints aren't met. type SchedulerMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SchedulerMultiError) 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 SchedulerMultiError) AllErrors() []error { return m } // SchedulerValidationError is the validation error returned by // Scheduler.Validate if the designated constraints aren't met. type SchedulerValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SchedulerValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SchedulerValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SchedulerValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SchedulerValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SchedulerValidationError) ErrorName() string { return "SchedulerValidationError" } // Error satisfies the builtin error interface func (e SchedulerValidationError) 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 %sScheduler.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SchedulerValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SchedulerValidationError{} // Validate checks the field values on GetSchedulerRequest 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 *GetSchedulerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on GetSchedulerRequest 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 // GetSchedulerRequestMultiError, or nil if none found. func (m *GetSchedulerRequest) ValidateAll() error { return m.validate(true) } func (m *GetSchedulerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := GetSchedulerRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = GetSchedulerRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if m.GetSchedulerClusterId() < 1 { err := GetSchedulerRequestValidationError{ field: "SchedulerClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.GetIp() != "" { if ip := net.ParseIP(m.GetIp()); ip == nil { err := GetSchedulerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } } if len(errors) > 0 { return GetSchedulerRequestMultiError(errors) } return nil } func (m *GetSchedulerRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // GetSchedulerRequestMultiError is an error wrapping multiple validation // errors returned by GetSchedulerRequest.ValidateAll() if the designated // constraints aren't met. type GetSchedulerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m GetSchedulerRequestMultiError) 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 GetSchedulerRequestMultiError) AllErrors() []error { return m } // GetSchedulerRequestValidationError is the validation error returned by // GetSchedulerRequest.Validate if the designated constraints aren't met. type GetSchedulerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e GetSchedulerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e GetSchedulerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e GetSchedulerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e GetSchedulerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e GetSchedulerRequestValidationError) ErrorName() string { return "GetSchedulerRequestValidationError" } // Error satisfies the builtin error interface func (e GetSchedulerRequestValidationError) 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 %sGetSchedulerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = GetSchedulerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = GetSchedulerRequestValidationError{} // Validate checks the field values on UpdateSchedulerRequest 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 *UpdateSchedulerRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on UpdateSchedulerRequest 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 // UpdateSchedulerRequestMultiError, or nil if none found. func (m *UpdateSchedulerRequest) ValidateAll() error { return m.validate(true) } func (m *UpdateSchedulerRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := UpdateSchedulerRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = UpdateSchedulerRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if m.GetSchedulerClusterId() < 1 { err := UpdateSchedulerRequestValidationError{ field: "SchedulerClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := UpdateSchedulerRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if val := m.GetPort(); val < 1024 || val >= 65535 { err := UpdateSchedulerRequestValidationError{ field: "Port", reason: "value must be inside range [1024, 65535)", } if !all { return err } errors = append(errors, err) } if m.Idc != nil { if m.GetIdc() != "" { if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { err := UpdateSchedulerRequestValidationError{ field: "Idc", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } } if m.Location != nil { if m.GetLocation() != "" { if l := utf8.RuneCountInString(m.GetLocation()); l < 1 || l > 1024 { err := UpdateSchedulerRequestValidationError{ field: "Location", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return UpdateSchedulerRequestMultiError(errors) } return nil } func (m *UpdateSchedulerRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // UpdateSchedulerRequestMultiError is an error wrapping multiple validation // errors returned by UpdateSchedulerRequest.ValidateAll() if the designated // constraints aren't met. type UpdateSchedulerRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m UpdateSchedulerRequestMultiError) 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 UpdateSchedulerRequestMultiError) AllErrors() []error { return m } // UpdateSchedulerRequestValidationError is the validation error returned by // UpdateSchedulerRequest.Validate if the designated constraints aren't met. type UpdateSchedulerRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e UpdateSchedulerRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e UpdateSchedulerRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e UpdateSchedulerRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e UpdateSchedulerRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e UpdateSchedulerRequestValidationError) ErrorName() string { return "UpdateSchedulerRequestValidationError" } // Error satisfies the builtin error interface func (e UpdateSchedulerRequestValidationError) 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 %sUpdateSchedulerRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = UpdateSchedulerRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = UpdateSchedulerRequestValidationError{} // Validate checks the field values on ListSchedulersRequest 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 *ListSchedulersRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListSchedulersRequest 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 // ListSchedulersRequestMultiError, or nil if none found. func (m *ListSchedulersRequest) ValidateAll() error { return m.validate(true) } func (m *ListSchedulersRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := ListSchedulersRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = ListSchedulersRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := ListSchedulersRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if m.GetVersion() != "" { if l := utf8.RuneCountInString(m.GetVersion()); l < 1 || l > 1024 { err := ListSchedulersRequestValidationError{ field: "Version", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } if m.GetCommit() != "" { if l := utf8.RuneCountInString(m.GetCommit()); l < 1 || l > 1024 { err := ListSchedulersRequestValidationError{ field: "Commit", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } if m.Idc != nil { if m.GetIdc() != "" { if l := utf8.RuneCountInString(m.GetIdc()); l < 1 || l > 1024 { err := ListSchedulersRequestValidationError{ field: "Idc", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } } if m.Location != nil { if m.GetLocation() != "" { if l := utf8.RuneCountInString(m.GetLocation()); l < 1 || l > 1024 { err := ListSchedulersRequestValidationError{ field: "Location", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } } } if len(errors) > 0 { return ListSchedulersRequestMultiError(errors) } return nil } func (m *ListSchedulersRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // ListSchedulersRequestMultiError is an error wrapping multiple validation // errors returned by ListSchedulersRequest.ValidateAll() if the designated // constraints aren't met. type ListSchedulersRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListSchedulersRequestMultiError) 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 ListSchedulersRequestMultiError) AllErrors() []error { return m } // ListSchedulersRequestValidationError is the validation error returned by // ListSchedulersRequest.Validate if the designated constraints aren't met. type ListSchedulersRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListSchedulersRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListSchedulersRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListSchedulersRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListSchedulersRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListSchedulersRequestValidationError) ErrorName() string { return "ListSchedulersRequestValidationError" } // Error satisfies the builtin error interface func (e ListSchedulersRequestValidationError) 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 %sListSchedulersRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListSchedulersRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListSchedulersRequestValidationError{} // Validate checks the field values on ListSchedulersResponse 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 *ListSchedulersResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListSchedulersResponse 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 // ListSchedulersResponseMultiError, or nil if none found. func (m *ListSchedulersResponse) ValidateAll() error { return m.validate(true) } func (m *ListSchedulersResponse) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetSchedulers() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ListSchedulersResponseValidationError{ field: fmt.Sprintf("Schedulers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ListSchedulersResponseValidationError{ field: fmt.Sprintf("Schedulers[%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 ListSchedulersResponseValidationError{ field: fmt.Sprintf("Schedulers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ListSchedulersResponseMultiError(errors) } return nil } // ListSchedulersResponseMultiError is an error wrapping multiple validation // errors returned by ListSchedulersResponse.ValidateAll() if the designated // constraints aren't met. type ListSchedulersResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListSchedulersResponseMultiError) 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 ListSchedulersResponseMultiError) AllErrors() []error { return m } // ListSchedulersResponseValidationError is the validation error returned by // ListSchedulersResponse.Validate if the designated constraints aren't met. type ListSchedulersResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListSchedulersResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListSchedulersResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListSchedulersResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListSchedulersResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListSchedulersResponseValidationError) ErrorName() string { return "ListSchedulersResponseValidationError" } // Error satisfies the builtin error interface func (e ListSchedulersResponseValidationError) 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 %sListSchedulersResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListSchedulersResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListSchedulersResponseValidationError{} // Validate checks the field values on URLPriority 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 *URLPriority) Validate() error { return m.validate(false) } // ValidateAll checks the field values on URLPriority 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 URLPriorityMultiError, or // nil if none found. func (m *URLPriority) ValidateAll() error { return m.validate(true) } func (m *URLPriority) validate(all bool) error { if m == nil { return nil } var errors []error if utf8.RuneCountInString(m.GetRegex()) < 1 { err := URLPriorityValidationError{ field: "Regex", reason: "value length must be at least 1 runes", } if !all { return err } errors = append(errors, err) } // no validation rules for Value if len(errors) > 0 { return URLPriorityMultiError(errors) } return nil } // URLPriorityMultiError is an error wrapping multiple validation errors // returned by URLPriority.ValidateAll() if the designated constraints aren't met. type URLPriorityMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m URLPriorityMultiError) 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 URLPriorityMultiError) AllErrors() []error { return m } // URLPriorityValidationError is the validation error returned by // URLPriority.Validate if the designated constraints aren't met. type URLPriorityValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e URLPriorityValidationError) Field() string { return e.field } // Reason function returns reason value. func (e URLPriorityValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e URLPriorityValidationError) Cause() error { return e.cause } // Key function returns key value. func (e URLPriorityValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e URLPriorityValidationError) ErrorName() string { return "URLPriorityValidationError" } // Error satisfies the builtin error interface func (e URLPriorityValidationError) 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 %sURLPriority.%s: %s%s", key, e.field, e.reason, cause) } var _ error = URLPriorityValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = URLPriorityValidationError{} // Validate checks the field values on ApplicationPriority 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 *ApplicationPriority) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ApplicationPriority 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 // ApplicationPriorityMultiError, or nil if none found. func (m *ApplicationPriority) ValidateAll() error { return m.validate(true) } func (m *ApplicationPriority) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Value for idx, item := range m.GetUrls() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ApplicationPriorityValidationError{ field: fmt.Sprintf("Urls[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ApplicationPriorityValidationError{ field: fmt.Sprintf("Urls[%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 ApplicationPriorityValidationError{ field: fmt.Sprintf("Urls[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ApplicationPriorityMultiError(errors) } return nil } // ApplicationPriorityMultiError is an error wrapping multiple validation // errors returned by ApplicationPriority.ValidateAll() if the designated // constraints aren't met. type ApplicationPriorityMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ApplicationPriorityMultiError) 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 ApplicationPriorityMultiError) AllErrors() []error { return m } // ApplicationPriorityValidationError is the validation error returned by // ApplicationPriority.Validate if the designated constraints aren't met. type ApplicationPriorityValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ApplicationPriorityValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ApplicationPriorityValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ApplicationPriorityValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ApplicationPriorityValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ApplicationPriorityValidationError) ErrorName() string { return "ApplicationPriorityValidationError" } // Error satisfies the builtin error interface func (e ApplicationPriorityValidationError) 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 %sApplicationPriority.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ApplicationPriorityValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ApplicationPriorityValidationError{} // Validate checks the field values on Application 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 *Application) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Application 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 ApplicationMultiError, or // nil if none found. func (m *Application) ValidateAll() error { return m.validate(true) } func (m *Application) validate(all bool) error { if m == nil { return nil } var errors []error if m.GetId() < 1 { err := ApplicationValidationError{ field: "Id", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if l := utf8.RuneCountInString(m.GetName()); l < 1 || l > 1024 { err := ApplicationValidationError{ field: "Name", reason: "value length must be between 1 and 1024 runes, inclusive", } if !all { return err } errors = append(errors, err) } if uri, err := url.Parse(m.GetUrl()); err != nil { err = ApplicationValidationError{ field: "Url", reason: "value must be a valid URI", cause: err, } if !all { return err } errors = append(errors, err) } else if !uri.IsAbs() { err := ApplicationValidationError{ field: "Url", reason: "value must be absolute", } if !all { return err } errors = append(errors, err) } // no validation rules for Bio if m.GetPriority() == nil { err := ApplicationValidationError{ field: "Priority", reason: "value is required", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetPriority()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ApplicationValidationError{ field: "Priority", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ApplicationValidationError{ field: "Priority", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetPriority()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ApplicationValidationError{ field: "Priority", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return ApplicationMultiError(errors) } return nil } // ApplicationMultiError is an error wrapping multiple validation errors // returned by Application.ValidateAll() if the designated constraints aren't met. type ApplicationMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ApplicationMultiError) 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 ApplicationMultiError) AllErrors() []error { return m } // ApplicationValidationError is the validation error returned by // Application.Validate if the designated constraints aren't met. type ApplicationValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ApplicationValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ApplicationValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ApplicationValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ApplicationValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ApplicationValidationError) ErrorName() string { return "ApplicationValidationError" } // Error satisfies the builtin error interface func (e ApplicationValidationError) 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 %sApplication.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ApplicationValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ApplicationValidationError{} // Validate checks the field values on ListApplicationsRequest 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 *ListApplicationsRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListApplicationsRequest 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 // ListApplicationsRequestMultiError, or nil if none found. func (m *ListApplicationsRequest) ValidateAll() error { return m.validate(true) } func (m *ListApplicationsRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := ListApplicationsRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = ListApplicationsRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if ip := net.ParseIP(m.GetIp()); ip == nil { err := ListApplicationsRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return ListApplicationsRequestMultiError(errors) } return nil } func (m *ListApplicationsRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // ListApplicationsRequestMultiError is an error wrapping multiple validation // errors returned by ListApplicationsRequest.ValidateAll() if the designated // constraints aren't met. type ListApplicationsRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListApplicationsRequestMultiError) 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 ListApplicationsRequestMultiError) AllErrors() []error { return m } // ListApplicationsRequestValidationError is the validation error returned by // ListApplicationsRequest.Validate if the designated constraints aren't met. type ListApplicationsRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListApplicationsRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListApplicationsRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListApplicationsRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListApplicationsRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListApplicationsRequestValidationError) ErrorName() string { return "ListApplicationsRequestValidationError" } // Error satisfies the builtin error interface func (e ListApplicationsRequestValidationError) 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 %sListApplicationsRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListApplicationsRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListApplicationsRequestValidationError{} // Validate checks the field values on ListApplicationsResponse 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 *ListApplicationsResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on ListApplicationsResponse 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 // ListApplicationsResponseMultiError, or nil if none found. func (m *ListApplicationsResponse) ValidateAll() error { return m.validate(true) } func (m *ListApplicationsResponse) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetApplications() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, ListApplicationsResponseValidationError{ field: fmt.Sprintf("Applications[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, ListApplicationsResponseValidationError{ field: fmt.Sprintf("Applications[%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 ListApplicationsResponseValidationError{ field: fmt.Sprintf("Applications[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return ListApplicationsResponseMultiError(errors) } return nil } // ListApplicationsResponseMultiError is an error wrapping multiple validation // errors returned by ListApplicationsResponse.ValidateAll() if the designated // constraints aren't met. type ListApplicationsResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ListApplicationsResponseMultiError) 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 ListApplicationsResponseMultiError) AllErrors() []error { return m } // ListApplicationsResponseValidationError is the validation error returned by // ListApplicationsResponse.Validate if the designated constraints aren't met. type ListApplicationsResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ListApplicationsResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ListApplicationsResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ListApplicationsResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ListApplicationsResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ListApplicationsResponseValidationError) ErrorName() string { return "ListApplicationsResponseValidationError" } // Error satisfies the builtin error interface func (e ListApplicationsResponseValidationError) 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 %sListApplicationsResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ListApplicationsResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ListApplicationsResponseValidationError{} // Validate checks the field values on KeepAliveRequest 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 *KeepAliveRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on KeepAliveRequest 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 // KeepAliveRequestMultiError, or nil if none found. func (m *KeepAliveRequest) ValidateAll() error { return m.validate(true) } func (m *KeepAliveRequest) validate(all bool) error { if m == nil { return nil } var errors []error if _, ok := SourceType_name[int32(m.GetSourceType())]; !ok { err := KeepAliveRequestValidationError{ field: "SourceType", reason: "value must be one of the defined enum values", } if !all { return err } errors = append(errors, err) } if err := m._validateHostname(m.GetHostname()); err != nil { err = KeepAliveRequestValidationError{ field: "Hostname", reason: "value must be a valid hostname", cause: err, } if !all { return err } errors = append(errors, err) } if m.GetClusterId() < 1 { err := KeepAliveRequestValidationError{ field: "ClusterId", reason: "value must be greater than or equal to 1", } if !all { return err } errors = append(errors, err) } if m.GetIp() != "" { if ip := net.ParseIP(m.GetIp()); ip == nil { err := KeepAliveRequestValidationError{ field: "Ip", reason: "value must be a valid IP address", } if !all { return err } errors = append(errors, err) } } if len(errors) > 0 { return KeepAliveRequestMultiError(errors) } return nil } func (m *KeepAliveRequest) _validateHostname(host string) error { s := strings.ToLower(strings.TrimSuffix(host, ".")) if len(host) > 253 { return errors.New("hostname cannot exceed 253 characters") } for _, part := range strings.Split(s, ".") { if l := len(part); l == 0 || l > 63 { return errors.New("hostname part must be non-empty and cannot exceed 63 characters") } if part[0] == '-' { return errors.New("hostname parts cannot begin with hyphens") } if part[len(part)-1] == '-' { return errors.New("hostname parts cannot end with hyphens") } for _, r := range part { if (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-' { return fmt.Errorf("hostname parts can only contain alphanumeric characters or hyphens, got %q", string(r)) } } } return nil } // KeepAliveRequestMultiError is an error wrapping multiple validation errors // returned by KeepAliveRequest.ValidateAll() if the designated constraints // aren't met. type KeepAliveRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m KeepAliveRequestMultiError) 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 KeepAliveRequestMultiError) AllErrors() []error { return m } // KeepAliveRequestValidationError is the validation error returned by // KeepAliveRequest.Validate if the designated constraints aren't met. type KeepAliveRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e KeepAliveRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e KeepAliveRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e KeepAliveRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e KeepAliveRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e KeepAliveRequestValidationError) ErrorName() string { return "KeepAliveRequestValidationError" } // Error satisfies the builtin error interface func (e KeepAliveRequestValidationError) 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 %sKeepAliveRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = KeepAliveRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = KeepAliveRequestValidationError{}