Class: Saklient::Cloud::Resources::Gslb

Inherits:
CommonServiceItem show all
Defined in:
lib/saklient/cloud/resources/gslb.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from CommonServiceItem

#description, #icon, #id, #name, #provider, #raw_settings, #raw_status, #tags

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from CommonServiceItem

#_class_name, #_id, #reload, #save

Methods inherited from Resource

#_class_name, #_id, #api_deserialize, #api_serialize, create_with, #destroy, #dump, #exists, #request_retry, #set_param

Constructor Details

#initialize(client, obj, wrapped = false) ⇒ Gslb

Returns a new instance of Gslb.

Parameters:



199
200
201
202
203
204
# File 'lib/saklient/cloud/resources/gslb.rb', line 199

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

Instance Attribute Details

#delay_loopFixnum

チェック間隔(秒)

Returns:

  • (Fixnum)


154
155
156
# File 'lib/saklient/cloud/resources/gslb.rb', line 154

def delay_loop
  @delay_loop
end

#path_to_checkString

監視対象パス

Returns:

  • (String)


92
93
94
# File 'lib/saklient/cloud/resources/gslb.rb', line 92

def path_to_check
  @path_to_check
end

#protocolString

監視方法

Returns:

  • (String)


61
62
63
# File 'lib/saklient/cloud/resources/gslb.rb', line 61

def protocol
  @protocol
end

#response_expectedFixnum

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

Returns:

  • (Fixnum)


123
124
125
# File 'lib/saklient/cloud/resources/gslb.rb', line 123

def response_expected
  @response_expected
end

#serversArray<GslbServer> (readonly)

仮想IPアドレス Saklient::Cloud::Resources::GslbServer の配列

Returns:



34
35
36
# File 'lib/saklient/cloud/resources/gslb.rb', line 34

def servers
  @servers
end

#weightedbool

重み付け応答

Returns:

  • (bool)


185
186
187
# File 'lib/saklient/cloud/resources/gslb.rb', line 185

def weighted
  @weighted
end

Instance Method Details

#add_server(settings = nil) ⇒ GslbServer

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

Parameters:

  • settings (any) (defaults to: nil)

    設定オブジェクト

Returns:



284
285
286
287
288
# File 'lib/saklient/cloud/resources/gslb.rb', line 284

def add_server(settings = nil)
  ret = Saklient::Cloud::Resources::GslbServer.new(settings)
  @_servers << ret
  return ret
end

#get_delay_loopFixnum

Returns:

  • (Fixnum)

Raises:



135
136
137
138
139
# File 'lib/saklient/cloud/resources/gslb.rb', line 135

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_checkString

Returns:

  • (String)


73
74
75
76
77
# File 'lib/saklient/cloud/resources/gslb.rb', line 73

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_protocolString

Returns:

  • (String)

Raises:



42
43
44
45
46
# File 'lib/saklient/cloud/resources/gslb.rb', line 42

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_expectedFixnum

Returns:

  • (Fixnum)

Raises:



104
105
106
107
108
# File 'lib/saklient/cloud/resources/gslb.rb', line 104

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_serversArray<GslbServer>

Returns:



27
28
29
# File 'lib/saklient/cloud/resources/gslb.rb', line 27

def get_servers
  return @_servers
end

#get_weightedbool

Returns:

  • (bool)

Raises:



166
167
168
169
170
# File 'lib/saklient/cloud/resources/gslb.rb', line 166

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

#set_delay_loop(v) ⇒ Fixnum

Parameters:

  • v (Fixnum)

Returns:

  • (Fixnum)


144
145
146
147
148
149
# File 'lib/saklient/cloud/resources/gslb.rb', line 144

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) ⇒ Gslb

Parameters:

  • protocol (String)
  • delayLoop (Fixnum) (defaults to: 10)
  • weighted (bool) (defaults to: true)

Returns:



269
270
271
272
273
274
275
276
277
278
# File 'lib/saklient/cloud/resources/gslb.rb', line 269

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) ⇒ String

Parameters:

  • v (String)

Returns:

  • (String)


82
83
84
85
86
87
# File 'lib/saklient/cloud/resources/gslb.rb', line 82

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) ⇒ String

Parameters:

  • v (String)

Returns:

  • (String)


51
52
53
54
55
56
# File 'lib/saklient/cloud/resources/gslb.rb', line 51

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) ⇒ Fixnum

Parameters:

  • v (Fixnum)

Returns:

  • (Fixnum)


113
114
115
116
117
118
# File 'lib/saklient/cloud/resources/gslb.rb', line 113

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) ⇒ bool

Parameters:

  • v (bool)

Returns:

  • (bool)


175
176
177
178
179
180
# File 'lib/saklient/cloud/resources/gslb.rb', line 175

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