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, #service
Instance Method Summary
collapse
-
#access_rules ⇒ Object
-
#access_rules=(new_access_rules = []) ⇒ Object
-
#connection_throttling ⇒ Object
-
#content_caching ⇒ Object
-
#destroy ⇒ Object
-
#disable_connection_logging ⇒ Object
-
#disable_connection_throttling ⇒ Object
-
#disable_content_caching ⇒ Object
-
#disable_health_monitor ⇒ Object
-
#disable_session_persistence ⇒ Object
-
#disable_ssl_termination ⇒ Object
-
#enable_connection_logging ⇒ Object
-
#enable_connection_throttling(max_connections, min_connections, max_connection_rate, rate_interval) ⇒ Object
-
#enable_content_caching ⇒ Object
-
#enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {}) ⇒ Object
-
#enable_session_persistence(type) ⇒ Object
-
#enable_ssl_termination(securePort, privatekey, certificate, options = {}) ⇒ Object
-
#error_page ⇒ Object
-
#error_page=(content) ⇒ Object
-
#health_monitor ⇒ Object
-
#initialize(attributes) ⇒ LoadBalancer
constructor
A new instance of LoadBalancer.
-
#nodes ⇒ Object
-
#nodes=(new_nodes = []) ⇒ Object
-
#ready? ⇒ Boolean
-
#reset_error_page ⇒ Object
-
#save ⇒ Object
-
#session_persistence ⇒ Object
-
#ssl_termination ⇒ Object
-
#usage(options = {}) ⇒ Object
-
#virtual_ips ⇒ Object
-
#virtual_ips=(new_virtual_ips = []) ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ LoadBalancer
Returns a new instance of LoadBalancer.
31
32
33
34
35
36
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 31
def initialize(attributes)
@service = attributes[:service] || attributes[:connection]
super
end
|
Instance Method Details
#access_rules ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 38
def access_rules
@access_rules ||= begin
Fog::Rackspace::LoadBalancers::AccessRules.new({
:service => service,
:load_balancer => self})
end
end
|
#access_rules=(new_access_rules = []) ⇒ Object
46
47
48
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 46
def access_rules=(new_access_rules=[])
access_rules.load(new_access_rules)
end
|
#connection_throttling ⇒ Object
138
139
140
141
142
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 138
def connection_throttling
requires :identity
throttle = service.get_connection_throttling(identity).body['connectionThrottle']
throttle.count == 0 ? nil : throttle
end
|
#content_caching ⇒ Object
103
104
105
106
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 103
def content_caching
requires :identity
connection.get_content_caching(identity).body['contentCaching']['enabled']
end
|
#destroy ⇒ Object
174
175
176
177
178
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 174
def destroy
requires :identity
service.delete_load_balancer(identity)
true
end
|
#disable_connection_logging ⇒ Object
114
115
116
117
118
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 114
def disable_connection_logging
requires :identity
service.set_connection_logging identity, false
attributes[:connection_logging] = false
end
|
#disable_connection_throttling ⇒ Object
150
151
152
153
154
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 150
def disable_connection_throttling
requires :identity
service.remove_connection_throttling(identity)
true
end
|
#disable_content_caching ⇒ Object
97
98
99
100
101
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 97
def disable_content_caching
requires :identity
connection.set_content_caching identity, false
true
end
|
#disable_health_monitor ⇒ Object
132
133
134
135
136
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 132
def disable_health_monitor
requires :identity
service.remove_monitor(identity)
true
end
|
#disable_session_persistence ⇒ Object
168
169
170
171
172
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 168
def disable_session_persistence
requires :identity
service.remove_session_persistence(identity)
true
end
|
#disable_ssl_termination ⇒ Object
74
75
76
77
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 74
def disable_ssl_termination
requires :identity
service.remove_ssl_termination(identity)
end
|
#enable_connection_logging ⇒ Object
108
109
110
111
112
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 108
def enable_connection_logging
requires :identity
service.set_connection_logging identity, true
attributes[:connection_logging] = true
end
|
#enable_connection_throttling(max_connections, min_connections, max_connection_rate, rate_interval) ⇒ Object
144
145
146
147
148
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 144
def enable_connection_throttling(max_connections, min_connections, max_connection_rate, rate_interval)
requires :identity
service.set_connection_throttling(identity, max_connections, min_connections, max_connection_rate, rate_interval)
true
end
|
#enable_content_caching ⇒ Object
91
92
93
94
95
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 91
def enable_content_caching
requires :identity
connection.set_content_caching identity, true
true
end
|
#enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {}) ⇒ Object
126
127
128
129
130
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 126
def enable_health_monitor(type, delay, timeout, attempsBeforeDeactivation, options = {})
requires :identity
service.set_monitor(identity, type, delay, timeout, attempsBeforeDeactivation, options)
true
end
|
#enable_session_persistence(type) ⇒ Object
162
163
164
165
166
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 162
def enable_session_persistence(type)
requires :identity
service.set_session_persistence(identity, type)
true
end
|
#enable_ssl_termination(securePort, privatekey, certificate, options = {}) ⇒ Object
69
70
71
72
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 69
def enable_ssl_termination(securePort, privatekey, certificate, options = {})
requires :identity
service.set_ssl_termination(identity, securePort, privatekey, certificate, options)
end
|
#error_page ⇒ Object
198
199
200
201
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 198
def error_page
requires :identity
service.get_error_page(identity).body['errorpage']['content']
end
|
#error_page=(content) ⇒ Object
203
204
205
206
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 203
def error_page=(content)
requires :identity
service.set_error_page identity, content
end
|
#health_monitor ⇒ Object
120
121
122
123
124
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 120
def health_monitor
requires :identity
monitor = service.get_monitor(identity).body['healthMonitor']
monitor.count == 0 ? nil : monitor
end
|
#nodes ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 50
def nodes
@nodes ||= begin
Fog::Rackspace::LoadBalancers::Nodes.new({
:service => service,
:load_balancer => self})
end
end
|
#nodes=(new_nodes = []) ⇒ Object
58
59
60
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 58
def nodes=(new_nodes=[])
nodes.load(new_nodes)
end
|
#ready? ⇒ Boolean
180
181
182
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 180
def ready?
state == ACTIVE
end
|
#reset_error_page ⇒ Object
208
209
210
211
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 208
def reset_error_page
requires :identity
service.remove_error_page identity
end
|
#save ⇒ Object
184
185
186
187
188
189
190
191
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 184
def save
if persisted?
update
else
create
end
true
end
|
#session_persistence ⇒ Object
156
157
158
159
160
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 156
def session_persistence
requires :identity
persistence = service.get_session_persistence(identity).body['sessionPersistence']
persistence.count == 0 ? nil : persistence
end
|
#ssl_termination ⇒ Object
62
63
64
65
66
67
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 62
def ssl_termination
requires :identity
ssl_termination = service.get_ssl_termination(identity).body['sslTermination']
rescue Fog::Rackspace::LoadBalancers::NotFound
nil
end
|
#usage(options = {}) ⇒ Object
193
194
195
196
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 193
def usage(options = {})
requires :identity
service.get_load_balancer_usage(identity, options).body
end
|
#virtual_ips ⇒ Object
79
80
81
82
83
84
85
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 79
def virtual_ips
@virtual_ips ||= begin
Fog::Rackspace::LoadBalancers::VirtualIps.new({
:service => service,
:load_balancer => self})
end
end
|
#virtual_ips=(new_virtual_ips = []) ⇒ Object
87
88
89
|
# File 'lib/fog/rackspace/models/load_balancers/load_balancer.rb', line 87
def virtual_ips=(new_virtual_ips=[])
virtual_ips.load(new_virtual_ips)
end
|