cfndsl 0.9.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjkwNTFiYmFiYzFjODRlODlkYzJkMjdiNjgyNDk5NWEzZmI1NDQ4Ng==
4
+ ZTQ5MDZiNmQxMzc5OWNjN2RlNTAxYTFkM2VlOWNhYWZkMjcxNDBjYg==
5
5
  data.tar.gz: !binary |-
6
- NmU4YzQzNWM3YzdjNTAxN2MyMjE3MmNiYmMwZGJiNWU4MjkzYzZlMg==
6
+ MDU1NmI3MTNkY2VlZDUyYTlkZjg2NzExMTY2ZmU3M2FmMDQ3NzJjNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzQ5NzYyZTBiNDU4ZTM0Nzg3MTA1ZDZkNWE5OTVjNWQ1YTUxNjQ0MzRkNWVi
10
- Zjc3ODM4ZGEzZjU1MDMyMjFjNDdkMDNhZWY5MWU3MzczMmZhNWMxMWRmN2Ni
11
- NjQ5NjViNjZmZTVlZDVkOWViMjcyZjM4OTE4Y2Q3OGZiZTBkMGU=
9
+ ZTI0YWYzMGM0MDg2MmZhODIzNjYyM2I4ZmVhYjhiNGE0MTVlYjgwNTMyY2Mz
10
+ MDhhZjExMWI3MjQwMDMyNDkxMWZmMTY4MzhlYTJjYzUwNTY5YzgwNzdjYTY1
11
+ NjhkMmYwMTg0NGFmMmQ4OGVkZTNjNGY1YThiZTFiNDhjNjgzMjk=
12
12
  data.tar.gz: !binary |-
13
- YzAxYTM5MWM3MTRiZDExZDY0ZGQxNTNlM2MxNGNkNWZlNjMzMWJlZDEzYWNk
14
- Y2Y4ZmMxZThlZGQ3ZDlhYTg4ZmU4YjlhYzNjZmYyNjg3NDc2NmRjYTA4NDA2
15
- NmYxYzQ4OTdhNTYxOThiMDlhM2UzZDc0YTE1NTE4YWQ4NjZkOWE=
13
+ NWY0NWUyMmE2NTIwNjNmNTBhZmU4ZjZjNjUxYWVkNDUyYzA5N2U3YTI1NDll
14
+ YWFmNTFmYmRmNzQwMmZhYTgzMThjOTA4ZmU4YjhkMjc2YjkxNjVkZDVjNTA4
15
+ NmZiZjAxMGVhYmZkYzFiMjcwNDg1MmNkYWQ2ZDQwNGQ4NjhiMGE=
@@ -16,6 +16,7 @@ Resources:
16
16
  MetricsCollection: [ MetricsCollectionType ]
17
17
  NotificationConfiguration: String
18
18
  Tags: [ AutoScalingTags ]
19
+ TargetGroupARNs: [ String ]
19
20
  TerminationPolicies: [ String ]
20
21
  VPCZoneIdentifier: [ String ]
21
22
  "AWS::ApiGateway::Account" :
@@ -267,6 +268,13 @@ Resources:
267
268
  AllocationId: String
268
269
  NetworkInterfaceId: String
269
270
  PrivateIpAddress: String
271
+ "AWS::EC2::FlowLog" :
272
+ Properties:
273
+ DeliverLogsPermissionArn: String
274
+ LogGroupName: String
275
+ ResourceId: String
276
+ ResourceType: String
277
+ TrafficType: String
270
278
  "AWS::EC2::Instance" :
271
279
  Properties:
272
280
  BlockDeviceMappings : [ BlockDeviceMapping ]
@@ -555,6 +563,45 @@ Resources:
555
563
  DNSName: String
556
564
  SourceSecurityGroup.GroupName: String
557
565
  SourceSecurityGroup.OwnerAlias: String
566
+ "AWS::ElasticLoadBalancingV2::LoadBalancer" :
567
+ Properties:
568
+ LoadBalancerAttributes: [ LoadBalancerAttribute ]
569
+ Name: String
570
+ Scheme: String
571
+ SecurityGroups: [ String ]
572
+ Subnets: [ String ]
573
+ Tags: [ EC2Tag ]
574
+ "AWS::ElasticLoadBalancingV2::Listener" :
575
+ Properties:
576
+ Certificates: [ LBCertificate ]
577
+ DefaultActions: [ ListenerDefaultAction ]
578
+ LoadBalancerArn: String
579
+ Port: Integer
580
+ Protocol: String
581
+ SSLPolicy: String
582
+ "AWS::ElasticLoadBalancingV2::ListenerRule" :
583
+ Properties:
584
+ Actions: [ ListenerRuleAction ]
585
+ Conditions: [ ListenerRuleCondition ]
586
+ ListenerArn: String
587
+ Priority: Integer
588
+ "AWS::ElasticLoadBalancingV2::TargetGroup" :
589
+ Properties:
590
+ HealthCheckIntervalSeconds: Integer
591
+ HealthCheckPath: String
592
+ HealthCheckPort: String
593
+ HealthCheckProtocol: String
594
+ HealthCheckTimeoutSeconds: Integer
595
+ HealthyThresholdCount: Integer
596
+ Matcher: String
597
+ Name: String
598
+ Port: String
599
+ Protocol: String
600
+ Tags: [ EC2Tag ]
601
+ TargetGroupAttributes: [ TargetGroupAttribute ]
602
+ Targets: [ TargetDescription ]
603
+ UnhealthyThresholdCount: Integer
604
+ VpcId: String
558
605
  "AWS::Elasticsearch::Domain" :
559
606
  Properties:
560
607
  AccessPolicies: JSON
@@ -582,6 +629,7 @@ Resources:
582
629
  SecretAccessKey: String
583
630
  "AWS::IAM::Group" :
584
631
  Properties:
632
+ GroupName: String
585
633
  ManagedPolicyArns: [ String ]
586
634
  Path: String
587
635
  Policies: [ IAMEmbeddedPolicy ]
@@ -821,6 +869,7 @@ Resources:
821
869
  Encrypted: Boolean
822
870
  HsmClientCertificateIdentifier: String
823
871
  HsmConfigurationIdentifier: String
872
+ KmsKeyId: String
824
873
  MasterUsername: String
825
874
  MasterUserPassword: String
826
875
  NodeType: String
@@ -923,6 +972,37 @@ Resources:
923
972
  Attributes:
924
973
  Arn: String
925
974
  QueueName: String
975
+ "AWS::WAF::ByteMatchSet" :
976
+ Properties:
977
+ ByteMatchTuples: [ ByteMatchTuple ]
978
+ Name: String
979
+ "AWS::WAF::IPSet" :
980
+ Properties:
981
+ IPSetDescriptors: [ IPSetDescriptor ]
982
+ Name: String
983
+ "AWS::WAF::Rule" :
984
+ Properties:
985
+ MetricName: String
986
+ Name: String
987
+ Predicates: [ Predicate ]
988
+ "AWS::WAF::SizeConstraintSet" :
989
+ Properties:
990
+ Name: String
991
+ SizeConstraints: [ SizeConstraint ]
992
+ "AWS::WAF::SqlInjectionMatchSet" :
993
+ Properties:
994
+ Name: String
995
+ SqlInjectionMatchTuples: [ SqlInjectionMatchTuple ]
996
+ "AWS::WAF::WebACL" :
997
+ Properties:
998
+ DefaultAction: WebACLAction
999
+ MetricName: String
1000
+ Name: String
1001
+ Rules: [ WebACLRule ]
1002
+ "AWS::WAF::XssMatchSet" :
1003
+ Properties:
1004
+ Name: String
1005
+ XssMatchTuples: [ XssMatchTuple ]
926
1006
  "AWS::ECS::Cluster" :
927
1007
  Properties: {}
928
1008
  "AWS::ECS::Service" :
@@ -1091,6 +1171,26 @@ Types:
1091
1171
  Protocol: String
1092
1172
  SSLCertificateId: String
1093
1173
  PolicyNames: [ LBOrAppCookieStickinessPolicy ]
1174
+ LoadBalancerAttribute:
1175
+ Key: String
1176
+ Value: String
1177
+ LBCertificate:
1178
+ CertificateArn: String
1179
+ ListenerDefaultAction:
1180
+ TargetGroupArn: String
1181
+ Type: String
1182
+ ListenerRuleAction:
1183
+ Type: String
1184
+ TargetGroupArn: String
1185
+ ListenerRuleCondition:
1186
+ Field: String
1187
+ Values: [ String ]
1188
+ TargetGroupAttribute:
1189
+ Key: String
1190
+ Value: String
1191
+ TargetDescription:
1192
+ Id: String
1193
+ Port: Integer
1094
1194
  RDSSecurityGroupRule:
1095
1195
  CIDRIP: String
1096
1196
  EC2SecurityGroupName: String
@@ -1391,3 +1491,36 @@ Types:
1391
1491
  ResourcePath: String
1392
1492
  ThrottlingBurstLimit: Integer
1393
1493
  ThrottlingRateLimit: Number
1494
+ ByteMatchTuple:
1495
+ FieldToMatch: FieldToMatch
1496
+ PositionalConstraint: String
1497
+ TargetString: String
1498
+ TargetStringBase64: String
1499
+ TextTransformation: String
1500
+ FieldToMatch:
1501
+ Data: String
1502
+ Type: String
1503
+ IPSetDescriptor:
1504
+ Type: String
1505
+ Value: String
1506
+ Predicate:
1507
+ DataId: String
1508
+ Negated: Boolean
1509
+ Type: String
1510
+ SizeConstraint:
1511
+ ComparisonOperator: String
1512
+ FieldToMatch: FieldToMatch
1513
+ Size: String
1514
+ TextTransformation: String
1515
+ SqlInjectionMatchTuple:
1516
+ FieldToMatch: FieldToMatch
1517
+ TextTransformation: String
1518
+ WebACLAction:
1519
+ Type: String
1520
+ WebACLRule:
1521
+ Action: WebACLAction
1522
+ Priority: Integer
1523
+ RuleId: String
1524
+ XssMatchTuple:
1525
+ FieldToMatch: FieldToMatch
1526
+ TextTransformation: String
@@ -172,23 +172,6 @@ module CfnDsl
172
172
  def declare(&block)
173
173
  instance_eval(&block) if block_given?
174
174
  end
175
-
176
- def method_missing(meth, *args, &_block)
177
- error = "Undefined symbol: #{meth}"
178
- error = "#{error}(" + args.inspect[1..-2] + ')' unless args.empty?
179
- error = "#{error}\n\nTry '#{titleize(meth)}' instead" if incorrect_capitalization?(meth)
180
- CfnDsl::Errors.error(error, 1)
181
- end
182
-
183
- def incorrect_capitalization?(method)
184
- method != titleize(method) && respond_to?(titleize(method))
185
- end
186
-
187
- def titleize(method)
188
- method.to_s.clone.tap do |m|
189
- m[0] = m[0, 1].upcase
190
- end.to_sym
191
- end
192
175
  end
193
176
 
194
177
  # Handles all of the Fn:: objects
data/lib/cfndsl/names.rb CHANGED
@@ -1,18 +1,12 @@
1
1
  # Method name helper
2
2
  module CfnDsl
3
+ module_function
4
+
3
5
  # iterates through the the valid case-insensitive names
4
6
  # for "name"
5
- def self.method_names(name, &block)
6
- if block
7
- name_str = name.to_s
8
- yield name_str.to_sym
9
- n = name_str.dup
10
- n[0] = n[0].swapcase
11
- yield n.to_sym
12
- else
13
- result = [name.dup, name.dup]
14
- result[1][0] = result[1][0].swapcase
15
- return result
16
- end
7
+ def method_names(name)
8
+ name_str = name.to_s.dup
9
+ names = [name_str, name_str.gsub(/^\w/, &:swapcase)]
10
+ block_given? ? names.each { |n| yield n.to_sym } : names
17
11
  end
18
12
  end
@@ -1,34 +1,28 @@
1
1
  module CfnDsl
2
2
  # Plural names for lists of content objects
3
3
  module Plurals
4
+ module_function
5
+
4
6
  @plurals = {
5
- 'Metadata' => 'Metadata',
6
- 'Property' => 'Properties',
7
- 'Policy' => 'Policies',
8
- 'PolicyDocument' => 'PolicyDocument',
9
7
  'AssumeRolePolicyDocument' => 'AssumeRolePolicyDocument',
10
- 'SecurityGroupIngress' => 'SecurityGroupIngress',
11
- 'SecurityGroupEgress' => 'SecurityGroupEgress',
12
- 'DBSecurityGroupIngress' => 'DBSecurityGroupIngress',
13
- 'UpdatePolicy' => 'UpdatePolicy',
14
- 'CreationPolicy' => 'CreationPolicy'
8
+ 'CreationPolicy' => 'CreationPolicy',
9
+ 'DBSecurityGroupIngress' => 'DBSecurityGroupIngress',
10
+ 'Metadata' => 'Metadata',
11
+ 'Policy' => 'Policies',
12
+ 'PolicyDocument' => 'PolicyDocument',
13
+ 'Property' => 'Properties',
14
+ 'SecurityGroupEgress' => 'SecurityGroupEgress',
15
+ 'SecurityGroupIngress' => 'SecurityGroupIngress',
16
+ 'UpdatePolicy' => 'UpdatePolicy'
15
17
  }
18
+ @singles = @plurals.invert
16
19
 
17
- @singles = {}
18
- @plurals.each_pair { |key, val| @singles[val] = key }
19
-
20
- def self.pluralize(name)
21
- name = name.to_s
22
- return @plurals[name] if @plurals.key?(name)
23
-
24
- "#{name}s"
20
+ def pluralize(name)
21
+ @plurals.fetch(name.to_s) { |key| key + 's' }
25
22
  end
26
23
 
27
- def self.singularize(name)
28
- name = name.to_s
29
- return @singles[name] if @singles.key?(name)
30
-
31
- name[0..-2]
24
+ def singularize(name)
25
+ @singles.fetch(name.to_s) { |key| key[0..-2] }
32
26
  end
33
27
  end
34
28
  end
@@ -1,3 +1,3 @@
1
1
  module CfnDsl
2
- VERSION = '0.9.2'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe CfnDsl do
4
+ context '.method_names' do
5
+ it 'returns an array of string method names when called without a block' do
6
+ expect(described_class.method_names('foo')).to eq(%w(foo Foo))
7
+ end
8
+
9
+ it 'yields symbol method names when called with a block' do
10
+ results = []
11
+ described_class.method_names('foo') { |name| results << name }
12
+ expect(results).to eq([:foo, :Foo])
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe CfnDsl::Plurals do
4
+ context '.pluralize' do
5
+ it 'pluralizes methods from the list' do
6
+ expect(described_class.pluralize(:SecurityGroupIngress)).to eq('SecurityGroupIngress')
7
+ end
8
+
9
+ it 'pluralizes other methods' do
10
+ expect(described_class.pluralize(:StageKey)).to eq('StageKeys')
11
+ end
12
+ end
13
+
14
+ context '.singularize' do
15
+ it 'singularizes methods from the list' do
16
+ expect(described_class.singularize(:SecurityGroupIngress)).to eq('SecurityGroupIngress')
17
+ end
18
+
19
+ it 'singularizes other methods' do
20
+ expect(described_class.singularize(:StageKeys)).to eq('StageKey')
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Jack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-06 00:00:00.000000000 Z
12
+ date: 2016-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -92,6 +92,8 @@ files:
92
92
  - spec/fixtures/heattest.rb
93
93
  - spec/fixtures/test.rb
94
94
  - spec/jsonable_spec.rb
95
+ - spec/names_spec.rb
96
+ - spec/plurals_spec.rb
95
97
  - spec/resources_spec.rb
96
98
  - spec/spec_helper.rb
97
99
  homepage: https://github.com/stevenjack/cfndsl
@@ -126,5 +128,7 @@ test_files:
126
128
  - spec/fixtures/heattest.rb
127
129
  - spec/fixtures/test.rb
128
130
  - spec/jsonable_spec.rb
131
+ - spec/names_spec.rb
132
+ - spec/plurals_spec.rb
129
133
  - spec/resources_spec.rb
130
134
  - spec/spec_helper.rb