Class: Saklient::Cloud::Resources::Gslb
- Inherits:
-
CommonServiceItem
- Object
- Resource
- CommonServiceItem
- Saklient::Cloud::Resources::Gslb
- Defined in:
- lib/saklient/cloud/resources/gslb.rb
Overview
GSLBの実体1つに対応し, 属性の取得や操作を行うためのクラス.
Instance Attribute Summary collapse
-
#delay_loop ⇒ Fixnum
チェック間隔(秒).
-
#path_to_check ⇒ String
監視対象パス.
-
#protocol ⇒ String
監視方法.
-
#response_expected ⇒ Fixnum
監視時に期待されるレスポンスコード.
-
#servers ⇒ Array<GslbServer>
readonly
仮想IPアドレス GslbServer の配列.
-
#weighted ⇒ bool
重み付け応答.
Attributes inherited from CommonServiceItem
#description, #icon, #id, #name, #provider, #raw_settings, #raw_settings_hash, #raw_status, #tags
Attributes inherited from Resource
Instance Method Summary collapse
-
#add_server(settings = nil) ⇒ GslbServer
監視対象サーバ設定を追加します.
- #get_delay_loop ⇒ Fixnum
- #get_path_to_check ⇒ String
- #get_protocol ⇒ String
- #get_response_expected ⇒ Fixnum
- #get_servers ⇒ Array<GslbServer>
- #get_weighted ⇒ bool
-
#initialize(client, obj, wrapped = false) ⇒ Gslb
constructor
A new instance of Gslb.
- #set_delay_loop(v) ⇒ Fixnum
- #set_initial_params(protocol, delayLoop = 10, weighted = true) ⇒ Gslb
- #set_path_to_check(v) ⇒ String
- #set_protocol(v) ⇒ String
- #set_response_expected(v) ⇒ Fixnum
- #set_weighted(v) ⇒ bool
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.
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_loop ⇒ Fixnum
チェック間隔(秒)
154 155 156 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 154 def delay_loop @delay_loop end |
#path_to_check ⇒ String
監視対象パス
92 93 94 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 92 def path_to_check @path_to_check end |
#protocol ⇒ String
監視方法
61 62 63 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 61 def protocol @protocol end |
#response_expected ⇒ Fixnum
監視時に期待されるレスポンスコード
123 124 125 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 123 def response_expected @response_expected end |
#servers ⇒ Array<GslbServer> (readonly)
仮想IPアドレス Saklient::Cloud::Resources::GslbServer の配列
34 35 36 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 34 def servers @servers end |
#weighted ⇒ 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
監視対象サーバ設定を追加します.
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_loop ⇒ Fixnum
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_check ⇒ 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_protocol ⇒ String
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_expected ⇒ Fixnum
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_servers ⇒ Array<GslbServer>
27 28 29 |
# File 'lib/saklient/cloud/resources/gslb.rb', line 27 def get_servers return @_servers end |
#get_weighted ⇒ bool
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
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
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
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
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
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
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 |