Skip to content

Commit

Permalink
Merge pull request #79 from MonsantoCo/nestable-not
Browse files Browse the repository at this point in the history
Add support for nesting a Fn::Not
  • Loading branch information
bkrodgers committed Mar 30, 2016
2 parents b2b0998 + a80e5b4 commit 8a7bfbd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.3.1] - 2015-03-30

### Changed

- Modified Fn::Not to be a NestableAmazonFunctionCall to support using the function within an Fn::And block

## [3.3.0] - 2015-03-18

**Note: This breaks backwards compatibility for anyone using custom NAT Gateways.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ case class `Fn::Equals`(a: Token[String], b: Token[String])
{type CFBackingType = (Token[String], Token[String]) ; val arguments = (a, b)}

case class `Fn::Not`(fn: ConditionFunctionNestable[String])
extends AmazonFunctionCall[String]("Fn::Not"){type CFBackingType = (Seq[Token[String]]) ; val arguments = Seq(fn).map(_.token)}
extends NestableAmazonFunctionCall[String]("Fn::Not"){type CFBackingType = (Seq[Token[String]]) ; val arguments = Seq(fn).map(_.token)}

case class `Fn::And`(fn: Seq[ConditionFunctionNestable[String]])
extends NestableAmazonFunctionCall[String]("Fn::And"){type CFBackingType = (Seq[Token[String]]) ; val arguments = fn.map(_.token)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,24 @@ class ConditionFunctionNestable_UT extends FunSpec with Matchers {
test.toJson should be(expected)
}
}

describe("Fn::And(Fn::Not(Fn::Equals), Fn::Equals)"){

it("Should serialize correctly"){

val test: Token[String] = `Fn::And`(Seq(
`Fn::Not`(`Fn::Equals`("hello", "there")),
`Fn::Equals`("is it me", "you're looking for"))
)
val expected = JsObject(
"Fn::And"-> JsArray(
JsObject("Fn::Not" -> JsArray(
JsObject("Fn::Equals" -> JsArray(JsString("hello"), JsString("there"))))
),
JsObject("Fn::Equals" -> JsArray(JsString("is it me"), JsString("you're looking for")))
)
)
test.toJson should be(expected)
}
}
}

0 comments on commit 8a7bfbd

Please sign in to comment.