From cac1af568761a8e74320116603bca91842736944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 27 Sep 2024 02:41:02 +0200 Subject: [PATCH] Quick attempt at resolving AWS signing problems (#1568, #1532) --- modules/aws-http4s/src/smithy4s/aws/AwsClient.scala | 6 +++++- .../aws-http4s/src/smithy4s/aws/internals/AwsSigning.scala | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/aws-http4s/src/smithy4s/aws/AwsClient.scala b/modules/aws-http4s/src/smithy4s/aws/AwsClient.scala index d39345427..3d36f56a4 100644 --- a/modules/aws-http4s/src/smithy4s/aws/AwsClient.scala +++ b/modules/aws-http4s/src/smithy4s/aws/AwsClient.scala @@ -71,7 +71,11 @@ object AwsClient { def baseRequest(endpoint: OperationSchema[_, _, _, _, _]): F[HttpRequest[Blob]] = { awsEnv.region.map { region => - val endpointPrefix = awsService.endpointPrefix.getOrElse(endpoint.id.name) + val endpointPrefix = + awsService.endpointPrefix + .orElse(awsService.arnNamespace.map(_.value)) + .getOrElse(endpoint.id.name) + val baseUri = HttpUri( scheme = HttpUriScheme.Https, host = s"$endpointPrefix.$region.amazonaws.com", diff --git a/modules/aws-http4s/src/smithy4s/aws/internals/AwsSigning.scala b/modules/aws-http4s/src/smithy4s/aws/internals/AwsSigning.scala index 21f55f007..6ead1d101 100644 --- a/modules/aws-http4s/src/smithy4s/aws/internals/AwsSigning.scala +++ b/modules/aws-http4s/src/smithy4s/aws/internals/AwsSigning.scala @@ -60,7 +60,10 @@ private[aws] object AwsSigning { ): Client[F] => Client[F] = { val endpointPrefix = serviceHints .get(_root_.aws.api.Service) - .flatMap(_.endpointPrefix) + .flatMap { awsService => + awsService.endpointPrefix + .orElse(awsService.arnNamespace.map(_.value)) + } .getOrElse(serviceId.name) .toLowerCase()