You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A library that lets you read data from AWS' EC2 Systems Manager Parameter Store in a Scala-friendly way. It supports reading data in AWS' three formats - String, StringList, and SecureString - implicitly into Scala types.
packageio.policarp.scalaimportcom.amazonaws.auth.DefaultAWSCredentialsProviderChainimportcom.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClientBuilderimportio.policarp.scala.aws.params.reader.ParamReaderimportio.policarp.scala.aws.params.reader.ListWriter._objectTestextendsApp {
valclient=AWSSimpleSystemsManagementClientBuilder.standard().withCredentials(newDefaultAWSCredentialsProviderChain()).build()
valparams=ParamReader(client)
println(params.read[Long]("length"))
// Right(42)
println(params.readList[Long]("length"))
// Left(InvalidParam(length)) because 'length' is actually a single parameter
println(params.readList[String]("names"))
// Right(List(Grayson,Jemma)))
println(params.readList[String]("emails", listSeparator =Semicolon))
// Right(List(alice@somemail.com,bob@anothermail.com)))
println(params.readSecure[String]("mysecret"))
// Right(hunter2), where data is decrypted using Amazon's Key Management Service if your credentials allow for it
println(params.readSecure[String]("yoursecret"))
// Left(InvalidParam(yoursecret)) because 'yoursecret' does not exist OR your credentials don't allow for reading
}
Other Types?
Simply provide an implementation of the trait ValueWriter. It's basically:
String => ParamResult[A],
where ParamResult is an alias to Either[InvalidParam[A], A], and
InvalidParam is simply a case class wrapping the name of the invalid parameter.
About
Library for reading data from AWS' Parameter Store