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 - PutObjectRequest setters #6001

Merged

Conversation

davidh44
Copy link
Contributor

@davidh44 davidh44 commented Apr 1, 2025

Motivation and Context

Adds support for S3 POJO transforms:
ObjectTagging, AccessControlList

Adds support for PutObjectRequest setters:
redirectLocation, tagging

Adds comments for PutObjectRequest unsupported setters:
sseCustomerKey, sseAwsKeyManagementParams, accessControlList

Adds type check for ObjectMetadata arg in putObject(bucket, key, InputStream, ObjectMetadata) , as user could pass in a non variable, e.g. empty new ObjectMetadata() or mock value any(ObjectMetadata.class)

Testing

Added end to end tests

@davidh44 davidh44 requested a review from a team as a code owner April 1, 2025 17:30
newMethodName: withBucket
- org.openrewrite.java.ChangeMethodName:
methodPattern: com.amazonaws.services.s3.model.ListObjectsV2Request withBucketName(String)
newMethodName: withBucket
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing these as they are redundant with recent recipe addition to remove in V1SetterToV2

https://github.com/aws/aws-sdk-java-v2/blob/master/v2-migration/src/main/java/software/amazon/awssdk/v2migration/V1SetterToV2.java#L112

AccessControlPolicy accessControlList = AccessControlPolicy.builder()
.build();

PutObjectRequest request = /*AWS SDK for Java v2 migration: Transform for PutObjectRequest setter accessControlList is not supported, please manually migrate your code to use the v2 setters: acl, grantReadACP, grantWriteACP - https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/model/PutObjectRequest.Builder.html#acl(java.lang.String)*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an easy way to combine all comments for a method invocation into the same comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not that I can think of. We'd have to retrieve and parse the comment. Seems better to put on separate lines especially with the links to javadocs.

Copy link

sonarqubecloud bot commented Apr 1, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@davidh44 davidh44 added this pull request to the merge queue Apr 2, 2025
Merged via the queue into master with commit 1b21f02 Apr 2, 2025
18 of 19 checks passed
@davidh44 davidh44 deleted the hdavidh/migration-tool-putObjRequest-unsupportedSetters branch April 2, 2025 20:49
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