diff --git a/build.sbt b/build.sbt index ab5b1a321..27ad6f098 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,7 @@ ThisBuild / scalacOptions ++= compilerOptions val playJsonVersion = "3.0.3" val specsVersion: String = "4.8.3" -val awsSdkVersion: String = "1.12.687" +val awsSdkVersion: String = "1.12.707" val doobieVersion: String = "0.13.4" val catsVersion: String = "2.10.0" val okHttpVersion: String = "4.12.0" @@ -350,7 +350,7 @@ lazy val sloMonitor = lambda("slomonitor", "slomonitor", Some("com.gu.notificati Seq( description := "Monitors SLO performance for breaking news notifications", libraryDependencies ++= Seq( - "com.amazonaws" % "aws-lambda-java-events" % "3.11.4", + "com.amazonaws" % "aws-lambda-java-events" % "3.11.5", "com.amazonaws" % "aws-java-sdk-cloudwatch" % awsSdkVersion, "io.netty" % "netty-codec" % nettyVersion, "io.netty" % "netty-codec-http" % nettyVersion, @@ -421,7 +421,7 @@ lazy val notificationworkerlambda = lambda("notificationworkerlambda", "notifica "com.amazonaws" % "aws-lambda-java-events" % "2.2.9", "com.amazonaws" % "aws-java-sdk-sqs" % awsSdkVersion, "com.amazonaws" % "aws-java-sdk-s3" % awsSdkVersion, - "com.amazonaws" % "amazon-sqs-java-messaging-lib" % "2.1.2", + "com.amazonaws" % "amazon-sqs-java-messaging-lib" % "2.1.3", "com.squareup.okhttp3" % "okhttp" % okHttpVersion, "org.playframework" %% "play-json" % playJsonVersion, "com.google.oauth-client" % "google-oauth-client" % googleOAuthClient, diff --git a/football/src/main/scala/com/gu/mobile/notifications/football/Lambda.scala b/football/src/main/scala/com/gu/mobile/notifications/football/Lambda.scala index e39ca3f19..42dea9041 100644 --- a/football/src/main/scala/com/gu/mobile/notifications/football/Lambda.scala +++ b/football/src/main/scala/com/gu/mobile/notifications/football/Lambda.scala @@ -1,9 +1,8 @@ package com.gu.mobile.notifications.football -import java.net.URL +import java.net.{URI, URL} import java.time.ZonedDateTime import java.util.concurrent.TimeUnit - import com.amazonaws.regions.Regions import com.amazonaws.services.dynamodbv2.{AmazonDynamoDBAsync, AmazonDynamoDBAsyncClientBuilder} import com.gu.contentapi.client.GuardianContentClient @@ -65,7 +64,7 @@ object Lambda extends Logging { def getZonedDateTime(): ZonedDateTime = { val zonedDateTime = if (configuration.stage == "CODE") { - val is = new URL("https://hdjq4n85yi.execute-api.eu-west-1.amazonaws.com/Prod/getTime").openStream() + val is = URI.create("https://hdjq4n85yi.execute-api.eu-west-1.amazonaws.com/Prod/getTime").toURL.openStream() val json = Json.parse(Source.fromInputStream(is).mkString) ZonedDateTime.parse((json \ "currentDate").as[String]) } else { diff --git a/reportextractor/src/main/scala/com/gu/notifications/extractor/Lambda.scala b/reportextractor/src/main/scala/com/gu/notifications/extractor/Lambda.scala index 50e31dce2..4e017646d 100644 --- a/reportextractor/src/main/scala/com/gu/notifications/extractor/Lambda.scala +++ b/reportextractor/src/main/scala/com/gu/notifications/extractor/Lambda.scala @@ -3,10 +3,9 @@ package com.gu.notifications.extractor import java.io.ByteArrayInputStream import java.time.LocalDate import java.time.temporal.ChronoUnit - import aws.AsyncDynamo.{keyBetween, keyEquals} import aws.DynamoJsonConversions -import com.amazonaws.regions.Regions +import com.amazonaws.regions.{RegionUtils, Regions, Region} import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder import com.amazonaws.services.dynamodbv2.model._ import com.amazonaws.services.lambda.runtime.{Context, RequestHandler} @@ -49,13 +48,13 @@ class Lambda extends RequestHandler[DateRange, Unit] { .getOrElse(DevIdentity(defaultAppName)) } - val region: Regions = identity match { - case AwsIdentity(_, _, _, region) => Regions.fromName(region) - case _ => Regions.EU_WEST_1 + val region: Region = identity match { + case AwsIdentity(_, _, _, region) => RegionUtils.getRegion(region) + case _ => Region.getRegion(Regions.EU_WEST_1) } - val dynamoDB = AmazonDynamoDBClientBuilder.standard().withCredentials(credentials).withRegion(region).build() - val s3 = AmazonS3ClientBuilder.standard().withCredentials(credentials).withRegion(region).build() + val dynamoDB = AmazonDynamoDBClientBuilder.standard().withCredentials(credentials).withRegion(region.getName).build() + val s3 = AmazonS3ClientBuilder.standard().withCredentials(credentials).withRegion(region.getName).build() val tableName: String = identity match { case AwsIdentity(_, _, stage, _) => s"mobile-notifications-reports-$stage"