Skip to content

Commit

Permalink
Minor code cleanups
Browse files Browse the repository at this point in the history
  * Remove an unnecessary call .toMap
  * Rename region -> regionSetting to avoid naming conflicts
  • Loading branch information
Brendan StJohn committed Nov 11, 2015
1 parent 5582016 commit 00c60a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/com/gilt/aws/lambda/AwsLambdaPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@ object AwsLambdaPlugin extends AutoPlugin {

AwsS3.pushJarToS3(jar, resolvedBucketId) match {
case Success(s3Key) =>
(for ((resolvedLambdaName, resolvedHandlerName) <- resolvedLambdaHandlers) yield {
for ((resolvedLambdaName, resolvedHandlerName) <- resolvedLambdaHandlers) yield {
AwsLambda.createLambda(resolvedRegion, jar, resolvedLambdaName, resolvedHandlerName, resolvedRoleName, resolvedBucketId, resolvedTimeout, resolvedMemory) match {
case Success(createFunctionCodeResult) =>
resolvedLambdaName.value -> LambdaARN(createFunctionCodeResult.getFunctionArn)
case Failure(exception) =>
sys.error(s"Failed to create lambda function: ${exception.getLocalizedMessage}\n${exception.getStackTraceString}")
}
}).toMap
}
case Failure(exception) =>
sys.error(s"Error upload jar to S3 lambda: ${exception.getLocalizedMessage}")
}
}

private def resolveRegion(sbtSettingValueOpt: Option[String]): Region = {
sbtSettingValueOpt match {
case Some(region) => Region(region)
case Some(regionSetting) => Region(regionSetting)
case None => sys.env.get(EnvironmentVariables.region) match {
case Some(envVarRegion) => Region(envVarRegion)
case None => promptUserForRegion()
Expand Down

0 comments on commit 00c60a7

Please sign in to comment.