Class: Awful::WAF::Ipset
Instance Method Summary
collapse
Methods inherited from Base
#change
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
25
26
27
28
29
30
31
32
33
|
# File 'lib/awful/waf_ipset.rb', line 25
def get(id)
waf.get_ip_set(ip_set_id: id).ip_set.ip_set_descriptors.output do |ipsets|
if options[:long]
print_table ipsets.map { |i| [i.value, i.type] }
else
puts ipsets.map(&:value)
end
end
end
|
13
14
15
16
17
18
19
20
21
|
# File 'lib/awful/waf_ipset.rb', line 13
def ls
list_thing(:ip_sets).output do |ipsets|
if options[:long]
print_table ipsets.map { |i| [i.name, i.ip_set_id] }
else
puts ipsets.map(&:name)
end
end
end
|
#update(id, *values) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/awful/waf_ipset.rb', line 38
def update(id, *values)
waf.update_ip_set(
ip_set_id: id,
change_token: change_token,
updates: values.map do |value|
{
action: options[:delete] ? 'DELETE' : 'INSERT',
ip_set_descriptor: {
type: options[:type].upcase,
value: value
}
}
end
)
end
|