All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.rewrite.change-exception-types.yml Maven / Gradle / Ivy

Go to download

Contains OpenRewrite recipes to help users migrate from the AWS SDK for Java v1 to the AWS SDK for Java v2

There is a newer version: 2.29.17-PREVIEW
Show newest version
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
#  http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
---
type: specs.openrewrite.org/v1beta/recipe
name: software.amazon.awssdk.v2migration.ChangeExceptionTypes
displayName: Change SDK Exception types from v1 to v2
description: Change SDK Exception types from v1 to v2.
recipeList:
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.SdkBaseException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.SdkException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.AmazonClientException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.SdkException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.SdkClientException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.SdkClientException

  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getRequestId()
      newMethodName: requestId
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getErrorCode()
      newMethodName: awsErrorDetails().errorCode
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getServiceName()
      newMethodName: awsErrorDetails().serviceName
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getErrorMessage()
      newMethodName: awsErrorDetails().errorMessage
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getStatusCode()
      newMethodName: awsErrorDetails().sdkHttpResponse().statusCode
  ### TODO: v2 returns Map>. Convert it to Map
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getHttpHeaders()
      newMethodName: awsErrorDetails().sdkHttpResponse().headers
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getRawResponse()
      newMethodName: awsErrorDetails().rawResponse().asByteArray
  - org.openrewrite.java.ChangeMethodName:
      methodPattern: com.amazonaws.AmazonServiceException getRawResponseContent()
      newMethodName: awsErrorDetails().rawResponse().asUtf8String
  - software.amazon.awssdk.v2migration.AddCommentToMethod:
      methodPattern: com.amazonaws.AmazonServiceException getErrorType()
      comment: getErrorType is not supported in v2. AwsServiceException is a service error in v2. Consider removing it.
  - software.amazon.awssdk.v2migration.AddCommentToMethod:
      methodPattern: com.amazonaws.AmazonServiceException getProxyHost()
      comment: getProxyHost is not supported in v2. Please submit a feature request https://github.com/aws/aws-sdk-java-v2/issues
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.AmazonServiceException
      newFullyQualifiedTypeName: software.amazon.awssdk.awscore.exception.AwsServiceException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.AbortedException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.AbortedException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.http.timers.client.ClientExecutionTimeoutException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.ApiCallTimeoutException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.http.exception.HttpRequestTimeoutException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.ApiCallAttemptTimeoutException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.http.timers.client.SdkInterruptedException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.SdkInterruptedException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.http.timers.client.SdkInterruptedException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.SdkInterruptedException
  - org.openrewrite.java.ChangeType:
      oldFullyQualifiedTypeName: com.amazonaws.internal.CRC32MismatchException
      newFullyQualifiedTypeName: software.amazon.awssdk.core.exception.Crc32MismatchException




© 2015 - 2024 Weber Informatics LLC | Privacy Policy