Add a generic Walk()'er to list a bucket, optinally prefix (#9026)

This generic Walk() is used by likes of Lifecyle, or
KMS to rotate keys or any other functionality which
relies on this functionality.
This commit is contained in:
Harshavardhana
2020-02-25 21:22:28 +05:30
committed by GitHub
parent ece0d4ac53
commit 23a8411732
24 changed files with 296 additions and 140 deletions

View File

@@ -21,11 +21,20 @@ import (
"encoding/xml"
)
// Status represents lifecycle configuration status
type Status string
// Supported status types
const (
Enabled Status = "Enabled"
Disabled Status = "Disabled"
)
// Rule - a rule for lifecycle configuration.
type Rule struct {
XMLName xml.Name `xml:"Rule"`
ID string `xml:"ID,omitempty"`
Status string `xml:"Status"`
Status Status `xml:"Status"`
Filter Filter `xml:"Filter,omitempty"`
Expiration Expiration `xml:"Expiration,omitempty"`
Transition Transition `xml:"Transition,omitempty"`
@@ -58,7 +67,7 @@ func (r Rule) validateStatus() error {
}
// Status must be one of Enabled or Disabled
if r.Status != "Enabled" && r.Status != "Disabled" {
if r.Status != Enabled && r.Status != Disabled {
return errInvalidRuleStatus
}
return nil