Class: Fog::Compute::ProfitBricks::LoadBalancers

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

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Instance Method Details

#all(datacenter_id) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/fog/profitbricks/models/compute/load_balancers.rb', line 11

def all(datacenter_id)
  result = service.get_all_load_balancers(datacenter_id)

  load_balancers = result.body['items'].each { |volume| volume['datacenter_id'] = datacenter_id }
  result.body['items'] = load_balancers

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

#get(datacenter_id, load_balancer_id) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/fog/profitbricks/models/compute/load_balancers.rb', line 20

def get(datacenter_id, load_balancer_id)
  response = service.get_load_balancer(datacenter_id, load_balancer_id)
  load_balancer = response.body

  load_balancer['datacenter_id'] = datacenter_id
  new(flatten(load_balancer))
end