diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-18 16:23:15 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-18 16:23:15 -0700 |
| commit | 2ad4a924be2a90a517c56eca6d87e94fed97c3fd (patch) | |
| tree | 3e7a00316d6319be5f1743bdf9df85dcd6bb1fa1 /weed/s3api/s3api_object_retention.go | |
| parent | 1e1806c7a1d79dda607e4802aef06b354db8c888 (diff) | |
| download | seaweedfs-2ad4a924be2a90a517c56eca6d87e94fed97c3fd.tar.xz seaweedfs-2ad4a924be2a90a517c56eca6d87e94fed97c3fd.zip | |
fix tests
Diffstat (limited to 'weed/s3api/s3api_object_retention.go')
| -rw-r--r-- | weed/s3api/s3api_object_retention.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/weed/s3api/s3api_object_retention.go b/weed/s3api/s3api_object_retention.go index 93bd618d3..10d2a6bba 100644 --- a/weed/s3api/s3api_object_retention.go +++ b/weed/s3api/s3api_object_retention.go @@ -189,19 +189,19 @@ func validateLegalHold(legalHold *ObjectLegalHold) error { func validateObjectLockConfiguration(config *ObjectLockConfiguration) error { // ObjectLockEnabled is required for bucket-level configuration if config.ObjectLockEnabled == "" { - return ErrInvalidRetentionMode + return ErrObjectLockConfigurationMissingEnabled } // Validate ObjectLockEnabled value if config.ObjectLockEnabled != s3_constants.ObjectLockEnabled { // ObjectLockEnabled can only be 'Enabled', any other value (including 'Disabled') is malformed XML - return ErrInvalidRetentionMode + return ErrInvalidObjectLockEnabledValue } // Validate Rule if present if config.Rule != nil { if config.Rule.DefaultRetention == nil { - return ErrInvalidRetentionPeriod + return ErrRuleMissingDefaultRetention } return validateDefaultRetention(config.Rule.DefaultRetention) } @@ -213,30 +213,30 @@ func validateObjectLockConfiguration(config *ObjectLockConfiguration) error { func validateDefaultRetention(retention *DefaultRetention) error { // Mode is required if retention.Mode == "" { - return ErrInvalidRetentionMode + return ErrDefaultRetentionMissingMode } // Mode must be valid if retention.Mode != s3_constants.RetentionModeGovernance && retention.Mode != s3_constants.RetentionModeCompliance { - return ErrInvalidRetentionMode + return ErrInvalidDefaultRetentionMode } // Exactly one of Days or Years must be specified if retention.Days == 0 && retention.Years == 0 { - return ErrInvalidRetentionPeriod + return ErrDefaultRetentionMissingPeriod } if retention.Days > 0 && retention.Years > 0 { - return ErrBothDaysAndYearsSpecified + return ErrDefaultRetentionBothDaysAndYears } // Validate ranges if retention.Days < 0 || retention.Days > MaxRetentionDays { - return ErrInvalidRetentionPeriod + return ErrDefaultRetentionDaysOutOfRange } if retention.Years < 0 || retention.Years > MaxRetentionYears { - return ErrInvalidRetentionPeriod + return ErrDefaultRetentionYearsOutOfRange } return nil |
