Skip to content
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

Merged
merged 3 commits into from
Aug 16, 2023

Conversation

jhendrixMSFT
Copy link
Member

Switch to using a struct containing explicit fields instead of an interface to improve discovery and self-documentation.

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to CHANGELOG.md are included.
  • MIT license headers are included in each file.

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),
Copy link
Member Author

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.

Copy link
Contributor

@tasherif-msft tasherif-msft Aug 15, 2023

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.

Copy link
Member

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:

  1. Select an expiry type first and then
  2. Set ExpiresOn (if necessary)

@tasherif-msft
Copy link
Contributor

I'm ok with these changes. Please ignore the ci issues, these are resolved in another PR. I have gone ahead and approved

@tasherif-msft
Copy link
Contributor

/check-enforcer override

createFileOpts := &file.CreateOptions{
Expiry: expiry,
Expiry: file.CreateExpiryValues{
ExpiresOn: time.Now().Add(8 * time.Second).UTC().Format(http.TimeFormat),
Copy link
Member

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:

  1. Select an expiry type first and then
  2. Set ExpiresOn (if necessary)

sdk/storage/azdatalake/file/client_test.go Show resolved Hide resolved
sdk/storage/azdatalake/file/models.go Show resolved Hide resolved
sdk/storage/azdatalake/file/models.go Show resolved Hide resolved
@jhendrixMSFT jhendrixMSFT merged commit 40f7a7f into Azure:feature/azdatalake Aug 16, 2023
@jhendrixMSFT jhendrixMSFT deleted the azdatalake-expiry branch August 16, 2023 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants