Generate code for AWS sagemaker, for example the ListEndpoints operation
Create a client for that service and call it with any parameters
See the error, {"__type":"InvalidSignatureException","message":"Credential should be scoped to correct service: 'sagemaker'. "}:
[info] {"__type":"InvalidSignatureException","message":"Credential should be scoped to correct service: 'sagemaker'. "}
[error] smithy4s.http.UnknownErrorResponse: status 400, headers: HashMap(content-length -> List(112), x-amzn-requestid -> List(5da79a17-1241-4404-a539-2efdd85b8a85), connection -> List(close), date -> List(Mon, 15 Jul 2024 23:38:37 GMT), content-type -> List(application/x-amz-json-1.1)), body:
[error] {"__type":"InvalidSignatureException","message":"Credential should be scoped to correct service: 'sagemaker'. "}
[error] at smithy4s.http.UnknownErrorResponse$.apply(UnknownErrorResponse.scala:19)
[error] at smithy4s.http.HttpResponse$Decoder$$anon$4.decode$$anonfun$1$$anonfun$1(HttpResponse.scala:248)
[error] at sequence @ smithy4s.interopcats.package$$anon$1.zipMapAll(package.scala:31)
[error] at sequence @ smithy4s.interopcats.package$$anon$1.zipMapAll(package.scala:31)
[error] at sequence @ smithy4s.interopcats.package$$anon$1.zipMapAll(package.scala:31)
[error] at map @ smithy4s.interopcats.package$$anon$1.zipMapAll(package.scala:31)
[error] at flatMap @ smithy4s.interopcats.package$$anon$1.flatMap(package.scala:33)
[error] at flatMap @ smithy4s.interopcats.package$$anon$1.flatMap(package.scala:33)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at clear @ org.http4s.client.middleware.Retry$.retryLoop$1(Retry.scala:90)
[error] at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
[error] at rethrow$extension @ fs2.Compiler$Target.compile$$anonfun$1(Compiler.scala:157)
[error] at run$ @ hello.Main$.run(Main.scala:11)
[error] Nonzero exit code returned from runner: 1
My knowledge of how signatures work is very low, but in case it's useful: aws.auth.Sigv4(name = "sagemaker") - that's the hint on the service. The protocol is AwsJson1_1.
To reproduce
(repo with
sbt run
-able setup)ListEndpoints
operation{"__type":"InvalidSignatureException","message":"Credential should be scoped to correct service: 'sagemaker'. "}
: