mirror of
https://github.com/minio/minio.git
synced 2025-02-23 11:32:32 -05:00
Add DeleteAll with expiry days non zero value only (#19095)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
This commit is contained in:
parent
92180bc793
commit
56887f3208
@ -28,6 +28,7 @@ var (
|
|||||||
errLifecycleInvalidExpiration = Errorf("Exactly one of Days (positive integer) or Date (positive ISO 8601 format) should be present inside Expiration.")
|
errLifecycleInvalidExpiration = Errorf("Exactly one of Days (positive integer) or Date (positive ISO 8601 format) should be present inside Expiration.")
|
||||||
errLifecycleInvalidDeleteMarker = Errorf("Delete marker cannot be specified with Days or Date in a Lifecycle Expiration Policy")
|
errLifecycleInvalidDeleteMarker = Errorf("Delete marker cannot be specified with Days or Date in a Lifecycle Expiration Policy")
|
||||||
errLifecycleDateNotMidnight = Errorf("'Date' must be at midnight GMT")
|
errLifecycleDateNotMidnight = Errorf("'Date' must be at midnight GMT")
|
||||||
|
errLifecycleInvalidDeleteAll = Errorf("Days (positive integer) should be present inside Expiration with ExpiredObjectAllVersions.")
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExpirationDays is a type alias to unmarshal Days in Expiration
|
// ExpirationDays is a type alias to unmarshal Days in Expiration
|
||||||
@ -186,6 +187,11 @@ func (e Expiration) Validate() error {
|
|||||||
return errLifecycleInvalidExpiration
|
return errLifecycleInvalidExpiration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeleteAll set without expiration days
|
||||||
|
if e.DeleteAll.set && e.IsDaysNull() {
|
||||||
|
return errLifecycleInvalidDeleteAll
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func TestInvalidExpiration(t *testing.T) {
|
|||||||
<Date>2019-04-20T00:00:00Z</Date>
|
<Date>2019-04-20T00:00:00Z</Date>
|
||||||
<ExpiredObjectAllVersions>true</ExpiredObjectAllVersions>
|
<ExpiredObjectAllVersions>true</ExpiredObjectAllVersions>
|
||||||
</Expiration>`,
|
</Expiration>`,
|
||||||
expectedErr: nil,
|
expectedErr: errLifecycleInvalidDeleteAll,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i, tc := range validationTestCases {
|
for i, tc := range validationTestCases {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user