fix: lifecycle-expiration validation bug (#10327)

This commit is contained in:
KevinSmile
2020-08-25 04:56:50 +08:00
committed by GitHub
parent c097ce9c32
commit 5f7bd2b1da
4 changed files with 7 additions and 11 deletions

View File

@@ -46,10 +46,9 @@ type Rule struct {
}
var (
errInvalidRuleID = Errorf("ID length is limited to 255 characters")
errEmptyRuleStatus = Errorf("Status should not be empty")
errInvalidRuleStatus = Errorf("Status must be set to either Enabled or Disabled")
errMissingExpirationAction = Errorf("No expiration action found")
errInvalidRuleID = Errorf("ID length is limited to 255 characters")
errEmptyRuleStatus = Errorf("Status should not be empty")
errInvalidRuleStatus = Errorf("Status must be set to either Enabled or Disabled")
)
// generates random UUID
@@ -94,10 +93,7 @@ func (r Rule) validateStatus() error {
}
func (r Rule) validateAction() error {
if r.Expiration == (Expiration{}) {
return errMissingExpirationAction
}
return nil
return r.Expiration.Validate()
}
func (r Rule) validateFilter() error {