class Saklient::Cloud::Resources::LbServer

ロードバランサの監視対象サーバ設定.

Attributes

_active_connections[RW]

@private @return [Fixnum]

_enabled[RW]

@private @return [bool]

_ip_address[RW]

@private @return [String]

_path_to_check[RW]

@private @return [String]

_port[RW]

@private @return [Fixnum]

_protocol[RW]

@private @return [String]

_response_expected[RW]

@private @return [Fixnum]

_status[RW]

@private @return [String]

active_connections[R]

現在の接続数

@return [Fixnum]

enabled[RW]

有効状態

@return [bool]

ip_address[RW]

IPアドレス

@return [String]

path_to_check[RW]

監視対象パス

@return [String]

port[RW]

ポート番号

@return [Fixnum]

protocol[RW]

監視方法

@return [String]

response_expected[RW]

監視時に期待されるレスポンスコード

@return [Fixnum]

status[R]

現在の状態

@return [String]

Public Class Methods

new(obj = nil) click to toggle source

@private @param [any] obj

# File lib/saklient/cloud/resources/lb_server.rb, line 277
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

Public Instance Methods

enabled=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 45
def enabled=(v)
  set_enabled(v)
end
get_active_connections() click to toggle source

@private @return [Fixnum]

# File lib/saklient/cloud/resources/lb_server.rb, line 239
def get_active_connections
  return @_active_connections
end
get_enabled() click to toggle source

@private @return [bool]

# File lib/saklient/cloud/resources/lb_server.rb, line 23
def get_enabled
  return @_enabled
end
get_ip_address() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 59
def get_ip_address
  return @_ip_address
end
get_path_to_check() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 167
def get_path_to_check
  return @_path_to_check
end
get_port() click to toggle source

@private @return [Fixnum]

# File lib/saklient/cloud/resources/lb_server.rb, line 95
def get_port
  return @_port
end
get_protocol() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 131
def get_protocol
  return @_protocol
end
get_response_expected() click to toggle source

@private @return [Fixnum]

# File lib/saklient/cloud/resources/lb_server.rb, line 203
def get_response_expected
  return @_response_expected
end
get_status() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 262
def get_status
  return @_status
end
ip_address=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 81
def ip_address=(v)
  set_ip_address(v)
end
path_to_check=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 189
def path_to_check=(v)
  set_path_to_check(v)
end
port=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 117
def port=(v)
  set_port(v)
end
protocol=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 153
def protocol=(v)
  set_protocol(v)
end
response_expected=(v) click to toggle source
# File lib/saklient/cloud/resources/lb_server.rb, line 225
def response_expected=(v)
  set_response_expected(v)
end
set_enabled(v) click to toggle source

@private @param [bool] v @return [bool]

# File lib/saklient/cloud/resources/lb_server.rb, line 30
def set_enabled(v)
  Saklient::Util::validate_type(v, 'bool')
  @_enabled = v
  return @_enabled
end
set_ip_address(v) click to toggle source

@private @param [String] v @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 66
def set_ip_address(v)
  Saklient::Util::validate_type(v, 'String')
  @_ip_address = v
  return @_ip_address
end
set_path_to_check(v) click to toggle source

@private @param [String] v @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 174
def set_path_to_check(v)
  Saklient::Util::validate_type(v, 'String')
  @_path_to_check = v
  return @_path_to_check
end
set_port(v) click to toggle source

@private @param [Fixnum] v @return [Fixnum]

# File lib/saklient/cloud/resources/lb_server.rb, line 102
def set_port(v)
  Saklient::Util::validate_type(v, 'Fixnum')
  @_port = v
  return @_port
end
set_protocol(v) click to toggle source

@private @param [String] v @return [String]

# File lib/saklient/cloud/resources/lb_server.rb, line 138
def set_protocol(v)
  Saklient::Util::validate_type(v, 'String')
  @_protocol = v
  return @_protocol
end
set_response_expected(v) click to toggle source

@private @param [Fixnum] v @return [Fixnum]

# File lib/saklient/cloud/resources/lb_server.rb, line 210
def set_response_expected(v)
  Saklient::Util::validate_type(v, 'Fixnum')
  @_response_expected = v
  return @_response_expected
end
to_raw_settings() click to toggle source

@return [any]

# File lib/saklient/cloud/resources/lb_server.rb, line 322
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) click to toggle source

@private @param [any] obj @return [LbServer]

# File lib/saklient/cloud/resources/lb_server.rb, line 338
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