Skip to content
Library for reading data from AWS' Parameter Store
Branch: master
Clone or download
Latest commit 5ec4dd6 Apr 2, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project added pgp plugin Apr 2, 2017
src moving Test runner class Apr 2, 2017
.gitignore updating gitignore Apr 2, 2017
.travis.yml adding jdk to travis Apr 2, 2017
CHANGELOG.md adding CHANGELOG Apr 2, 2017
LICENSE adding LICENSE Apr 2, 2017
README.md adding mvn shield Apr 2, 2017
build.sbt useGpg Apr 2, 2017

README.md

Scala AWS Params Reader

Build Status Maven Central

What?

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.

Huh?

Example

  
package io.policarp.scala

import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClientBuilder
import io.policarp.scala.aws.params.reader.ParamReader
import io.policarp.scala.aws.params.reader.ListWriter._

object Test extends App {

  val client = AWSSimpleSystemsManagementClientBuilder.standard().withCredentials(new DefaultAWSCredentialsProviderChain()).build()
  val params = 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.
You can’t perform that action at this time.