Class: Brightbox::FirewallRule
- Inherits:
-
Api
- Object
- Api
- Brightbox::FirewallRule
show all
- Defined in:
- lib/brightbox-cli/firewall_rule.rb
Instance Attribute Summary collapse
Attributes inherited from Api
#id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api
cache_all!, cached_get, conn, #created_on, #exists?, find, find_all_or_warn, find_by_handle, find_or_call, #fog_attributes, #fog_model, #initialize, klass_name, #method_missing, #respond_to_missing?, #to_s
Constructor Details
This class inherits a constructor from Brightbox::Api
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Brightbox::Api
Instance Attribute Details
#attributes ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 21
def attributes
(@attributes || fog_attributes).tap do |attrs|
attrs[:sport] = attrs[:source_port]
attrs[:dport] = attrs[:destination_port]
attrs[:firewall_policy] = attrs[:firewall_policy_id]
attrs[:icmp_type] = attrs[:icmp_type_name]
end
end
|
Class Method Details
.create(options) ⇒ Object
7
8
9
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 7
def self.create(options)
new(conn.firewall_rules.create(options))
end
|
.default_field_order ⇒ Object
41
42
43
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 41
def self.default_field_order
%i[id protocol source sport destination dport icmp_type description]
end
|
.get(id) ⇒ Object
11
12
13
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 11
def self.get(id)
conn.firewall_rules.get(id)
end
|
.require_account? ⇒ Boolean
4
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 4
def self.require_account?; true; end
|
Instance Method Details
#to_row ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 30
def to_row
attributes.merge(
protocol: attributes[:protocol] || "-",
source: attributes[:source] || "-",
sport: attributes[:sport] || "-",
destination: attributes[:destination] || "-",
dport: attributes[:dport] || "-",
icmp_type: attributes[:icmp_type] || "-"
)
end
|
#update(params) ⇒ Object
15
16
17
18
19
|
# File 'lib/brightbox-cli/firewall_rule.rb', line 15
def update(params)
self.class.conn.update_firewall_rule id, params
reload
self
end
|