From b3f0169644d902e12297d3cf33a22e355f009322 Mon Sep 17 00:00:00 2001 From: Alex GB Date: Thu, 1 Feb 2024 08:51:45 +0000 Subject: [PATCH] Upgrade Ciris to 3.5.x Upgrade Scala 3 and Scala 2 Upgrade Cats-effect and cats-core Upgrade awssdk secretsmanager Upgrade munit --- build.sbt | 23 +++++++++++-------- project/plugins.sbt | 2 +- readme.md | 4 ++-- .../aws/secretsmanager/SecretString.scala | 5 ++-- .../ciris/aws/secretsmanager/package.scala | 13 +++++++---- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index 1b684ad..aea80c7 100644 --- a/build.sbt +++ b/build.sbt @@ -4,16 +4,16 @@ name := "ciris-aws-secretsmanager" organization := "io.github.keirlawson" licenses += ("MIT", url("http://opensource.org/licenses/MIT")) -scalaVersion := "3.2.2" -crossScalaVersions := Seq(scalaVersion.value, "2.13.10", "2.12.17") +scalaVersion := "3.3.1" +crossScalaVersions := Seq(scalaVersion.value, "2.13.12", "2.12.18") releaseCrossBuild := true libraryDependencies ++= Seq( - "is.cir" %% "ciris" % "3.1.0", - "org.typelevel" %% "cats-core" % "2.9.0", - "org.typelevel" %% "cats-effect" % "3.4.8", - "software.amazon.awssdk" % "secretsmanager" % "2.22.3", - "org.typelevel" %% "munit-cats-effect-3" % "1.0.6" % Test + "is.cir" %% "ciris" % "3.5.0", + "org.typelevel" %% "cats-core" % "2.10.0", + "org.typelevel" %% "cats-effect" % "3.5.2", + "software.amazon.awssdk" % "secretsmanager" % "2.23.14", + "org.typelevel" %% "munit-cats-effect-3" % "1.0.7" % Test ) publishTo := sonatypePublishToBundle.value @@ -31,7 +31,12 @@ scmInfo := Some( ) ) developers := List( - Developer(id="keirlawson", name="Keir Lawson", email="keirlawson@gmail.com", url=url("https://github.com/keirlawson/")) + Developer( + id = "keirlawson", + name = "Keir Lawson", + email = "keirlawson@gmail.com", + url = url("https://github.com/keirlawson/") + ) ) import ReleaseTransformations._ @@ -51,4 +56,4 @@ releaseProcess := Seq[ReleaseStep]( pushChanges ) -Compile / doc / sources := Nil \ No newline at end of file +Compile / doc / sources := Nil diff --git a/project/plugins.sbt b/project/plugins.sbt index 1a293e9..1e7aaf3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") \ No newline at end of file +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1") diff --git a/readme.md b/readme.md index b2ea391..de4eccb 100644 --- a/readme.md +++ b/readme.md @@ -10,10 +10,10 @@ To get started with [sbt](https://www.scala-sbt.org), simply add the following l For Cats Effect 3: ```scala -libraryDependencies += "io.github.keirlawson" %% "ciris-aws-secretsmanager" % "6.0.2" +libraryDependencies += "io.github.keirlawson" %% "ciris-aws-secretsmanager" % "7.0.0" ``` -The library is published for Scala 2.12, 2.13 and 3.1. +The library is published for Scala 2.12, 2.13 and 3.3. ### Example diff --git a/src/main/scala/ciris/aws/secretsmanager/SecretString.scala b/src/main/scala/ciris/aws/secretsmanager/SecretString.scala index 2496b80..8018f90 100644 --- a/src/main/scala/ciris/aws/secretsmanager/SecretString.scala +++ b/src/main/scala/ciris/aws/secretsmanager/SecretString.scala @@ -1,5 +1,6 @@ package ciris.aws.secretsmanager +import cats.effect.Async import cats.implicits._ import ciris.{ConfigKey, ConfigValue, Secret} import software.amazon.awssdk.services.secretsmanager.SecretsManagerAsyncClient @@ -11,7 +12,7 @@ sealed abstract class SecretString[F[_]] { } private[secretsmanager] object SecretString { - final def apply[F[_]](client: SecretsManagerAsyncClient): SecretString[F] = + final def apply[F[_]: Async](client: SecretsManagerAsyncClient): SecretString[F] = new SecretString[F] { override final def apply(key: String): ConfigValue[F, Secret[String]] = fetch(key, GetSecretValueRequest.builder().secretId(key).build()) @@ -23,7 +24,7 @@ private[secretsmanager] object SecretString { key: String, request: GetSecretValueRequest ): ConfigValue[F, Secret[String]] = - ConfigValue.async { cb => + ConfigValue.async_ { cb => val configKey = ConfigKey(s"secret string $key from AWS secrets manager") client.getSecretValue(request).whenComplete { (resp, error) => diff --git a/src/main/scala/ciris/aws/secretsmanager/package.scala b/src/main/scala/ciris/aws/secretsmanager/package.scala index a0e3cd1..77ecb69 100644 --- a/src/main/scala/ciris/aws/secretsmanager/package.scala +++ b/src/main/scala/ciris/aws/secretsmanager/package.scala @@ -1,13 +1,16 @@ package ciris.aws +import cats.effect.Async import cats.effect.kernel.{Resource, Sync} import ciris.ConfigValue -import software.amazon.awssdk.auth.credentials.{AwsCredentialsProvider, DefaultCredentialsProvider} -import software.amazon.awssdk.services.secretsmanager.SecretsManagerAsyncClient -import software.amazon.awssdk.services.secretsmanager.SecretsManagerAsyncClientBuilder +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider +import software.amazon.awssdk.services.secretsmanager.{ + SecretsManagerAsyncClient, + SecretsManagerAsyncClientBuilder +} package object secretsmanager { - def secrets[F[_]: Sync]( + def secrets[F[_]: Async]( region: Region ): ConfigValue[F, SecretString[F]] = secrets( @@ -17,7 +20,7 @@ package object secretsmanager { .credentialsProvider(DefaultCredentialsProvider.create()) ) - def secrets[F[_]: Sync]( + def secrets[F[_]: Async]( clientBuilder: SecretsManagerAsyncClientBuilder ): ConfigValue[F, SecretString[F]] = ConfigValue.resource {