Class: Specinfra::Command::Windows::Base::Firewall

Inherits:
Specinfra::Command::Windows::Base show all
Defined in:
lib/specinfra/command/windows/base/firewall.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Windows::Base

create

Class Method Details

.check_exists(displayName) ⇒ Object



3
4
5
6
# File 'lib/specinfra/command/windows/base/firewall.rb', line 3

def check_exists(displayName)
  cmd = "(Get-NetFirewallRule -DisplayName '#{displayName}') -ne $null"
  create_command cmd
end

.check_has_action(displayName, action) ⇒ Object



13
14
15
16
# File 'lib/specinfra/command/windows/base/firewall.rb', line 13

def check_has_action(displayName, action)
  cmd = "((Get-NetFirewallRule -DisplayName '#{displayName}') | where {$_.Action -eq '#{action}'}) -ne $null"
  create_command cmd
end

.check_has_direction(displayName, direction) ⇒ Object



28
29
30
31
# File 'lib/specinfra/command/windows/base/firewall.rb', line 28

def check_has_direction(displayName, direction)
  cmd = "((Get-NetFirewallRule -DisplayName '#{displayName}') | where {$_.Direction -eq '#{direction}'}) -ne $null"
  create_command cmd
end

.check_has_localport(displayName, localport) ⇒ Object



23
24
25
26
# File 'lib/specinfra/command/windows/base/firewall.rb', line 23

def check_has_localport(displayName, localport)
  cmd = "((Get-NetFirewallRule -DisplayName '#{displayName}') | Get-NetFirewallPortFilter | where {$_.LocalPort -eq '#{localport}'}) -ne $null"
  create_command cmd
end

.check_has_protocol(displayName, protocol) ⇒ Object



18
19
20
21
# File 'lib/specinfra/command/windows/base/firewall.rb', line 18

def check_has_protocol(displayName, protocol)
  cmd = "((Get-NetFirewallRule -DisplayName '#{displayName}') | Get-NetFirewallPortFilter | where {$_.Protocol -eq '#{protocol}'}) -ne $null"
  create_command cmd
end

.check_is_enabled(displayName) ⇒ Object



8
9
10
11
# File 'lib/specinfra/command/windows/base/firewall.rb', line 8

def check_is_enabled(displayName)
  cmd = "((Get-NetFirewallRule -DisplayName '#{displayName}') | where {$_.Enabled -eq 'True'}) -ne $null"
  create_command cmd
end