cloudformation-ruby-dsl 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,6 +89,11 @@ template do
89
89
  mapping 'TableExampleMap',
90
90
  text.get_map({ :column0 => 'foo' }, :column1, :column2, :column3)
91
91
 
92
+ # Shows how to create a table useful for looking up subnets that correspond to a particular env/region for eg. vpc placement.
93
+ vpc = Table.load 'maps/vpc.txt'
94
+ mapping 'TableExampleMultimap',
95
+ vpc.get_multimap({ :visibility => 'private', :zone => ['a', 'c'] }, :env, :region, :subnet)
96
+
92
97
  # The tag type is a Ruby CFN extension. These tags are excised from the template and used to generate a series of --tag arguments
93
98
  # which are passed to cfn-cmd. They do not ultimately appear in the expanded Cloudformation template. The diff subcommand will
94
99
  # compare tags with the running stack and identify any changes, but cfn-update-stack will do the diff and throw an error on any
@@ -0,0 +1,25 @@
1
+ env region zone visibility subnet
2
+ qa us-east-1 a public subnet-aaaa
3
+ qa us-east-1 a private subnet-bbbb
4
+ qa us-east-1 b public subnet-cccc
5
+ qa us-east-1 b private subnet-dddd
6
+ qa us-east-1 c public subnet-eeee
7
+ qa us-east-1 c private subnet-ffff
8
+ qa eu-west-1 a public subnet-gggg
9
+ qa eu-west-1 a private subnet-hhhh
10
+ qa eu-west-1 b public subnet-iiii
11
+ qa eu-west-1 b private subnet-jjjj
12
+ qa eu-west-1 c public subnet-kkkk
13
+ qa eu-west-1 c private subnet-llll
14
+ prod us-east-1 a public subnet-mmmm
15
+ prod us-east-1 a private subnet-nnnn
16
+ prod us-east-1 b public subnet-oooo
17
+ prod us-east-1 b private subnet-pppp
18
+ prod us-east-1 c public subnet-qqqq
19
+ prod us-east-1 c private subnet-rrrr
20
+ prod eu-west-1 a public subnet-ssss
21
+ prod eu-west-1 a private subnet-tttt
22
+ prod eu-west-1 b public subnet-uuuu
23
+ prod eu-west-1 b private subnet-vvvv
24
+ prod eu-west-1 c public subnet-wwww
25
+ prod eu-west-1 c private subnet-xxxx
@@ -57,8 +57,15 @@ class Table
57
57
  private
58
58
 
59
59
  # Return the subset of records that match the predicate for all keys in the predicate.
60
+ # The predicate is expected to be a map of key/value or key/[value,...] pairs.
60
61
  def filter(predicate)
61
- @records.select { |record| predicate.all? { |key, value| record[key] == value } }
62
+ def matches(predicate_value, record_value)
63
+ if predicate_value.is_a?(Array); predicate_value.include?(record_value)
64
+ else; predicate_value == record_value
65
+ end
66
+ end
67
+
68
+ @records.select { |record| predicate.all? { |key, value| matches(value, record[key]) } }
62
69
  end
63
70
 
64
71
  def build_nested_map(records, path, multi)
@@ -15,7 +15,7 @@
15
15
  module Cfn
16
16
  module Ruby
17
17
  module Dsl
18
- VERSION = "0.4.4"
18
+ VERSION = "0.4.5"
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-ruby-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2014-07-11 00:00:00.000000000 Z
19
+ date: 2014-07-17 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: detabulator
@@ -126,6 +126,7 @@ files:
126
126
  - examples/maps/more_maps/map2.json
127
127
  - examples/maps/more_maps/map3.json
128
128
  - examples/maps/table.txt
129
+ - examples/maps/vpc.txt
129
130
  - examples/userdata.sh
130
131
  - initial_contributions.md
131
132
  - lib/cloudformation-ruby-dsl.rb