convection 0.2.19 → 0.2.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7691882298457c14216a9a9263752a59986fd89
4
- data.tar.gz: 649bb279293a6a105af1a551da8478874d4084b3
3
+ metadata.gz: f87de219d4fc032f2a8572a29e659c04e0b8d0bf
4
+ data.tar.gz: 8a41f0823d8b246c7a2b4f899150462b10ba788a
5
5
  SHA512:
6
- metadata.gz: 386adaef1016a1f7b3571d921cd591b049284695d9b48b2cf2a8457069c8ec090c3c0f2a5569948a5e48bc38a3911e3107748b702dee03c6727c57ff7537b2f9
7
- data.tar.gz: 1e9fffdbfa4eff38923cd3ba8797bb8431903efcd845e6ecaee6386634a8ef1768d7ab678e5ee9de97cf69c4752bdf56ec0dc040c6cf33229d52311b82f27eda
6
+ metadata.gz: 6f0b4bb4091881c0d9168c2794e2dc03248cf0581ab4320cc88f46387ce24a48b5a36c5d149dea463c9fc9f97683aff85a38d14af5b68bee527fce5da6e62791
7
+ data.tar.gz: 15e53fcd02858735b88d9da7b8368b524de8028c147a687e42f719b70505ca2076c921e09e769980d557cafeca55566f275d818b59d179ea69c6b84ba8e77b3e
@@ -0,0 +1,41 @@
1
+ require 'forwardable'
2
+ require_relative '../resource'
3
+
4
+ module Convection
5
+ module Model
6
+ class Template
7
+ class Resource
8
+ ##
9
+ # AWS::EC2::VpcEndpoint
10
+ ##
11
+ class EC2VPCEndpoint < Resource
12
+ extend Forwardable
13
+
14
+ type 'AWS::EC2::VPCEndpoint'
15
+ property :vpc, 'VpcId'
16
+ property :route_tables, 'RouteTableIds', :type => :list
17
+ property :service_name, 'ServiceName'
18
+ attr_reader :document # , 'PolicyDocument'
19
+
20
+ def_delegators :@document, :allow, :deny, :id, :version, :statement
21
+ def_delegator :@document, :name, :policy_name
22
+
23
+ def initialize(*args)
24
+ super
25
+ @document = Model::Mixin::Policy.new(:name => false, :template => @template)
26
+ end
27
+
28
+ def service(val)
29
+ properties['ServiceName'].set(join('', 'com.amazonaws.', fn_ref('AWS::Region'), val))
30
+ end
31
+
32
+ def render
33
+ super.tap do |r|
34
+ document.render(r['Properties'])
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+ require 'json'
3
+ require 'pp'
4
+
5
+ class TestVpcEndpoint < Minitest::Test
6
+ def setup
7
+ @template = ::Convection.template do
8
+ description 'VPC Endpoint Test Template'
9
+
10
+ ec2_vpc_endpoint 'TestVpcEndpoint' do
11
+ service 's3'
12
+ vpc 'vpc-foo'
13
+ route_tables %w(table1 table2)
14
+
15
+ allow do
16
+ s3_resource 'bucket-bar', '*'
17
+ action 's3:GetObject'
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ def from_json
24
+ JSON.parse(@template.to_json)
25
+ end
26
+
27
+ def test_endpoint
28
+ json = from_json['Resources']
29
+
30
+ endpoint = json['TestVpcEndpoint']
31
+ refute endpoint.nil?, 'VpcEndpoint not present in generated template'
32
+
33
+ props = endpoint['Properties']
34
+ assert_equal 'vpc-foo', props['VpcId']
35
+
36
+ service_name = props['ServiceName']
37
+ refute service_name.nil?, 'ServiceName not present in generated template'
38
+
39
+ assert service_name.is_a? Hash
40
+ s3_string_arr = service_name['Fn::Join']
41
+ refute s3_string_arr.nil?, 'ServiceName value is not specified as a string array'
42
+
43
+ assert s3_string_arr.is_a? Array
44
+ s3_path_as_array = s3_string_arr[1]
45
+ refute s3_path_as_array.nil?, "The path for S3 should be defined as an array in #{s3_string_arr}"
46
+
47
+ assert s3_path_as_array.last == 's3', "ServiceName (#{s3_path_as_array}) does not contain \'s3\' as final element"
48
+ end
49
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -148,6 +148,7 @@ files:
148
148
  - lib/convection/model/template/resource/aws_ec2_subnet_route_table_association.rb
149
149
  - lib/convection/model/template/resource/aws_ec2_volume.rb
150
150
  - lib/convection/model/template/resource/aws_ec2_vpc.rb
151
+ - lib/convection/model/template/resource/aws_ec2_vpc_endpoint.rb
151
152
  - lib/convection/model/template/resource/aws_ec2_vpc_gateway_attachment.rb
152
153
  - lib/convection/model/template/resource/aws_elasticache_cluster.rb
153
154
  - lib/convection/model/template/resource/aws_elasticache_parameter_group.rb
@@ -209,6 +210,7 @@ files:
209
210
  - test/convection/model/test_rds.rb
210
211
  - test/convection/model/test_template.rb
211
212
  - test/convection/model/test_validation.rb
213
+ - test/convection/model/test_vpc_endpoint.rb
212
214
  - test/test_helper.rb
213
215
  homepage: https://github.com/rapid7/convection
214
216
  licenses:
@@ -242,4 +244,5 @@ test_files:
242
244
  - test/convection/model/test_rds.rb
243
245
  - test/convection/model/test_template.rb
244
246
  - test/convection/model/test_validation.rb
247
+ - test/convection/model/test_vpc_endpoint.rb
245
248
  - test/test_helper.rb