class Fog::Compute::ProfitBricks::LoadBalancer
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 30 def initialize(attributes = {}) super end
Public Instance Methods
associate_nic(nic_id)
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 101 def associate_nic(nic_id) requires :datacenter_id, :id response = service.associate_nic_to_load_balancer(datacenter_id, id, nic_id) flatten(response.body) end
delete()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 63 def delete requires :datacenter_id, :id service.delete_load_balancer(datacenter_id, id) true end
failed?()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 121 def failed? state == 'ERROR' end
get_nic(nic_id)
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 93 def get_nic(nic_id) requires :datacenter_id, :id response = service.get_load_balanced_nic(datacenter_id, id, nic_id) flatten(response.body) end
list_nics()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 85 def list_nics requires :datacenter_id, :id response = service.get_all_load_balanced_nics(datacenter_id, id) response.body['items'].each { |load_balanced_nic| flatten(load_balanced_nic) } end
ready?()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 117 def ready? state == 'AVAILABLE' end
reload()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 69 def reload requires :datacenter_id, :id data = begin collection.get(datacenter_id, id) rescue Excon::Errors::SocketError nil end return unless data new_attributes = data.attributes merge_attributes(new_attributes) self end
remove_nic_association(nic_id)
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 109 def remove_nic_association(nic_id) requires :datacenter_id, :id service.remove_nic_association(datacenter_id, id, nic_id) true end
save()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 34 def save requires :datacenter_id, :name properties = {} properties[:name] = name if name properties[:ip] = ip if ip properties[:dhcp] = dhcp if dhcp entities = {} entities[:balancednics] = balancednics if balancednics data = service.create_load_balancer(datacenter_id, properties, entities) merge_attributes(flatten(data.body)) true end
update()
click to toggle source
# File lib/fog/profitbricks/models/compute/load_balancer.rb, line 50 def update requires :datacenter_id, :id properties = {} properties[:name] = name if name properties[:ip] = ip if ip properties[:dhcp] = dhcp if dhcp data = service.update_load_balancer(datacenter_id, id, properties) merge_attributes(data.body) true end