awspec 0.27.1 → 0.27.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9042af61aec1b5df8eeb34f52f8b17eecdbf2da
4
- data.tar.gz: 57937ca1298ac6b179bfe2855e217cebf60228c0
3
+ metadata.gz: cdaf7283fd3ad83496a8d7e26f99250fda35c333
4
+ data.tar.gz: f91c17c13d033c634c758ce807f5c4dedec8f5ae
5
5
  SHA512:
6
- metadata.gz: 6e53b2835ec1ee1f8b5a9f5694fec805a82f1ef2da866a9b3c53d1328c41a0c2c0df723ef1dc631dbcfa45626a968c3c037ea15a94b3c84cf3d5f6438088afa9
7
- data.tar.gz: c0eb65762353fbfe117c1355520e16f806cfda3de8e5c78037f4cd17101034196657514be631e4d8232ddc87bf258c5ef3e40f068509b76b065f4ce78499977a
6
+ metadata.gz: 74d3b19c417e76c287b62575cc0115eb54b96157eaa8996eefbe666fc86f9ba8fb8f3b68bb7284c5c5142d1880df5ee7345007a22cdcbbd25f34044cf932d42f
7
+ data.tar.gz: a3e07e7c7b5ab90415e6bba0e0fee0c8c223f42c6aa026e799dd5e1e2a7dcf3b66331523f5746d8044e8f0369a5be8f62070f022d830e0a87fa283272b9b7280
@@ -202,7 +202,7 @@ end
202
202
  ```
203
203
 
204
204
 
205
- ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:copy_tags_to_snapshot)
205
+ ### its(:vpc_id), its(:db_instance_identifier), its(:db_instance_class), its(:engine), its(:db_instance_status), its(:master_username), its(:db_name), its(:endpoint), its(:allocated_storage), its(:instance_create_time), its(:preferred_backup_window), its(:backup_retention_period), its(:availability_zone), its(:preferred_maintenance_window), its(:pending_modified_values), its(:latest_restorable_time), its(:multi_az), its(:engine_version), its(:auto_minor_version_upgrade), its(:read_replica_source_db_instance_identifier), its(:license_model), its(:iops), its(:character_set_name), its(:secondary_availability_zone), its(:publicly_accessible), its(:storage_type), its(:tde_credential_arn), its(:db_instance_port), its(:db_cluster_identifier), its(:storage_encrypted), its(:kms_key_id), its(:dbi_resource_id), its(:ca_certificate_identifier), its(:copy_tags_to_snapshot), its(:monitoring_interval), its(:enhanced_monitoring_resource_arn), its(:monitoring_role_arn)
206
206
  ### :unlock: Advanced use
207
207
 
208
208
  `rds` can use `Aws::RDS::DBInstance` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/RDS/DBInstance.html).
@@ -32,6 +32,9 @@ module Awspec::Generator
32
32
  connection = find_vpc_peering_connection(route.vpc_peering_connection_id)
33
33
  linespecs.push(ERB.new(route_table_spec_connection_linetemplate, nil, '-').result(binding)) if connection
34
34
  end
35
+ if route.nat_gateway_id
36
+ linespecs.push(ERB.new(route_table_spec_nat_linetemplate, nil, '-').result(binding))
37
+ end
35
38
  end
36
39
  linespecs
37
40
  end
@@ -77,6 +80,13 @@ EOF
77
80
  end
78
81
  # rubocop:enable Metrics/LineLength
79
82
 
83
+ def route_table_spec_nat_linetemplate
84
+ template = <<-'EOF'
85
+ it { should have_route('<%= route.destination_cidr_block %>').target(nat: '<%= route.nat_gateway_id %>') }
86
+ EOF
87
+ template
88
+ end
89
+
80
90
  def route_table_spec_subnet_linetemplate
81
91
  template = <<-'EOF'
82
92
  <%- if subnet.tag_name -%>
@@ -42,8 +42,8 @@ module Awspec::Helper
42
42
  })
43
43
  end
44
44
 
45
- # fine_internet_gateway fine_vpn_gateway fine_customer_gateway
46
- gateway_types = %w(internet vpn cutromer)
45
+ # find_internet_gateway find_vpn_gateway find_customer_gateway find_nat_gateway
46
+ gateway_types = %w(internet vpn customer nat)
47
47
  gateway_types.each do |type|
48
48
  define_method 'find_' + type + '_gateway' do |*args|
49
49
  gateway_id = args.first
@@ -7,13 +7,14 @@ RSpec::Matchers.define :have_route do |destination|
7
7
  else
8
8
  @destination = destination
9
9
  end
10
- route_table.has_route?(@destination, @gateway_id, @instance_id, @vpc_peering_connection_id)
10
+ route_table.has_route?(@destination, @gateway_id, @instance_id, @vpc_peering_connection_id, @nat_gateway_id)
11
11
  end
12
12
 
13
13
  chain :target do |target|
14
14
  @gateway_id = target[:gateway]
15
15
  @instance_id = target[:instance]
16
16
  @vpc_peering_connection_id = target[:vpc_peering_connection]
17
+ @nat_gateway_id = target[:nat]
17
18
  end
18
19
 
19
20
  chain :destination do |dest|
@@ -67,6 +67,7 @@ Aws.config[:ec2] = {
67
67
  gateway_id: 'local',
68
68
  instance_id: nil,
69
69
  instance_owner_id: nil,
70
+ nat_gateway_id: nil,
70
71
  network_interface_id: nil,
71
72
  vpc_peering_connection_id: nil,
72
73
  state: 'active'
@@ -77,6 +78,7 @@ Aws.config[:ec2] = {
77
78
  gateway_id: 'igw-1ab2345c',
78
79
  instance_id: nil,
79
80
  instance_owner_id: nil,
81
+ nat_gateway_id: nil,
80
82
  network_interface_id: nil,
81
83
  vpc_peering_connection_id: nil,
82
84
  state: 'active'
@@ -87,6 +89,7 @@ Aws.config[:ec2] = {
87
89
  gateway_id: nil,
88
90
  instance_id: 'i-ec12345a',
89
91
  instance_owner_id: nil,
92
+ nat_gateway_id: nil,
90
93
  network_interface_id: nil,
91
94
  vpc_peering_connection_id: nil,
92
95
  state: 'active'
@@ -97,9 +100,21 @@ Aws.config[:ec2] = {
97
100
  gateway_id: nil,
98
101
  instance_id: nil,
99
102
  instance_owner_id: nil,
103
+ nat_gateway_id: nil,
100
104
  network_interface_id: nil,
101
105
  vpc_peering_connection_id: 'pcx-c56789de',
102
106
  state: 'active'
107
+ },
108
+ {
109
+ destination_cidr_block: '192.168.3.0/24',
110
+ destination_prefix_list_id: nil,
111
+ gateway_id: nil,
112
+ instance_id: nil,
113
+ instance_owner_id: nil,
114
+ nat_gateway_id: 'nat-7ff7777f',
115
+ network_interface_id: nil,
116
+ vpc_peering_connection_id: nil,
117
+ state: 'active'
103
118
  }
104
119
  ],
105
120
  associations: [
@@ -155,6 +170,15 @@ Aws.config[:ec2] = {
155
170
  }
156
171
  ]
157
172
  },
173
+ describe_nat_gateways: {
174
+ nat_gateways: [
175
+ {
176
+ nat_gateway_id: 'nat-7ff7777f',
177
+ vpc_id: 'vpc-ab123cde',
178
+ state: 'available'
179
+ }
180
+ ]
181
+ },
158
182
  describe_vpc_peering_connections: {
159
183
  vpc_peering_connections: [
160
184
  {
@@ -8,7 +8,11 @@ module Awspec::Type
8
8
  @id = @resource_via_client[:route_table_id] if @resource_via_client
9
9
  end
10
10
 
11
- def has_route?(destination, gateway_id = nil, instance_id = nil, vpc_peering_connection_id = nil)
11
+ def has_route?(destination,
12
+ gateway_id = nil,
13
+ instance_id = nil,
14
+ vpc_peering_connection_id = nil,
15
+ nat_gateway_id = nil)
12
16
  @resource_via_client.routes.find do |route|
13
17
  if destination
14
18
  next false unless route.destination_cidr_block == destination
@@ -16,6 +20,7 @@ module Awspec::Type
16
20
  next target_gateway?(route, gateway_id) if gateway_id
17
21
  next target_instance?(route, instance_id) if instance_id
18
22
  next target_vpc_peering_connection?(route, vpc_peering_connection_id) if vpc_peering_connection_id
23
+ next target_nat?(route, nat_gateway_id) if nat_gateway_id
19
24
  end
20
25
  end
21
26
 
@@ -41,6 +46,8 @@ module Awspec::Type
41
46
  # customer gateway
42
47
  cgw = find_customer_gateway(gateway_id)
43
48
  return true if cgw && cgw.tag_name == gateway_id
49
+ # nat gateway
50
+ return true if route.nat_gateway_id == gateway_id
44
51
  false
45
52
  end
46
53
 
@@ -52,6 +59,11 @@ module Awspec::Type
52
59
  false
53
60
  end
54
61
 
62
+ def target_nat?(route, nat_gateway_id)
63
+ # nat
64
+ route.nat_gateway_id == nat_gateway_id
65
+ end
66
+
55
67
  def target_vpc_peering_connection?(route, vpc_peering_connection_id)
56
68
  # vpc_peering_connection_id
57
69
  return true if route.vpc_peering_connection_id == vpc_peering_connection_id
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.27.1'
2
+ VERSION = '0.27.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.1
4
+ version: 0.27.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec