-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to set NewerNoncurrentVersions to Lifecycle #1467
base: master
Are you sure you want to change the base?
Add option to set NewerNoncurrentVersions to Lifecycle #1467
Conversation
def __init__(self, noncurrent_days: int | None = None): | ||
def __init__(self, | ||
noncurrent_days: int | None = None, | ||
noncurrent_versions: int | None = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Rename
noncurrent_versions
asnewer_noncurrent_versions
everywhere - Add validation here like
if noncurrent_days is None and newer_noncurrent_versions is None:
raise ValueError("either noncurrent_days or newer_noncurrent_versions must be set")
|
||
if not self._noncurrent_days and not self._noncurrent_versions: | ||
raise ValueError("Either one value must be set") | ||
|
||
if self._noncurrent_versions and self._noncurrent_days: | ||
raise ValueError("Only one value can be set") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this check
SubElement(element, "NoncurrentDays", | ||
str(self._noncurrent_days)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SubElement(element, "NoncurrentDays", | |
str(self._noncurrent_days)) | |
SubElement(element, "NoncurrentDays", str(self._noncurrent_days)) |
if self._noncurrent_versions: | ||
SubElement(element, "NewerNoncurrentVersions", | ||
str(self._noncurrent_versions)) | ||
|
||
return element | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newer_noncurrent_versions
to class NoncurrentVersionTransition
too
Needed this functionality for myself and couldn't find it in your repo, so I added it.
lifecyceconfig.NoncurrentVersionExpiration
only allows either_noncurrent_days
or_noncurrent_versions
to be set, but not both at the same time. I don't know minIO well enough to know whether it would be possible to set both at the same time. Feel free to make changes.