// Code generated by protoc-gen-validate. DO NOT EDIT. // source: envoy/config/metrics/v2/stats.proto package metricsv2 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 StatsSink 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 *StatsSink) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatsSink 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 StatsSinkMultiError, or nil // if none found. func (m *StatsSink) ValidateAll() error { return m.validate(true) } func (m *StatsSink) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Name switch v := m.ConfigType.(type) { case *StatsSink_Config: if v == nil { err := StatsSinkValidationError{ field: "ConfigType", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetConfig()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsSinkValidationError{ field: "Config", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsSinkValidationError{ field: "Config", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsSinkValidationError{ field: "Config", reason: "embedded message failed validation", cause: err, } } } case *StatsSink_TypedConfig: if v == nil { err := StatsSinkValidationError{ field: "ConfigType", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if all { switch v := interface{}(m.GetTypedConfig()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsSinkValidationError{ field: "TypedConfig", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsSinkValidationError{ field: "TypedConfig", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsSinkValidationError{ field: "TypedConfig", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if len(errors) > 0 { return StatsSinkMultiError(errors) } return nil } // StatsSinkMultiError is an error wrapping multiple validation errors returned // by StatsSink.ValidateAll() if the designated constraints aren't met. type StatsSinkMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatsSinkMultiError) 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 StatsSinkMultiError) AllErrors() []error { return m } // StatsSinkValidationError is the validation error returned by // StatsSink.Validate if the designated constraints aren't met. type StatsSinkValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatsSinkValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatsSinkValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatsSinkValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatsSinkValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatsSinkValidationError) ErrorName() string { return "StatsSinkValidationError" } // Error satisfies the builtin error interface func (e StatsSinkValidationError) 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 %sStatsSink.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatsSinkValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatsSinkValidationError{} // Validate checks the field values on StatsConfig 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 *StatsConfig) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatsConfig 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 StatsConfigMultiError, or // nil if none found. func (m *StatsConfig) ValidateAll() error { return m.validate(true) } func (m *StatsConfig) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetStatsTags() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsConfigValidationError{ field: fmt.Sprintf("StatsTags[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsConfigValidationError{ field: fmt.Sprintf("StatsTags[%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 StatsConfigValidationError{ field: fmt.Sprintf("StatsTags[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if all { switch v := interface{}(m.GetUseAllDefaultTags()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsConfigValidationError{ field: "UseAllDefaultTags", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsConfigValidationError{ field: "UseAllDefaultTags", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetUseAllDefaultTags()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsConfigValidationError{ field: "UseAllDefaultTags", reason: "embedded message failed validation", cause: err, } } } if all { switch v := interface{}(m.GetStatsMatcher()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsConfigValidationError{ field: "StatsMatcher", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsConfigValidationError{ field: "StatsMatcher", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetStatsMatcher()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsConfigValidationError{ field: "StatsMatcher", reason: "embedded message failed validation", cause: err, } } } if len(errors) > 0 { return StatsConfigMultiError(errors) } return nil } // StatsConfigMultiError is an error wrapping multiple validation errors // returned by StatsConfig.ValidateAll() if the designated constraints aren't met. type StatsConfigMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatsConfigMultiError) 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 StatsConfigMultiError) AllErrors() []error { return m } // StatsConfigValidationError is the validation error returned by // StatsConfig.Validate if the designated constraints aren't met. type StatsConfigValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatsConfigValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatsConfigValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatsConfigValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatsConfigValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatsConfigValidationError) ErrorName() string { return "StatsConfigValidationError" } // Error satisfies the builtin error interface func (e StatsConfigValidationError) 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 %sStatsConfig.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatsConfigValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatsConfigValidationError{} // Validate checks the field values on StatsMatcher 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 *StatsMatcher) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatsMatcher 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 StatsMatcherMultiError, or // nil if none found. func (m *StatsMatcher) ValidateAll() error { return m.validate(true) } func (m *StatsMatcher) validate(all bool) error { if m == nil { return nil } var errors []error oneofStatsMatcherPresent := false switch v := m.StatsMatcher.(type) { case *StatsMatcher_RejectAll: if v == nil { err := StatsMatcherValidationError{ field: "StatsMatcher", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofStatsMatcherPresent = true // no validation rules for RejectAll case *StatsMatcher_ExclusionList: if v == nil { err := StatsMatcherValidationError{ field: "StatsMatcher", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofStatsMatcherPresent = true if all { switch v := interface{}(m.GetExclusionList()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsMatcherValidationError{ field: "ExclusionList", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsMatcherValidationError{ field: "ExclusionList", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetExclusionList()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsMatcherValidationError{ field: "ExclusionList", reason: "embedded message failed validation", cause: err, } } } case *StatsMatcher_InclusionList: if v == nil { err := StatsMatcherValidationError{ field: "StatsMatcher", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofStatsMatcherPresent = true if all { switch v := interface{}(m.GetInclusionList()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsMatcherValidationError{ field: "InclusionList", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsMatcherValidationError{ field: "InclusionList", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetInclusionList()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsMatcherValidationError{ field: "InclusionList", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofStatsMatcherPresent { err := StatsMatcherValidationError{ field: "StatsMatcher", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatsMatcherMultiError(errors) } return nil } // StatsMatcherMultiError is an error wrapping multiple validation errors // returned by StatsMatcher.ValidateAll() if the designated constraints aren't met. type StatsMatcherMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatsMatcherMultiError) 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 StatsMatcherMultiError) AllErrors() []error { return m } // StatsMatcherValidationError is the validation error returned by // StatsMatcher.Validate if the designated constraints aren't met. type StatsMatcherValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatsMatcherValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatsMatcherValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatsMatcherValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatsMatcherValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatsMatcherValidationError) ErrorName() string { return "StatsMatcherValidationError" } // Error satisfies the builtin error interface func (e StatsMatcherValidationError) 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 %sStatsMatcher.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatsMatcherValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatsMatcherValidationError{} // Validate checks the field values on TagSpecifier 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 *TagSpecifier) Validate() error { return m.validate(false) } // ValidateAll checks the field values on TagSpecifier 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 TagSpecifierMultiError, or // nil if none found. func (m *TagSpecifier) ValidateAll() error { return m.validate(true) } func (m *TagSpecifier) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for TagName switch v := m.TagValue.(type) { case *TagSpecifier_Regex: if v == nil { err := TagSpecifierValidationError{ field: "TagValue", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } if len(m.GetRegex()) > 1024 { err := TagSpecifierValidationError{ field: "Regex", reason: "value length must be at most 1024 bytes", } if !all { return err } errors = append(errors, err) } case *TagSpecifier_FixedValue: if v == nil { err := TagSpecifierValidationError{ field: "TagValue", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } // no validation rules for FixedValue default: _ = v // ensures v is used } if len(errors) > 0 { return TagSpecifierMultiError(errors) } return nil } // TagSpecifierMultiError is an error wrapping multiple validation errors // returned by TagSpecifier.ValidateAll() if the designated constraints aren't met. type TagSpecifierMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m TagSpecifierMultiError) 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 TagSpecifierMultiError) AllErrors() []error { return m } // TagSpecifierValidationError is the validation error returned by // TagSpecifier.Validate if the designated constraints aren't met. type TagSpecifierValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e TagSpecifierValidationError) Field() string { return e.field } // Reason function returns reason value. func (e TagSpecifierValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e TagSpecifierValidationError) Cause() error { return e.cause } // Key function returns key value. func (e TagSpecifierValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e TagSpecifierValidationError) ErrorName() string { return "TagSpecifierValidationError" } // Error satisfies the builtin error interface func (e TagSpecifierValidationError) 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 %sTagSpecifier.%s: %s%s", key, e.field, e.reason, cause) } var _ error = TagSpecifierValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = TagSpecifierValidationError{} // Validate checks the field values on StatsdSink 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 *StatsdSink) Validate() error { return m.validate(false) } // ValidateAll checks the field values on StatsdSink 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 StatsdSinkMultiError, or // nil if none found. func (m *StatsdSink) ValidateAll() error { return m.validate(true) } func (m *StatsdSink) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Prefix oneofStatsdSpecifierPresent := false switch v := m.StatsdSpecifier.(type) { case *StatsdSink_Address: if v == nil { err := StatsdSinkValidationError{ field: "StatsdSpecifier", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofStatsdSpecifierPresent = true if all { switch v := interface{}(m.GetAddress()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, StatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, StatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return StatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, } } } case *StatsdSink_TcpClusterName: if v == nil { err := StatsdSinkValidationError{ field: "StatsdSpecifier", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofStatsdSpecifierPresent = true // no validation rules for TcpClusterName default: _ = v // ensures v is used } if !oneofStatsdSpecifierPresent { err := StatsdSinkValidationError{ field: "StatsdSpecifier", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return StatsdSinkMultiError(errors) } return nil } // StatsdSinkMultiError is an error wrapping multiple validation errors // returned by StatsdSink.ValidateAll() if the designated constraints aren't met. type StatsdSinkMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m StatsdSinkMultiError) 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 StatsdSinkMultiError) AllErrors() []error { return m } // StatsdSinkValidationError is the validation error returned by // StatsdSink.Validate if the designated constraints aren't met. type StatsdSinkValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e StatsdSinkValidationError) Field() string { return e.field } // Reason function returns reason value. func (e StatsdSinkValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e StatsdSinkValidationError) Cause() error { return e.cause } // Key function returns key value. func (e StatsdSinkValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e StatsdSinkValidationError) ErrorName() string { return "StatsdSinkValidationError" } // Error satisfies the builtin error interface func (e StatsdSinkValidationError) 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 %sStatsdSink.%s: %s%s", key, e.field, e.reason, cause) } var _ error = StatsdSinkValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = StatsdSinkValidationError{} // Validate checks the field values on DogStatsdSink 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 *DogStatsdSink) Validate() error { return m.validate(false) } // ValidateAll checks the field values on DogStatsdSink 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 DogStatsdSinkMultiError, or // nil if none found. func (m *DogStatsdSink) ValidateAll() error { return m.validate(true) } func (m *DogStatsdSink) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Prefix oneofDogStatsdSpecifierPresent := false switch v := m.DogStatsdSpecifier.(type) { case *DogStatsdSink_Address: if v == nil { err := DogStatsdSinkValidationError{ field: "DogStatsdSpecifier", reason: "oneof value cannot be a typed-nil", } if !all { return err } errors = append(errors, err) } oneofDogStatsdSpecifierPresent = true if all { switch v := interface{}(m.GetAddress()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, DogStatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, DogStatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DogStatsdSinkValidationError{ field: "Address", reason: "embedded message failed validation", cause: err, } } } default: _ = v // ensures v is used } if !oneofDogStatsdSpecifierPresent { err := DogStatsdSinkValidationError{ field: "DogStatsdSpecifier", reason: "value is required", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return DogStatsdSinkMultiError(errors) } return nil } // DogStatsdSinkMultiError is an error wrapping multiple validation errors // returned by DogStatsdSink.ValidateAll() if the designated constraints // aren't met. type DogStatsdSinkMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m DogStatsdSinkMultiError) 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 DogStatsdSinkMultiError) AllErrors() []error { return m } // DogStatsdSinkValidationError is the validation error returned by // DogStatsdSink.Validate if the designated constraints aren't met. type DogStatsdSinkValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DogStatsdSinkValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DogStatsdSinkValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DogStatsdSinkValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DogStatsdSinkValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DogStatsdSinkValidationError) ErrorName() string { return "DogStatsdSinkValidationError" } // Error satisfies the builtin error interface func (e DogStatsdSinkValidationError) 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 %sDogStatsdSink.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DogStatsdSinkValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DogStatsdSinkValidationError{} // Validate checks the field values on HystrixSink 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 *HystrixSink) Validate() error { return m.validate(false) } // ValidateAll checks the field values on HystrixSink 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 HystrixSinkMultiError, or // nil if none found. func (m *HystrixSink) ValidateAll() error { return m.validate(true) } func (m *HystrixSink) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for NumBuckets if len(errors) > 0 { return HystrixSinkMultiError(errors) } return nil } // HystrixSinkMultiError is an error wrapping multiple validation errors // returned by HystrixSink.ValidateAll() if the designated constraints aren't met. type HystrixSinkMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m HystrixSinkMultiError) 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 HystrixSinkMultiError) AllErrors() []error { return m } // HystrixSinkValidationError is the validation error returned by // HystrixSink.Validate if the designated constraints aren't met. type HystrixSinkValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e HystrixSinkValidationError) Field() string { return e.field } // Reason function returns reason value. func (e HystrixSinkValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e HystrixSinkValidationError) Cause() error { return e.cause } // Key function returns key value. func (e HystrixSinkValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e HystrixSinkValidationError) ErrorName() string { return "HystrixSinkValidationError" } // Error satisfies the builtin error interface func (e HystrixSinkValidationError) 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 %sHystrixSink.%s: %s%s", key, e.field, e.reason, cause) } var _ error = HystrixSinkValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = HystrixSinkValidationError{}