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