You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/10/25 12:43:43 UTC

[camel] branch main updated: CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS EKS

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 8da533d824c CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS EKS
8da533d824c is described below

commit 8da533d824c89372a30c8c8e5d73051ecb199936
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Oct 25 14:42:44 2022 +0200

    CAMEL-18643 - AWS Health Check: Use AwsServiceException instead of SdkClientException for health check - AWS EKS
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../camel/component/aws2/eks/EKS2ClientHealthCheck.java       | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2ClientHealthCheck.java b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2ClientHealthCheck.java
index 652542d87cc..8ce3e4db1db 100644
--- a/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2ClientHealthCheck.java
+++ b/components/camel-aws/camel-aws2-eks/src/main/java/org/apache/camel/component/aws2/eks/EKS2ClientHealthCheck.java
@@ -23,7 +23,8 @@ import org.apache.camel.component.aws2.eks.client.EKS2ClientFactory;
 import org.apache.camel.component.aws2.eks.client.EKS2InternalClient;
 import org.apache.camel.health.HealthCheckResultBuilder;
 import org.apache.camel.impl.health.AbstractHealthCheck;
-import software.amazon.awssdk.core.exception.SdkClientException;
+import org.apache.camel.util.ObjectHelper;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.eks.EksClient;
 import software.amazon.awssdk.services.eks.model.ListClustersRequest;
@@ -56,9 +57,15 @@ public class EKS2ClientHealthCheck extends AbstractHealthCheck {
         try {
             EKS2InternalClient eks2Client = EKS2ClientFactory.getEksClient(configuration);
             eks2Client.getEksClient().listClusters(ListClustersRequest.builder().build());
-        } catch (SdkClientException e) {
+        } catch (AwsServiceException e) {
             builder.message(e.getMessage());
             builder.error(e);
+            if (ObjectHelper.isNotEmpty(e.statusCode())) {
+                builder.detail(SERVICE_STATUS_CODE, e.statusCode());
+            }
+            if (ObjectHelper.isNotEmpty(e.awsErrorDetails().errorCode())) {
+                builder.detail(SERVICE_ERROR_CODE, e.awsErrorDetails().errorCode());
+            }
             builder.down();
             return;
         } catch (Exception e) {