Class: Fog::Compute::ProfitBricks::FirewallRules

Inherits:
Fog::Collection
  • Object
show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/firewall_rules.rb

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#all(datacenter_id, server_id, nic_id) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fog/profitbricks/models/compute/firewall_rules.rb', line 11

def all(datacenter_id, server_id, nic_id)
  result = service.get_all_firewall_rules(datacenter_id, server_id, nic_id)

  firewall_rules = result.body['items'].each do |fwr|
    fwr['datacenter_id'] = datacenter_id
    fwr['server_id']      = server_id
    fwr['nic_id']         = nic_id
  end

  result.body['items'] = firewall_rules

  load(result.body['items'].each { |fwr| flatten(fwr) })
end

#get(datacenter_id, server_id, nic_id, firewall_rule_id) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/fog/profitbricks/models/compute/firewall_rules.rb', line 25

def get(datacenter_id, server_id, nic_id, firewall_rule_id)
  firewall_rule = service.get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id).body

  firewall_rule['datacenter_id'] = datacenter_id
  firewall_rule['server_id']      = server_id
  firewall_rule['nic_id']         = nic_id

  new(flatten(firewall_rule))
end