-
Notifications
You must be signed in to change notification settings - Fork 850
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
Refactor handling of setting file expiry policy #21378
Refactor handling of setting file expiry policy #21378
Conversation
Switch to using a struct containing explicit fields instead of an interface to improve discovery and self-documentation.
createFileOpts := &file.CreateOptions{ | ||
Expiry: expiry, | ||
Expiry: file.CreateExpiryValues{ | ||
ExpiresOn: time.Now().Add(8 * time.Second).UTC().Format(http.TimeFormat), |
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.
Note that this does put the onus on the developer to get this correct. We could add helper funcs to create a well-formed instance. Maybe we do this later based on customer feedback.
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.
Yea, let's see customer feedback. I will include examples of this in my PR after we merge this PR.
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.
I would just reverse the initialization order because the mental model is:
- Select an expiry type first and then
- Set ExpiresOn (if necessary)
I'm ok with these changes. Please ignore the ci issues, these are resolved in another PR. I have gone ahead and approved |
/check-enforcer override |
createFileOpts := &file.CreateOptions{ | ||
Expiry: expiry, | ||
Expiry: file.CreateExpiryValues{ | ||
ExpiresOn: time.Now().Add(8 * time.Second).UTC().Format(http.TimeFormat), |
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.
I would just reverse the initialization order because the mental model is:
- Select an expiry type first and then
- Set ExpiresOn (if necessary)
Switch to using a struct containing explicit fields instead of an interface to improve discovery and self-documentation.