Skip to content

Support HTTP settings mapping #5308

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

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions migration-tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
<artifactId>sdk-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ public static boolean isV2ClientBuilder(JavaType type) {
}

public static boolean isEligibleToConvertToBuilder(JavaType.FullyQualified type) {
return type != null && (isV2ModelClass(type) || isV2ClientClass(type) ||
isV2CoreClassesWithBuilder(type.getFullyQualifiedName()));
if (type == null) {
return false;
}
return isV2ModelClass(type) || isV2ClientClass(type) || isV2CoreClassesWithBuilder(type.getFullyQualifiedName());
}

public static boolean isEligibleToConvertToStaticFactory(JavaType.FullyQualified type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ recipeList:
- org.openrewrite.java.ChangeMethodName:
methodPattern: software.amazon.awssdk.auth.credentials.ContainerCredentialsProvider getCredentials
newMethodName: resolveCredentials
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: com.amazonaws.auth.WebIdentityTokenCredentialsProvider
newFullyQualifiedTypeName: software.amazon.awssdk.auth.credentials.WebIdentityTokenFileCredentialsProvider

- org.openrewrite.java.ChangeMethodName:
methodPattern: com.amazonaws.auth.InstanceProfileCredentialsProvider getInstance
Expand All @@ -124,7 +127,7 @@ recipeList:
newMethodName: resolveCredentials

- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: com.amazonaws.auth.WebIdentityFederationSessionCredentialsProvider
oldFullyQualifiedTypeName: com.amazonaws.auth.STSAssumeRoleWithWebIdentitySessionCredentialsProvider
newFullyQualifiedTypeName: software.amazon.awssdk.services.sts.auth.StsAssumeRoleWithWebIdentityCredentialsProvider
- org.openrewrite.java.ChangeMethodName:
methodPattern: software.amazon.awssdk.auth.credentials.StsAssumeRoleWithWebIdentityCredentialsProvider getCredentials
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# permissions and limitations under the License.
#
## TODO: support retry policy, signer and throttledRetries
## TODO: handle http settings renaming for async HTTP client
---
type: specs.openrewrite.org/v1beta/recipe
name: software.amazon.awssdk.ChangeConfigTypes
Expand All @@ -36,6 +37,23 @@ recipeList:
- software.amazon.awssdk.migration.internal.recipe.NumberToDuration:
methodPattern: com.amazonaws.ClientConfiguration withApiCallTimeout(int)

- software.amazon.awssdk.migration.internal.recipe.NumberToDuration:
methodPattern: com.amazonaws.ClientConfiguration withConnectionTimeout(int)
- software.amazon.awssdk.migration.internal.recipe.NumberToDuration:
methodPattern: com.amazonaws.ClientConfiguration withSocketTimeout(int)

- org.openrewrite.java.ChangeMethodName:
methodPattern: com.amazonaws.ClientConfiguration withConnectionMaxIdleMillis(long)
newMethodName: withConnectionMaxIdleTime
- software.amazon.awssdk.migration.internal.recipe.NumberToDuration:
methodPattern: com.amazonaws.ClientConfiguration withConnectionMaxIdleTime(long)

- org.openrewrite.java.ChangeMethodName:
methodPattern: com.amazonaws.ClientConfiguration withConnectionTTL(long)
newMethodName: withConnectionTimeToLive
- software.amazon.awssdk.migration.internal.recipe.NumberToDuration:
methodPattern: com.amazonaws.ClientConfiguration withConnectionTimeToLive(long)

- org.openrewrite.java.ChangeMethodName:
methodPattern: com.amazonaws.ClientConfiguration withRetryMode(..)
newMethodName: withRetryPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ recipeList:
- software.amazon.awssdk.migration.recipe.V1BuilderVariationsToV2Builder
- software.amazon.awssdk.migration.recipe.NewClassToBuilderPattern
- software.amazon.awssdk.migration.recipe.NewClassToStaticFactory
- software.amazon.awssdk.migration.internal.recipe.V1GetterToV2
- software.amazon.awssdk.migration.internal.recipe.V1GetterToV2
- software.amazon.awssdk.migration.internal.recipe.HttpSettingsToHttpClient
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ name: software.amazon.awssdk.UpgradeSdkDependencies
displayName: Change Maven dependency groupId, artifactId and/or the version example
recipeList:

- org.openrewrite.maven.AddDependency:
groupId: software.amazon.awssdk
artifactId: apache-client
version: 2.23.16-SNAPSHOT
- org.openrewrite.maven.AddDependency:
groupId: software.amazon.awssdk
artifactId: netty-nio-client
version: 2.23.16-SNAPSHOT
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: com.amazonaws
oldArtifactId: aws-java-sdk-bom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def write_bom_recipe(f, version):
newVersion: {0}'''
f.write(change_bom.format(version))

def add_dependencies(f, version):
add_dependencies_str = '''
- org.openrewrite.maven.AddDependency:
groupId: software.amazon.awssdk
artifactId: apache-client
version: {0}
- org.openrewrite.maven.AddDependency:
groupId: software.amazon.awssdk
artifactId: netty-nio-client
version: {0}'''
f.write(add_dependencies_str.format(version))

def write_cloudwatch_recipe(f, version):
change_bom = '''
- org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId:
Expand All @@ -75,6 +87,7 @@ def write_recipe_yml_file(service_mapping):
with open(filename, 'w') as f:
write_copy_right_header(f)
write_recipe_metadata(f, version)
add_dependencies(f, version)
write_bom_recipe(f, version)
for s in service_mapping:
# edge case : v1 contains modules: cloudwatch AND cloudwatchmetrics, which both map to cloudwatch in v2
Expand Down

This file was deleted.

Loading
Loading