Skip to content

Commit

Permalink
Upgrade AWS SDK versions (#999)
Browse files Browse the repository at this point in the history
* upgrade aws sdk

* fixes after sdk upgrade
  • Loading branch information
micossow authored Apr 17, 2024
1 parent f3f7540 commit 7c344b4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ val jclOverSlf4j = "org.slf4j" % "jcl-over-slf4j" % "2.0.13" // needed form amaz
val scalatest = "org.scalatest" %% "scalatest" % "3.2.18"
val awaitility = "org.awaitility" % "awaitility-scala" % "4.2.1"

val amazonJavaSdkSqs = "com.amazonaws" % "aws-java-sdk-sqs" % "1.12.580" exclude ("commons-logging", "commons-logging")
val amazonJavaV2SdkSqs = "software.amazon.awssdk" % "sqs" % "2.21.43"
val amazonJavaSdkSqs = "com.amazonaws" % "aws-java-sdk-sqs" % "1.12.699" exclude ("commons-logging", "commons-logging")
val amazonJavaV2SdkSqs = "software.amazon.awssdk" % "sqs" % "2.25.30"

val pekkoVersion = "1.0.2"
val pekkoHttpVersion = "1.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MessageAttributesTests extends SqsClientServerCommunication with Matchers
.addMessageAttributesEntry("attribute1", new MessageAttributeValue().withStringValue("value").withDataType(""))
)

ex.getMessage should include("Attribute 'attribute1' must contain a non-empty attribute type")
ex.getMessage should include("Currently only handles String, Number and Binary typed attributes")
}

test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ trait MessageAttributesSupport {
pickFieldRaw("BinaryValue") match {
case arr: JsArray => BinaryMessageAttribute(arr.convertTo[Array[Byte]], customType(ct))
case str: JsString => BinaryMessageAttribute.fromBase64(str.convertTo[String], customType(ct))
case any: Any => throw SQSException.invalidParameter(s"Field BinaryValue has unsupported type $any")
case any: Any => throw SQSException.invalidParameter(s"Field BinaryValue has unsupported type $any")
}
case _ =>
throw new Exception("Currently only handles String, Number and Binary typed attributes")
throw SQSException.invalidParameter("Currently only handles String, Number and Binary typed attributes")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,33 @@ trait QueueDirectives {

protected def getQueueNameFromQueueUrl(queueUrl: String): Directive1[String] = {

val matcher =
val defaultMatcher =
if (contextPath.nonEmpty) {
val pathWithContext = separateOnSlashes(contextPath) / AccountIdRegex / "[^/]+".r
Slash ~ pathWithContext | pathWithContext
} else
Slash ~ AccountIdRegex / "[^/]+".r

matcher(Uri(queueUrl).path) match {
val noAccountIdMatcher =
if (contextPath.nonEmpty) {
val pathWithContext = separateOnSlashes(contextPath) / "[^/]+".r
Slash ~ pathWithContext | pathWithContext
} else
Slash ~ "[^/]+".r

defaultMatcher(Uri(queueUrl).path) match {
case Matched(_, (_, queueName)) => provide(queueName): Directive1[String]
case Unmatched =>
reject(
MalformedQueryParamRejection(
QueueUrlParameter,
"Invalid queue url, the path should be /<accountId>/<queueName> where accountId must match " + AccountIdRegex + " regex"
)
)
noAccountIdMatcher(Uri(queueUrl).path) match {
case Matched(_, Tuple1(queueName)) => provide(queueName)
case Unmatched =>
reject(
MalformedQueryParamRejection(
QueueUrlParameter,
"Invalid queue url, the path should be /<accountId>/<queueName> or /<queueName>"
)
)
}
}
}

Expand Down

0 comments on commit 7c344b4

Please sign in to comment.