awspec 0.18.1 → 0.18.2

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: 7b87cfb8b272ff03a8e80f31c85b578e884156b1
4
- data.tar.gz: 4e98b6f864ee384c35c8e2a15f28d1362710d4d2
3
+ metadata.gz: 3e682344fa05836f1d42f59d65a6a132ddf6a6f8
4
+ data.tar.gz: 7086aee13f6c51947d163389e0be7947dc1bb9cd
5
5
  SHA512:
6
- metadata.gz: 40d3944ed0f68234739927d07852017014eac9b21299a78a1ca000e0622d75b19f41639930b73577b640713e023c544d18d7e52f543ecddce5550d65e12670cc
7
- data.tar.gz: 3ce27c40dac0a0369afb7c460f42ef1c56472bd8092e75d094d1dfd3c25f383a037d3e6eeae51ff285be659e8e6982ff9991b8e71a7521a532004ed8f5e6c795
6
+ metadata.gz: 7824001fe5bad247e42685b3d2dc8ebbd528cf7f16137363e3556b8496e3c3615208779fb0d2fbf68e5eba34f029c95d50a067c4794a4d2daaf561f9254192d9
7
+ data.tar.gz: 3d732503a6c12d92ba29c03d59e0a474cdcce104f6476e37ac0f99a8aa7e7dd184f1809caf1bbfd4611bc30359e5effdccd21eddad9056519bc50439787a2277
@@ -154,7 +154,7 @@ describe security_group('my-security-group-name') do
154
154
  end
155
155
  ```
156
156
 
157
- #### its(:ip_permissions_count), its(:ip_permissions_egress_count), its(:owner_id), its(:group_name), its(:group_id), its(:description), its(:vpc_id)
157
+ #### its(:inbound_rule_count), its(:outbound_rule_count), its(:inbound_permissions_count), its(:outbound_permissions_count), its(:owner_id), its(:group_name), its(:group_id), its(:description), its(:vpc_id)
158
158
  ## <a name="vpc">vpc</a>
159
159
 
160
160
  VPC resource type.
@@ -8,7 +8,7 @@ module Awspec::Generator
8
8
  @ret = @type.resource
9
9
  @matchers = ['its(:inbound), its(:outbound)']
10
10
  @ignore_matchers = %w(be_opened be_inbound_opened be_outbound_opened)
11
- @describes = %w(ip_permissions_count ip_permissions_egress_count)
11
+ @describes = %w(inbound_rule_count outbound_rule_count inbound_permissions_count outbound_permissions_count)
12
12
  end
13
13
  end
14
14
  end
@@ -14,6 +14,12 @@ module Awspec::Generator
14
14
 
15
15
  specs = sgs.map do |sg|
16
16
  linespecs = generate_linespecs(sg)
17
+ inbound_rule_count = sg[:ip_permissions].reduce(0) do |sum, permission|
18
+ sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
19
+ end
20
+ outbound_rule_count = sg[:ip_permissions_egress].reduce(0) do |sum, permission|
21
+ sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
22
+ end
17
23
  content = ERB.new(security_group_spec_template, nil, '-').result(binding).gsub(/^\n/, '')
18
24
  end
19
25
  specs.join("\n")
@@ -69,6 +75,8 @@ describe security_group('<%= sg.group_name %>') do
69
75
  <% linespecs.each do |line| %>
70
76
  <%= line %>
71
77
  <% end %>
78
+ its(:inbound_rule_count) { should eq <%= inbound_rule_count %> }
79
+ its(:outbound_rule_count) { should eq <%= outbound_rule_count %> }
72
80
  its(:inbound_permissions_count) { should eq <%= sg.ip_permissions.count %> }
73
81
  its(:outbound_permissions_count) { should eq <%= sg.ip_permissions_egress.count %> }
74
82
  <%- if @vpc_tag_name -%>
@@ -86,6 +86,18 @@ module Awspec::Type
86
86
  end
87
87
  alias_method :outbound_permissions_count, :ip_permissions_egress_count
88
88
 
89
+ def inbound_rule_count
90
+ @resource[:ip_permissions].reduce(0) do |sum, permission|
91
+ sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
92
+ end
93
+ end
94
+
95
+ def outbound_rule_count
96
+ @resource[:ip_permissions_egress].reduce(0) do |sum, permission|
97
+ sum += permission.ip_ranges.count + permission.user_id_group_pairs.count
98
+ end
99
+ end
100
+
89
101
  private
90
102
 
91
103
  def port_between?(port, from_port, to_port)
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.18.1'
2
+ VERSION = '0.18.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.18.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec