Class: Fog::Rackspace::LoadBalancers::LoadBalancer
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::LoadBalancers::LoadBalancer
show all
- Defined in:
- lib/fog/rackspace/models/load_balancers/load_balancer.rb
Constant Summary
collapse
- ACTIVE =
'ACTIVE'
- ERROR =
'ERROR'
- PENDING_UPDATE =
'PENDING_UPDATE'
- PENDING_DELTE =
'PENDING_DELETE'
- SUSPENDED =
'SUSPENDED'
- DELETED =
'DELETED'
- BUILD =
'BUILD'
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#inspect, #reload, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ LoadBalancer
Returns a new instance of LoadBalancer.
31
32
33
34
35
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 31
def initialize(attributes)
@connection = attributes[:connection]
super
end
|
Instance Method Details
#access_rules ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 37
def access_rules
@access_rules ||= begin
Fog::Rackspace::LoadBalancers::AccessRules.new({
:connection => connection,
:load_balancer => self})
end
end
|
#access_rules=(new_access_rules = []) ⇒ Object
45
46
47
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 45
def access_rules=(new_access_rules=[])
access_rules.load(new_access_rules)
end
|
#connection_throttling ⇒ Object
103
104
105
106
107
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 103
def connection_throttling
requires :identity
throttle = connection.get_connection_throttling(identity).body['connectionThrottle']
throttle.count == 0 ? nil : throttle
end
|
#destroy ⇒ Object
139
140
141
142
143
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 139
def destroy
requires :identity
connection.delete_load_balancer(identity)
true
end
|
#disable_connection_logging ⇒ Object
79
80
81
82
83
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 79
def disable_connection_logging
requires :identity
connection.set_connection_logging identity, false
attributes[:connection_logging] = false
end
|
#disable_connection_throttling ⇒ Object
115
116
117
118
119
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 115
def disable_connection_throttling
requires :identity
connection.remove_connection_throttling(identity)
true
end
|
#disable_health_monitor ⇒ Object
97
98
99
100
101
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 97
def disable_health_monitor
requires :identity
connection.remove_monitor(identity)
true
end
|
#disable_session_persistence ⇒ Object
133
134
135
136
137
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 133
def disable_session_persistence
requires :identity
connection.remove_session_persistence(identity)
true
end
|
#enable_connection_logging ⇒ Object
73
74
75
76
77
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 73
def enable_connection_logging
requires :identity
connection.set_connection_logging identity, true
attributes[:connection_logging] = true
end
|
#enable_connection_throttling(max_connections, min_connections, max_connection_rate, rate_interval) ⇒ Object
109
110
111
112
113
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 109
def enable_connection_throttling(max_connections, min_connections, max_connection_rate, rate_interval)
requires :identity
connection.set_connection_throttling(identity, max_connections, min_connections, max_connection_rate, rate_interval)
true
end
|
#enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {}) ⇒ Object
91
92
93
94
95
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 91
def enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {})
requires :identity
connection.set_monitor(identity, type, delay, timeout, attempsBeforeDeactivation, options)
true
end
|
#enable_session_persistence(type) ⇒ Object
127
128
129
130
131
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 127
def enable_session_persistence(type)
requires :identity
connection.set_session_persistence(identity, type)
true
end
|
#error_page ⇒ Object
163
164
165
166
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 163
def error_page
requires :identity
connection.get_error_page(identity).body['errorpage']['content']
end
|
#error_page=(content) ⇒ Object
168
169
170
171
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 168
def error_page=(content)
requires :identity
connection.set_error_page identity, content
end
|
#health_monitor ⇒ Object
85
86
87
88
89
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 85
def health_monitor
requires :identity
monitor = connection.get_monitor(identity).body['healthMonitor']
monitor.count == 0 ? nil : monitor
end
|
#nodes ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 49
def nodes
@nodes ||= begin
Fog::Rackspace::LoadBalancers::Nodes.new({
:connection => connection,
:load_balancer => self})
end
end
|
#nodes=(new_nodes = []) ⇒ Object
57
58
59
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 57
def nodes=(new_nodes=[])
nodes.load(new_nodes)
end
|
#ready? ⇒ Boolean
145
146
147
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 145
def ready?
state == ACTIVE
end
|
#reset_error_page ⇒ Object
173
174
175
176
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 173
def reset_error_page
requires :identity
connection.remove_error_page identity
end
|
#save ⇒ Object
149
150
151
152
153
154
155
156
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 149
def save
if identity
update
else
create
end
true
end
|
#session_persistence ⇒ Object
121
122
123
124
125
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 121
def session_persistence
requires :identity
persistence = connection.get_session_persistence(identity).body['sessionPersistence']
persistence.count == 0 ? nil : persistence
end
|
#usage(options = {}) ⇒ Object
158
159
160
161
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 158
def usage(options = {})
requires :identity
connection.get_load_balancer_usage(identity, options).body
end
|
#virtual_ips ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 61
def virtual_ips
@virtual_ips ||= begin
Fog::Rackspace::LoadBalancers::VirtualIps.new({
:connection => connection,
:load_balancer => self})
end
end
|
#virtual_ips=(new_virtual_ips = []) ⇒ Object
69
70
71
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 69
def virtual_ips=(new_virtual_ips=[])
virtual_ips.load(new_virtual_ips)
end
|