Module: Y2Firewall::Firewalld::Api::Services

Included in:
Y2Firewall::Firewalld::Api
Defined in:
library/network/src/lib/y2firewall/firewalld/api/services.rb

Overview

This module contains specific api methods for handling services definition and configuration.

Instance Method Summary collapse

Instance Method Details

#add_service_port(service, port, permanent: permanent?) ) ⇒ Boolean

command to be executed


112
113
114
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 112

def add_service_port(service, port, permanent: permanent?)
  string_command("--service=#{service}", "--add-port=#{port}", permanent: permanent)
end

#info_service(service, permanent: permanent?) ) ⇒ Array<String>

command to be executed


47
48
49
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 47

def info_service(service, permanent: permanent?)
  string_command("--info-service", service.to_s, permanent: permanent).split("\n")
end

#new_service(service, permanent: permanent?) ) ⇒ Object

command to be executed


34
35
36
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 34

def new_service(service, permanent: permanent?)
  query_command("--new-service=#{service}", permanent: permanent)
end

#remove_service_port(service, port, permanent: permanent?) ) ⇒ Boolean

command to be executed


103
104
105
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 103

def remove_service_port(service, port, permanent: permanent?)
  string_command("--service=#{service}", "--remove-port=#{port}", permanent: permanent)
end

#service_description(service, permanent: permanent?) ) ⇒ String

command to be executed


64
65
66
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 64

def service_description(service, permanent: permanent?)
  string_command("--service=#{service}", "--get-description", permanent: permanent)
end

#service_modules(service, permanent: permanent?) ) ⇒ Array<String>

command to be executed


94
95
96
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 94

def service_modules(service, permanent: permanent?)
  string_command("--service=#{service}", "--get-modules", permanent: permanent).split(" ")
end

#service_ports(service, permanent: permanent?) ) ⇒ Array<String>

command to be executed


78
79
80
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 78

def service_ports(service, permanent: permanent?)
  string_command("--service=#{service}", "--get-ports", permanent: permanent).split(" ")
end

#service_protocols(service, permanent: permanent?) ) ⇒ Array<String>

command to be executed


86
87
88
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 86

def service_protocols(service, permanent: permanent?)
  string_command("--service=#{service}", "--get-protocols", permanent: permanent).split(" ")
end

#service_short(service, permanent: permanent?) ) ⇒ String

command to be executed


55
56
57
58
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 55

def service_short(service, permanent: permanent?)
  # these may not exist on early firewalld releases
  string_command("--service=#{service}", "--get-short", permanent: permanent)
end

#service_supported?(service) ⇒ Boolean


70
71
72
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 70

def service_supported?(service)
  services.include?(service)
end

#servicesArray<String>


39
40
41
# File 'library/network/src/lib/y2firewall/firewalld/api/services.rb', line 39

def services
  string_command("--get-services").split(" ")
end