Rebuild immutable AWS SDK v2 models that v1 code mutated

Apache 2.0

Runs after software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2. A v1 withX(..) or setX(..) statement on a request or model object becomes r = r.toBuilder().x(..).build(), and a withX(..) inside an expression becomes r.toBuilder().x(..).build(). A private void method that rebuilds a parameter it was given returns the rebuilt value, and its callers in the class store it back, so the change still reaches them. A non-private method that set fields of a v1 request parameter does the same with its callers anywhere in the repository; a caller that passes an expression rather than a variable is marked, since there is nothing to store the rebuilt value in.

org.openrewrite.aws.sdk.CompleteV2ModelMutations
mod run . --recipe=org.openrewrite.aws.sdk.CompleteV2ModelMutations

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.