summaryrefslogtreecommitdiff
path: root/vendor/github.com/minio/minio-go/v7/pkg/lifecycle
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-12-05 11:46:40 +0100
committerLibravatar GitHub <noreply@github.com>2023-12-05 11:46:40 +0100
commitbdc43a98da7cde6a297c1e480ff6c2961c8da3e1 (patch)
tree5e83ec5554c92a3f3c2fb74e006fd9ec19fae13b /vendor/github.com/minio/minio-go/v7/pkg/lifecycle
parent[chore]: Bump golang.org/x/crypto from 0.15.0 to 0.16.0 (#2413) (diff)
downloadgotosocial-bdc43a98da7cde6a297c1e480ff6c2961c8da3e1.tar.xz
[chore]: Bump github.com/minio/minio-go/v7 from 7.0.63 to 7.0.65 (#2415)
Bumps [github.com/minio/minio-go/v7](https://github.com/minio/minio-go) from 7.0.63 to 7.0.65. - [Release notes](https://github.com/minio/minio-go/releases) - [Commits](https://github.com/minio/minio-go/compare/v7.0.63...v7.0.65) --- updated-dependencies: - dependency-name: github.com/minio/minio-go/v7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/pkg/lifecycle')
-rw-r--r--vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go48
1 files changed, 35 insertions, 13 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go b/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go
index 830061b8e..c52f78c3f 100644
--- a/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go
+++ b/vendor/github.com/minio/minio-go/v7/pkg/lifecycle/lifecycle.go
@@ -211,35 +211,43 @@ func (t Transition) MarshalXML(en *xml.Encoder, startElement xml.StartElement) e
// And And Rule for LifecycleTag, to be used in LifecycleRuleFilter
type And struct {
- XMLName xml.Name `xml:"And" json:"-"`
- Prefix string `xml:"Prefix" json:"Prefix,omitempty"`
- Tags []Tag `xml:"Tag" json:"Tags,omitempty"`
+ XMLName xml.Name `xml:"And" json:"-"`
+ Prefix string `xml:"Prefix" json:"Prefix,omitempty"`
+ Tags []Tag `xml:"Tag" json:"Tags,omitempty"`
+ ObjectSizeLessThan int64 `xml:"ObjectSizeLessThan,omitempty" json:"ObjectSizeLessThan,omitempty"`
+ ObjectSizeGreaterThan int64 `xml:"ObjectSizeGreaterThan,omitempty" json:"ObjectSizeGreaterThan,omitempty"`
}
// IsEmpty returns true if Tags field is null
func (a And) IsEmpty() bool {
- return len(a.Tags) == 0 && a.Prefix == ""
+ return len(a.Tags) == 0 && a.Prefix == "" &&
+ a.ObjectSizeLessThan == 0 && a.ObjectSizeGreaterThan == 0
}
// Filter will be used in selecting rule(s) for lifecycle configuration
type Filter struct {
- XMLName xml.Name `xml:"Filter" json:"-"`
- And And `xml:"And,omitempty" json:"And,omitempty"`
- Prefix string `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
- Tag Tag `xml:"Tag,omitempty" json:"Tag,omitempty"`
+ XMLName xml.Name `xml:"Filter" json:"-"`
+ And And `xml:"And,omitempty" json:"And,omitempty"`
+ Prefix string `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
+ Tag Tag `xml:"Tag,omitempty" json:"Tag,omitempty"`
+ ObjectSizeLessThan int64 `xml:"ObjectSizeLessThan,omitempty" json:"ObjectSizeLessThan,omitempty"`
+ ObjectSizeGreaterThan int64 `xml:"ObjectSizeGreaterThan,omitempty" json:"ObjectSizeGreaterThan,omitempty"`
}
// IsNull returns true if all Filter fields are empty.
func (f Filter) IsNull() bool {
- return f.Tag.IsEmpty() && f.And.IsEmpty() && f.Prefix == ""
+ return f.Tag.IsEmpty() && f.And.IsEmpty() && f.Prefix == "" &&
+ f.ObjectSizeLessThan == 0 && f.ObjectSizeGreaterThan == 0
}
// MarshalJSON customizes json encoding by removing empty values.
func (f Filter) MarshalJSON() ([]byte, error) {
type filter struct {
- And *And `json:"And,omitempty"`
- Prefix string `json:"Prefix,omitempty"`
- Tag *Tag `json:"Tag,omitempty"`
+ And *And `json:"And,omitempty"`
+ Prefix string `json:"Prefix,omitempty"`
+ Tag *Tag `json:"Tag,omitempty"`
+ ObjectSizeLessThan int64 `json:"ObjectSizeLessThan,omitempty"`
+ ObjectSizeGreaterThan int64 `json:"ObjectSizeGreaterThan,omitempty"`
}
newf := filter{
@@ -251,6 +259,8 @@ func (f Filter) MarshalJSON() ([]byte, error) {
if !f.And.IsEmpty() {
newf.And = &f.And
}
+ newf.ObjectSizeLessThan = f.ObjectSizeLessThan
+ newf.ObjectSizeGreaterThan = f.ObjectSizeGreaterThan
return json.Marshal(newf)
}
@@ -271,7 +281,19 @@ func (f Filter) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
return err
}
default:
- // Always print Prefix field when both And & Tag are empty
+ if f.ObjectSizeLessThan > 0 {
+ if err := e.EncodeElement(f.ObjectSizeLessThan, xml.StartElement{Name: xml.Name{Local: "ObjectSizeLessThan"}}); err != nil {
+ return err
+ }
+ break
+ }
+ if f.ObjectSizeGreaterThan > 0 {
+ if err := e.EncodeElement(f.ObjectSizeGreaterThan, xml.StartElement{Name: xml.Name{Local: "ObjectSizeGreaterThan"}}); err != nil {
+ return err
+ }
+ break
+ }
+ // Print empty Prefix field only when everything else is empty
if err := e.EncodeElement(f.Prefix, xml.StartElement{Name: xml.Name{Local: "Prefix"}}); err != nil {
return err
}