class Saklient::Cloud::Resources::Gslb

GSLBの実体1つに対応し, 属性の取得や操作を行うためのクラス.

Attributes

_servers[RW]

@private @return [Array<GslbServer>]

delay_loop[RW]

チェック間隔(秒)

@return [Fixnum]

path_to_check[RW]

監視対象パス

@return [String]

protocol[RW]

監視方法

@return [String]

response_expected[RW]

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

@return [Fixnum]

servers[R]

仮想IPアドレス {GslbServer} の配列

@return [Array<GslbServer>]

weighted[RW]

重み付け応答

@return [bool]

Public Class Methods

new(client, obj, wrapped = false) click to toggle source

@private @param [Saklient::Cloud::Client] client @param [any] obj @param [bool] wrapped

# File lib/saklient/cloud/resources/gslb.rb, line 198
def initialize(client, obj, wrapped = false)
  super(client, obj, wrapped)
  Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
  Saklient::Util::validate_type(wrapped, 'bool')
  _normalize
end

Public Instance Methods

add_server(settings = nil) click to toggle source

監視対象サーバ設定を追加します.

@param [any] settings 設定オブジェクト @return [GslbServer]

# File lib/saklient/cloud/resources/gslb.rb, line 283
def add_server(settings = nil)
  ret = Saklient::Cloud::Resources::GslbServer.new(settings)
  @_servers << ret
  return ret
end
delay_loop=(v) click to toggle source
# File lib/saklient/cloud/resources/gslb.rb, line 159
def delay_loop=(v)
  set_delay_loop(v)
end
get_delay_loop() click to toggle source

@private @return [Fixnum]

# File lib/saklient/cloud/resources/gslb.rb, line 134
def get_delay_loop
  delayLoop = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.DelayLoop')
  raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (delayLoop).nil?
  return (delayLoop).to_s().to_i(10)
end
get_path_to_check() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/gslb.rb, line 72
def get_path_to_check
  return nil if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.HealthCheck.Path')
  raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Path')
  return raw
end
get_protocol() click to toggle source

@private @return [String]

# File lib/saklient/cloud/resources/gslb.rb, line 41
def get_protocol
  raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Protocol')
  raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (raw).nil?
  return raw
end
get_response_expected() click to toggle source

@private @return [Fixnum]

# File lib/saklient/cloud/resources/gslb.rb, line 103
def get_response_expected
  raw = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.HealthCheck.Status')
  raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (raw).nil?
  return (raw).to_s().to_i(10)
end
get_servers() click to toggle source

@private @return [Array<GslbServer>]

# File lib/saklient/cloud/resources/gslb.rb, line 26
def get_servers
  return @_servers
end
get_weighted() click to toggle source

@private @return [bool]

# File lib/saklient/cloud/resources/gslb.rb, line 165
def get_weighted
  weighted = Saklient::Util::get_by_path(self.raw_settings, 'GSLB.Weighted')
  raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (weighted).nil?
  return weighted.downcase() == 'true'
end
path_to_check=(v) click to toggle source
# File lib/saklient/cloud/resources/gslb.rb, line 97
def path_to_check=(v)
  set_path_to_check(v)
end
protocol=(v) click to toggle source
# File lib/saklient/cloud/resources/gslb.rb, line 66
def protocol=(v)
  set_protocol(v)
end
response_expected=(v) click to toggle source
# File lib/saklient/cloud/resources/gslb.rb, line 128
def response_expected=(v)
  set_response_expected(v)
end
set_delay_loop(v) click to toggle source

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

# File lib/saklient/cloud/resources/gslb.rb, line 143
def set_delay_loop(v)
  Saklient::Util::validate_type(v, 'Fixnum')
  _normalize
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.DelayLoop', v)
  return v
end
set_initial_params(protocol, delayLoop = 10, weighted = true) click to toggle source

@private @param [String] protocol @param [Fixnum] delayLoop @param [bool] weighted @return [Gslb]

# File lib/saklient/cloud/resources/gslb.rb, line 268
def set_initial_params(protocol, delayLoop = 10, weighted = true)
  Saklient::Util::validate_type(protocol, 'String')
  Saklient::Util::validate_type(delayLoop, 'Fixnum')
  Saklient::Util::validate_type(weighted, 'bool')
  settings = self.raw_settings
  self.protocol = protocol
  self.delay_loop = delayLoop
  self.weighted = weighted
  return self
end
set_path_to_check(v) click to toggle source

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

# File lib/saklient/cloud/resources/gslb.rb, line 81
def set_path_to_check(v)
  Saklient::Util::validate_type(v, 'String')
  _normalize
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Path', v)
  return v
end
set_protocol(v) click to toggle source

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

# File lib/saklient/cloud/resources/gslb.rb, line 50
def set_protocol(v)
  Saklient::Util::validate_type(v, 'String')
  _normalize
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Protocol', v)
  return v
end
set_response_expected(v) click to toggle source

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

# File lib/saklient/cloud/resources/gslb.rb, line 112
def set_response_expected(v)
  Saklient::Util::validate_type(v, 'Fixnum')
  _normalize
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck.Status', v)
  return v
end
set_weighted(v) click to toggle source

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

# File lib/saklient/cloud/resources/gslb.rb, line 174
def set_weighted(v)
  Saklient::Util::validate_type(v, 'bool')
  _normalize
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Weighted', v ? 'True' : 'False')
  return v
end
weighted=(v) click to toggle source
# File lib/saklient/cloud/resources/gslb.rb, line 190
def weighted=(v)
  set_weighted(v)
end

Protected Instance Methods

_normalize() click to toggle source

@private @ignore @return [void]

# File lib/saklient/cloud/resources/gslb.rb, line 210
def _normalize
  @_servers = [] if (@_servers).nil?
  self.raw_settings = {} if (self.raw_settings).nil?
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB', {}) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB')
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.HealthCheck', {}) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.HealthCheck')
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Servers', []) if !Saklient::Util::exists_path(self.raw_settings, 'GSLB.Servers')
end
_on_after_api_deserialize(r, root) click to toggle source

@private @param [any] r @param [any] root @return [void]

# File lib/saklient/cloud/resources/gslb.rb, line 222
def _on_after_api_deserialize(r, root)
  _normalize
  @_servers = []
  settings = self.raw_settings
  if !(settings).nil?
    raw = Saklient::Util::get_by_path(settings, 'GSLB.Servers')
    if !(raw).nil?
      servers = raw
      for server in servers
        @_servers << Saklient::Cloud::Resources::GslbServer.new(server)
      end
    end
  end
end
_on_after_api_serialize(r, withClean) click to toggle source

@private @param [any] r @param [bool] withClean @return [void]

# File lib/saklient/cloud/resources/gslb.rb, line 254
def _on_after_api_serialize(r, withClean)
  Saklient::Util::validate_type(withClean, 'bool')
  return nil if (r).nil?
  Saklient::Util::set_by_path(r, 'Provider', {})
  Saklient::Util::set_by_path(r, 'Provider.Class', 'gslb')
end
_on_before_api_serialize(withClean) click to toggle source

@private @param [bool] withClean @return [void]

# File lib/saklient/cloud/resources/gslb.rb, line 240
def _on_before_api_serialize(withClean)
  Saklient::Util::validate_type(withClean, 'bool')
  _normalize
  servers = []
  for server in @_servers
    servers << server.to_raw_settings
  end
  Saklient::Util::set_by_path(self.raw_settings, 'GSLB.Servers', servers)
end