Class: Fog::Compute::ProfitBricks::LoadBalancer
Instance Method Summary
collapse
#flatten
#request_status, #wait_for
Constructor Details
#initialize(attributes = {}) ⇒ LoadBalancer
Returns a new instance of LoadBalancer.
28
29
30
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 28
def initialize(attributes = {})
super
end
|
Instance Method Details
#associate_nic(nic_id) ⇒ Object
99
100
101
102
103
104
105
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 99
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 ⇒ Object
61
62
63
64
65
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 61
def delete
requires :datacenter_id, :id
service.delete_load_balancer(datacenter_id, id)
true
end
|
#failed? ⇒ Boolean
119
120
121
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 119
def failed?
state == 'ERROR'
end
|
#get_nic(nic_id) ⇒ Object
91
92
93
94
95
96
97
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 91
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 ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 83
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? ⇒ Boolean
115
116
117
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 115
def ready?
state == 'AVAILABLE'
end
|
#reload ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 67
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) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 107
def remove_nic_association(nic_id)
requires :datacenter_id, :id
service.remove_nic_association(datacenter_id, id, nic_id)
true
end
|
#save ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 32
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 ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/fog/profitbricks/models/compute/load_balancer.rb', line 48
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
|