Class: Saklient::Cloud::Resources::LbServer
- Inherits:
-
Object
- Object
- Saklient::Cloud::Resources::LbServer
- Defined in:
- lib/saklient/cloud/resources/lb_server.rb
Overview
ロードバランサの監視対象サーバ設定.
Instance Attribute Summary collapse
-
#active_connections ⇒ Fixnum
readonly
現在の接続数.
-
#enabled ⇒ bool
有効状態.
-
#ip_address ⇒ String
IPアドレス.
-
#path_to_check ⇒ String
監視対象パス.
-
#port ⇒ Fixnum
ポート番号.
-
#protocol ⇒ String
監視方法.
-
#response_expected ⇒ Fixnum
監視時に期待されるレスポンスコード.
-
#status ⇒ String
readonly
現在の状態.
Instance Method Summary collapse
- #get_active_connections ⇒ Fixnum
- #get_enabled ⇒ bool
- #get_ip_address ⇒ String
- #get_path_to_check ⇒ String
- #get_port ⇒ Fixnum
- #get_protocol ⇒ String
- #get_response_expected ⇒ Fixnum
- #get_status ⇒ String
-
#initialize(obj = nil) ⇒ LbServer
constructor
A new instance of LbServer.
- #set_enabled(v) ⇒ bool
- #set_ip_address(v) ⇒ String
- #set_path_to_check(v) ⇒ String
- #set_port(v) ⇒ Fixnum
- #set_protocol(v) ⇒ String
- #set_response_expected(v) ⇒ Fixnum
- #to_raw_settings ⇒ any
- #update_status(obj) ⇒ LbServer
Constructor Details
#initialize(obj = nil) ⇒ LbServer
Returns a new instance of LbServer.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 278 def initialize(obj = nil) obj = {} if (obj).nil? health = Saklient::Util::get_by_path_any([obj], [ 'HealthCheck', 'healthCheck', 'health_check', 'health' ]) enabled = Saklient::Util::get_by_path_any([obj], ['Enabled', 'enabled']) @_enabled = nil if !(enabled).nil? enabledStr = enabled @_enabled = enabledStr.downcase() == 'true' end @_ip_address = Saklient::Util::get_by_path_any([obj], [ 'IPAddress', 'ipAddress', 'ip_address', 'ip' ]) @_protocol = Saklient::Util::get_by_path_any([health, obj], ['Protocol', 'protocol']) @_path_to_check = Saklient::Util::get_by_path_any([health, obj], [ 'Path', 'path', 'pathToCheck', 'path_to_check' ]) port = Saklient::Util::get_by_path_any([obj], ['Port', 'port']) @_port = nil @_port = (port).to_s().to_i(10) if !(port).nil? @_port = nil if @_port == 0 responseExpected = Saklient::Util::get_by_path_any([health, obj], [ 'Status', 'status', 'responseExpected', 'response_expected' ]) @_response_expected = nil @_response_expected = (responseExpected).to_s().to_i(10) if !(responseExpected).nil? @_response_expected = nil if @_response_expected == 0 @_active_connections = 0 @_status = nil end |
Instance Attribute Details
#active_connections ⇒ Fixnum (readonly)
現在の接続数
247 248 249 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 247 def active_connections @active_connections end |
#enabled ⇒ bool
有効状態
40 41 42 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 40 def enabled @enabled end |
#ip_address ⇒ String
IPアドレス
76 77 78 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 76 def ip_address @ip_address end |
#path_to_check ⇒ String
監視対象パス
184 185 186 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 184 def path_to_check @path_to_check end |
#port ⇒ Fixnum
ポート番号
112 113 114 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 112 def port @port end |
#protocol ⇒ String
監視方法
148 149 150 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 148 def protocol @protocol end |
#response_expected ⇒ Fixnum
監視時に期待されるレスポンスコード
220 221 222 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 220 def response_expected @response_expected end |
#status ⇒ String (readonly)
現在の状態
270 271 272 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 270 def status @status end |
Instance Method Details
#get_active_connections ⇒ Fixnum
240 241 242 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 240 def get_active_connections return @_active_connections end |
#get_enabled ⇒ bool
24 25 26 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 24 def get_enabled return @_enabled end |
#get_ip_address ⇒ String
60 61 62 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 60 def get_ip_address return @_ip_address end |
#get_path_to_check ⇒ String
168 169 170 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 168 def get_path_to_check return @_path_to_check end |
#get_port ⇒ Fixnum
96 97 98 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 96 def get_port return @_port end |
#get_protocol ⇒ String
132 133 134 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 132 def get_protocol return @_protocol end |
#get_response_expected ⇒ Fixnum
204 205 206 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 204 def get_response_expected return @_response_expected end |
#get_status ⇒ String
263 264 265 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 263 def get_status return @_status end |
#set_enabled(v) ⇒ bool
31 32 33 34 35 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 31 def set_enabled(v) Saklient::Util::validate_type(v, 'bool') @_enabled = v return @_enabled end |
#set_ip_address(v) ⇒ String
67 68 69 70 71 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 67 def set_ip_address(v) Saklient::Util::validate_type(v, 'String') @_ip_address = v return @_ip_address end |
#set_path_to_check(v) ⇒ String
175 176 177 178 179 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 175 def set_path_to_check(v) Saklient::Util::validate_type(v, 'String') @_path_to_check = v return @_path_to_check end |
#set_port(v) ⇒ Fixnum
103 104 105 106 107 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 103 def set_port(v) Saklient::Util::validate_type(v, 'Fixnum') @_port = v return @_port end |
#set_protocol(v) ⇒ String
139 140 141 142 143 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 139 def set_protocol(v) Saklient::Util::validate_type(v, 'String') @_protocol = v return @_protocol end |
#set_response_expected(v) ⇒ Fixnum
211 212 213 214 215 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 211 def set_response_expected(v) Saklient::Util::validate_type(v, 'Fixnum') @_response_expected = v return @_response_expected end |
#to_raw_settings ⇒ any
323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 323 def to_raw_settings return { Enabled: (@_enabled).nil? ? nil : (@_enabled ? 'True' : 'False'), IPAddress: @_ip_address, Port: @_port, HealthCheck: { Protocol: @_protocol, Path: @_path_to_check, Status: @_response_expected } } end |
#update_status(obj) ⇒ LbServer
339 340 341 342 343 344 345 346 |
# File 'lib/saklient/cloud/resources/lb_server.rb', line 339 def update_status(obj) connStr = obj[:ActiveConn] @_active_connections = 0 @_active_connections = (connStr).to_s().to_i(10) if !(connStr).nil? status = obj[:Status] @_status = (status).nil? ? nil : status.downcase() return self end |