diff --git a/api/data/lifecycle.go b/api/data/lifecycle.go index 4d0828f..cd79423 100644 --- a/api/data/lifecycle.go +++ b/api/data/lifecycle.go @@ -20,6 +20,7 @@ type ( Filter *LifecycleRuleFilter `xml:"Filter,omitempty"` ID string `xml:"ID,omitempty"` NonCurrentVersionExpiration *NonCurrentVersionExpiration `xml:"NoncurrentVersionExpiration,omitempty"` + Prefix string `xml:"Prefix,omitempty"` } AbortIncompleteMultipartUpload struct { diff --git a/api/handler/lifecycle.go b/api/handler/lifecycle.go index 905c068..85a85f9 100644 --- a/api/handler/lifecycle.go +++ b/api/handler/lifecycle.go @@ -218,6 +218,10 @@ func checkLifecycleConfiguration(ctx context.Context, cfg *data.LifecycleConfigu if err := checkLifecycleRuleFilter(rule.Filter); err != nil { return err } + + if rule.Filter != nil && rule.Filter.Prefix != "" && rule.Prefix != "" { + return fmt.Errorf("%w: rule cannot have two prefixes", apierr.GetAPIError(apierr.ErrMalformedXML)) + } } return nil