diff --git a/app/controllers/ReadOnlyApi.scala b/app/controllers/ReadOnlyApi.scala
index b4a27755..49671fc5 100644
--- a/app/controllers/ReadOnlyApi.scala
+++ b/app/controllers/ReadOnlyApi.scala
@@ -26,7 +26,7 @@ class ReadOnlyApi(
val xmlTags = tags.get.sortBy(_.id).map(_.asExportedXml(sections))
Ok(
- {xmlTags.seq.map { x => x }}
+ {xmlTags.map { x => x }}
)
}
@@ -48,7 +48,7 @@ class ReadOnlyApi(
Ok(
- {xmlSections.seq.map { x => x }}
+ {xmlSections.map { x => x }}
)
}
diff --git a/app/controllers/Support.scala b/app/controllers/Support.scala
index d2302dd0..ececa76f 100644
--- a/app/controllers/Support.scala
+++ b/app/controllers/Support.scala
@@ -22,7 +22,7 @@ import services.{AWS, Config, FetchError, ImageMetadataService, InvalidImage}
import scala.concurrent.{ExecutionContext, Future}
import scala.util.control.NonFatal
-import collection.JavaConverters._
+import scala.jdk.CollectionConverters._
class Support(
val wsClient: WSClient,
diff --git a/app/model/command/RemoveEditionFromSectionCommand.scala b/app/model/command/RemoveEditionFromSectionCommand.scala
index 8cea9283..94c3840d 100644
--- a/app/model/command/RemoveEditionFromSectionCommand.scala
+++ b/app/model/command/RemoveEditionFromSectionCommand.scala
@@ -23,7 +23,7 @@ case class RemoveEditionFromSectionCommand(sectionId: Long, editionName: String)
val pageId = try { PathManager.removePathForId(editionInfo.pageId) } catch { case p: PathRemoveFailed => PathNotFound}
- val updatedEditions = section.editions.filterKeys(_.toUpperCase != editionName.toUpperCase).toMap
+ val updatedEditions = section.editions.view.filterKeys(_.toUpperCase != editionName.toUpperCase).toMap
val updatedSection = section.copy(
editions = updatedEditions,
diff --git a/app/repositories/ContentAPI.scala b/app/repositories/ContentAPI.scala
index b0d44fb4..062a94f0 100644
--- a/app/repositories/ContentAPI.scala
+++ b/app/repositories/ContentAPI.scala
@@ -34,7 +34,7 @@ object ContentAPI extends Logging {
def countOccurencesOfTagInContents(contentIds: List[String], apiTagId: String)(implicit ec: ExecutionContext): Int = {
if (contentIds.nonEmpty) {
- val builder = StringBuilder.newBuilder
+ val builder = new StringBuilder()
var pageSize = 0
var total = 0
diff --git a/app/services/AWS.scala b/app/services/AWS.scala
index 8a0c3b6c..c0afe1e2 100644
--- a/app/services/AWS.scala
+++ b/app/services/AWS.scala
@@ -1,21 +1,21 @@
package services
import java.nio.ByteBuffer
-
import com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider
import com.amazonaws.auth.profile.ProfileCredentialsProvider
import com.amazonaws.regions.{Region, Regions}
-import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient
-import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient
+import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClientBuilder
+import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder
import com.amazonaws.services.dynamodbv2.document.DynamoDB
-import com.amazonaws.services.ec2.AmazonEC2Client
+import com.amazonaws.services.ec2.AmazonEC2ClientBuilder
import com.amazonaws.services.ec2.model.{DescribeTagsRequest, Filter}
-import com.amazonaws.services.kinesis.AmazonKinesisClient
-import com.amazonaws.services.s3.AmazonS3Client
-import com.amazonaws.services.sqs.AmazonSQSClient
+import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder
+import com.amazonaws.services.s3.{AmazonS3Client, AmazonS3ClientBuilder}
+import com.amazonaws.services.sqs.AmazonSQSClientBuilder
import com.amazonaws.util.EC2MetadataUtils
import com.twitter.scrooge.ThriftStruct
import play.api.Logging
+import services.AWS.region
import scala.jdk.CollectionConverters._
@@ -23,14 +23,32 @@ object AWS {
lazy val region = Region getRegion Regions.EU_WEST_1
- lazy val EC2Client = region.createClient(classOf[AmazonEC2Client], null, null)
- lazy val CloudWatch = region.createClient(classOf[AmazonCloudWatchAsyncClient], null, null)
- lazy val Kinesis = region.createClient(classOf[AmazonKinesisClient], null, null)
- lazy val S3Client = region.createClient(classOf[AmazonS3Client], null, null)
-
- private lazy val frontendCredentialsProvider = Config().frontendBucketWriteRole.map(new STSAssumeRoleSessionCredentialsProvider(_, "tagManager"))
-
- lazy val frontendStaticFilesS3Client = region.createClient(classOf[AmazonS3Client], frontendCredentialsProvider.getOrElse(new ProfileCredentialsProvider("frontend")), null)
+ lazy val EC2Client = AmazonEC2ClientBuilder
+ .standard()
+ .withRegion(region.getName)
+ .build()
+ lazy val CloudWatch = AmazonCloudWatchAsyncClientBuilder
+ .standard()
+ .withRegion(region.getName)
+ .build()
+ lazy val Kinesis = AmazonKinesisClientBuilder
+ .standard()
+ .withRegion(region.getName)
+ .build()
+ lazy val S3Client = AmazonS3ClientBuilder
+ .standard()
+ .withRegion(region.getName)
+ .build()
+
+ private lazy val frontendCredentialsProvider = Config().frontendBucketWriteRole.map(
+ new STSAssumeRoleSessionCredentialsProvider.Builder(_, "tagManager").build()
+ )
+
+ lazy val frontendStaticFilesS3Client = AmazonS3ClientBuilder
+ .standard()
+ .withCredentials(frontendCredentialsProvider.getOrElse(new ProfileCredentialsProvider("frontend")))
+ .withRegion(region.getName)
+ .build()
}
trait AwsInstanceTags {
@@ -51,7 +69,10 @@ trait AwsInstanceTags {
}
object Dynamo {
- lazy val client = AWS.region.createClient(classOf[AmazonDynamoDBClient], null, null)
+ lazy val client = AmazonDynamoDBClientBuilder
+ .standard()
+ .withRegion(AWS.region.getName)
+ .build()
lazy val dynamoDb = new DynamoDB(client)
lazy val tagTable = dynamoDb.getTable(Config().tagsTableName)
@@ -72,7 +93,10 @@ object Dynamo {
}
object SQS {
- lazy val SQSClient = AWS.region.createClient(classOf[AmazonSQSClient], null, null)
+ lazy val SQSClient = AmazonSQSClientBuilder
+ .standard()
+ .withRegion(region.getName)
+ .build()
lazy val jobQueue = new SQSQueue(Config().jobQueueName)
}
diff --git a/app/services/SQSQueue.scala b/app/services/SQSQueue.scala
index 52343115..34d7df42 100644
--- a/app/services/SQSQueue.scala
+++ b/app/services/SQSQueue.scala
@@ -4,7 +4,7 @@ import java.util.concurrent.atomic.AtomicBoolean
import com.amazonaws.services.sqs.model._
import play.api.Logging
-import collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import scala.annotation.tailrec
import scala.util.control.NonFatal
diff --git a/build.sbt b/build.sbt
index d73c010a..e03b1c06 100644
--- a/build.sbt
+++ b/build.sbt
@@ -28,7 +28,7 @@ lazy val dependencies = Seq(
"com.amazonaws" % "aws-java-sdk-sqs" % awsVersion,
"com.amazonaws" % "aws-java-sdk-sts" % awsVersion,
"com.amazonaws" % "amazon-kinesis-client" % "1.14.10",
- "com.gu" %% "pan-domain-auth-play_2-8" % pandaVersion,
+ "com.gu" %% "pan-domain-auth-play_3-0" % pandaVersion,
"com.gu" %% "editorial-permissions-client" % "2.15",
ws, // for panda
"ai.x" %% "play-json-extensions" % "0.42.0",
@@ -39,7 +39,7 @@ lazy val dependencies = Seq(
"net.logstash.logback" % "logstash-logback-encoder" % "7.2",
"org.slf4j" % "slf4j-api" % "1.7.12",
"org.slf4j" % "jcl-over-slf4j" % "1.7.12",
- "com.gu" %% "panda-hmac-play_2-8" % pandaVersion,
+ "com.gu" %% "panda-hmac-play_3-0" % pandaVersion,
"com.gu" %% "content-api-client-aws" % "0.7.4",
"com.beachape" %% "enumeratum" % "1.5.13",
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
diff --git a/conf/application.conf b/conf/application.conf
index 0da333cd..e94b0d15 100644
--- a/conf/application.conf
+++ b/conf/application.conf
@@ -7,7 +7,9 @@ play.application.loader = AppLoader
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
-play.http.secret.key=everybodylovestags
+#
+# If a Play app needs a secure Play Application Secret, it should use https://github.com/guardian/play-secret-rotation
+play.http.secret.key="This app doesn't need a secure PAS so long as it DOES NOT use session cookies, CSRF tokens, etc"
# The application languages
# ~~~~~
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 4eaabbfe..b99a6bb4 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,11 +1,9 @@
// Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19")
+addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.5")
-addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4")
+addSbtPlugin("com.github.sbt" % "sbt-digest" % "2.0.0")
-addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.3")
-
-addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")
+addSbtPlugin("com.github.sbt" % "sbt-gzip" % "2.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")