@@ -56,10 +56,14 @@ public class S3AddImportsAndComments extends Recipe {
5656
5757 private static final Pattern CANNED_ACL = Pattern .compile (V1_S3_MODEL_PKG + "CannedAccessControlList" );
5858 private static final Pattern GET_OBJECT_REQUEST = Pattern .compile (V1_S3_MODEL_PKG + "GetObjectRequest" );
59+ private static final Pattern CREATE_BUCKET_REQUEST = Pattern .compile (V1_S3_MODEL_PKG + "CreateBucketRequest" );
60+ private static final Pattern DELETE_OBJECTS_RESULT = Pattern .compile (V1_S3_MODEL_PKG + "DeleteObjectsResult" );
5961 private static final Pattern INITIATE_MPU = Pattern .compile (V1_S3_MODEL_PKG + "InitiateMultipartUpload" );
6062 private static final Pattern MULTI_FACTOR_AUTH = Pattern .compile (V1_S3_MODEL_PKG + "MultiFactorAuthentication" );
6163 private static final Pattern SET_BUCKET_VERSION_REQUEST = Pattern .compile (V1_S3_MODEL_PKG
6264 + "SetBucketVersioningConfigurationRequest" );
65+ private static final Pattern BUCKET_NOTIFICATION_CONFIG = Pattern .compile (V1_S3_MODEL_PKG
66+ + "BucketNotificationConfiguration" );
6367
6468 @ Override
6569 public String getDisplayName () {
@@ -167,15 +171,15 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
167171 if (SET_PAYMENT_CONFIGURATION .matches (method )) {
168172 String comment = "Transform for setRequestPaymentConfiguration method not supported. Payer enum is a "
169173 + "separate class in v2 (not nested). Please manually migrate "
170- + "your code by update from RequestPaymentConfiguration.Payer to just Payer, and adjust "
174+ + "your code by updating from RequestPaymentConfiguration.Payer to just Payer, and adjust "
171175 + "imports and names." ;
172176 return method .withComments (createComments (comment ));
173177 }
174178
175179 if (SET_LIFECYCLE_CONFIGURATION .matches (method )) {
176180 // TODO: add the developer guide link in the comments once the doc is published.
177181 String comment = "Transform for setBucketLifecycleConfiguration method not supported. Please manually migrate"
178- + " your code by using builder pattern, update from BucketLifecycleConfiguration.Rule to "
182+ + " your code by using builder pattern, updating from BucketLifecycleConfiguration.Rule to "
179183 + "LifecycleRule, StorageClass to TransitionStorageClass, and adjust "
180184 + "imports and names." ;
181185 return method .withComments (createComments (comment ));
@@ -223,6 +227,30 @@ public J.NewClass visitNewClass(J.NewClass newClass, ExecutionContext ctx) {
223227 return newClass .withComments (createComments (comment ));
224228 }
225229
230+ if (type .isAssignableFrom (CREATE_BUCKET_REQUEST ) && newClass .getArguments ().size () == 2 ) {
231+ String comment = "Transform for createBucketRequest with region is not supported. Please manually "
232+ + "migrate your code by configuring the region as locationConstraint in "
233+ + "createBucketConfiguration in the request builder" ;
234+ return newClass .withComments (createComments (comment ));
235+ }
236+
237+ if (type .isAssignableFrom (DELETE_OBJECTS_RESULT )) {
238+ String comment = "Transform for DeleteObjectsResult class is not supported. DeletedObject class is a "
239+ + "separate class in v2 (not nested). Please manually migrate your code by updating "
240+ + "DeleteObjectsResult.DeletedObject to s3.model.DeletedObject" ;
241+ return newClass .withComments (createComments (comment ));
242+ }
243+
244+ if (type .isAssignableFrom (BUCKET_NOTIFICATION_CONFIG )) {
245+ // TODO: add the developer guide link in the comments once the doc is published.
246+ String comment = "Transform for BucketNotificationConfiguration class is not supported. "
247+ + "BucketNotificationConfiguration is renamed to NotificationConfiguration. There is no common"
248+ + " abstract class for lambdaFunction/topic/queue configurations. Use specific builders "
249+ + "instead of addConfiguration() to add configurations. Change the vararg arguments or EnumSet "
250+ + "in specific configurations constructor to List<String> in v2" ;
251+ return newClass .withComments (createComments (comment ));
252+ }
253+
226254 return newClass ;
227255 }
228256
0 commit comments