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

Migration tool ObjectMetadata transforms #5970

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davidh44
Copy link
Contributor

@davidh44 davidh44 commented Mar 18, 2025

Motivation and Context

Add transforms for ObjectMetadata setters, moving them to PutObjectRequest, and pass ContentLength to RequestBody

ContentLength
ContentEncoding
ContentType
ContentLanguage
CacheControl
ContentDisposition
ContentMD5
SSEAlgorithm
ServerSideEncryption
SSECustomerKeyMd5
BucketKeyEnabled
HttpExpiresDate

TODO in follow up PRs:

  • Remove ObjectMetadata instantiation (transformed to HeadObjectRespoonse)

Modifications

Updated JavaIsoVisitor to JavaVisitor in S3PutObjectRequestToV2 in order to return a statement:

from:
request.setMetadata(metadata);

to:
request = request.toBuilder().setXX(..).setYY(..).build();

Testing

added end to end tests

@davidh44 davidh44 requested a review from a team as a code owner March 18, 2025 17:56
Comment on lines 58 to 69

/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - expirationTimeRuleId - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.expirationTimeRuleId("expirationTimeRuleId");
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - ongoingRestore - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.ongoingRestore(false);
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - requesterCharged - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.requesterCharged(false);

/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - lastModified - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.lastModified(dateVal);
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - httpExpiresDate - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.httpExpiresDate(dateVal);
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - expirationTime - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.expirationTime(dateVal);
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - restoreExpirationTime - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.restoreExpirationTime(dateVal);

/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - header - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.header("key", "val");
/*AWS SDK for Java v2 migration: Transform for ObjectMetadata setter - addUserMetadata - is not supported, please manually migrate the code by setting it on the v2 PutObjectRequest.*/metadata.addUserMetadata("a", "b");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very hard to read, can we put the comment on its own line above the line of code it's describing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but then we can't maintain the spacing of the code itself, it would begin on the next line with no indentation. We are doing the same for other comments as well. wdyt?

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
6.4% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants