saklient 0.0.1.1 → 0.0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,250 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../../errors/saklient_exception'
4
+ require_relative '../client'
5
+ require_relative 'appliance'
6
+ require_relative 'lb_virtual_ip'
7
+ require_relative 'swytch'
8
+ require_relative 'ipv4_net'
9
+ require_relative '../enums/eappliance_class'
10
+
11
+ module Saklient
12
+ module Cloud
13
+ module Resources
14
+
15
+ # ロードバランサの実体1つに対応し, 属性の取得や操作を行うためのクラス.
16
+ class LoadBalancer < Saklient::Cloud::Resources::Appliance
17
+
18
+ protected
19
+
20
+ # @private
21
+ # @return [Array<LbVirtualIp>]
22
+ attr_accessor :_virtual_ips
23
+
24
+ public
25
+
26
+ # @private
27
+ # @return [Array<LbVirtualIp>]
28
+ def get_virtual_ips
29
+ return @_virtual_ips
30
+ end
31
+
32
+ # 仮想IPアドレス
33
+ #
34
+ # @return [Array<LbVirtualIp>]
35
+ attr_reader :virtual_ips
36
+
37
+ def virtual_ips
38
+ get_virtual_ips
39
+ end
40
+
41
+ # @private
42
+ # @return [String]
43
+ def get_default_route
44
+ return Saklient::Util::get_by_path(self.raw_annotation, 'Network.DefaultRoute')
45
+ end
46
+
47
+ # @private
48
+ # @param [String] v
49
+ # @return [String]
50
+ def set_default_route(v)
51
+ Saklient::Util::validate_type(v, 'String')
52
+ Saklient::Util::set_by_path(self.raw_annotation, 'Network.DefaultRoute', v)
53
+ return v
54
+ end
55
+
56
+ # デフォルトルート
57
+ #
58
+ # @return [String]
59
+ attr_accessor :default_route
60
+
61
+ def default_route
62
+ get_default_route
63
+ end
64
+
65
+ def default_route=(v)
66
+ set_default_route(v)
67
+ end
68
+
69
+ # @private
70
+ # @return [Fixnum]
71
+ def get_mask_len
72
+ maskLen = Saklient::Util::get_by_path(self.raw_annotation, 'Network.NetworkMaskLen')
73
+ raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (maskLen).nil?
74
+ return (maskLen).to_s().to_i(10)
75
+ end
76
+
77
+ # @private
78
+ # @param [Fixnum] v
79
+ # @return [Fixnum]
80
+ def set_mask_len(v)
81
+ Saklient::Util::validate_type(v, 'Fixnum')
82
+ Saklient::Util::set_by_path(self.raw_annotation, 'Network.NetworkMaskLen', v)
83
+ return v
84
+ end
85
+
86
+ # マスク長
87
+ #
88
+ # @return [Fixnum]
89
+ attr_accessor :mask_len
90
+
91
+ def mask_len
92
+ get_mask_len
93
+ end
94
+
95
+ def mask_len=(v)
96
+ set_mask_len(v)
97
+ end
98
+
99
+ # @private
100
+ # @return [Fixnum]
101
+ def get_vrid
102
+ vrid = Saklient::Util::get_by_path(self.raw_annotation, 'VRRP.VRID')
103
+ raise Saklient::Errors::SaklientException.new('invalid_data', 'Data of the resource is invalid') if (vrid).nil?
104
+ return (vrid).to_s().to_i(10)
105
+ end
106
+
107
+ # @private
108
+ # @param [Fixnum] v
109
+ # @return [Fixnum]
110
+ def set_vrid(v)
111
+ Saklient::Util::validate_type(v, 'Fixnum')
112
+ Saklient::Util::set_by_path(self.raw_annotation, 'VRRP.VRID', v)
113
+ return v
114
+ end
115
+
116
+ # VRID
117
+ #
118
+ # @return [Fixnum]
119
+ attr_accessor :vrid
120
+
121
+ def vrid
122
+ get_vrid
123
+ end
124
+
125
+ def vrid=(v)
126
+ set_vrid(v)
127
+ end
128
+
129
+ # @private
130
+ # @param [Saklient::Cloud::Client] client
131
+ # @param [any] obj
132
+ # @param [bool] wrapped
133
+ def initialize(client, obj, wrapped = false)
134
+ super(client, obj, wrapped)
135
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
136
+ Saklient::Util::validate_type(wrapped, 'bool')
137
+ self.raw_annotation = {} if (self.raw_annotation).nil?
138
+ end
139
+
140
+ protected
141
+
142
+ # @private
143
+ # @param [any] r
144
+ # @param [any] root
145
+ # @return [void]
146
+ def _on_after_api_deserialize(r, root)
147
+ self.raw_annotation = {} if (self.raw_annotation).nil?
148
+ @_virtual_ips = []
149
+ settings = self.raw_settings
150
+ if !(settings).nil?
151
+ lb = settings[:LoadBalancer]
152
+ lb = [] if (lb).nil?
153
+ vips = lb
154
+ for vip in vips
155
+ @_virtual_ips << Saklient::Cloud::Resources::LbVirtualIp.new(vip)
156
+ end
157
+ end
158
+ end
159
+
160
+ # @private
161
+ # @param [bool] withClean
162
+ # @return [void]
163
+ def _on_before_api_serialize(withClean)
164
+ Saklient::Util::validate_type(withClean, 'bool')
165
+ lb = []
166
+ for vip in @_virtual_ips
167
+ lb << vip.to_raw_settings
168
+ end
169
+ self.raw_settings = {} if (self.raw_settings).nil?
170
+ self.raw_settings[:LoadBalancer] = lb
171
+ self.clazz = Saklient::Cloud::Enums::EApplianceClass::loadbalancer if @is_new
172
+ end
173
+
174
+ public
175
+
176
+ # @private
177
+ # @param [Swytch] swytch
178
+ # @param [Fixnum] vrid
179
+ # @param [Array<String>] realIps
180
+ # @param [bool] isHighSpec
181
+ # @return [LoadBalancer]
182
+ def set_initial_params(swytch, vrid, realIps, isHighSpec = false)
183
+ Saklient::Util::validate_type(swytch, 'Saklient::Cloud::Resources::Swytch')
184
+ Saklient::Util::validate_type(vrid, 'Fixnum')
185
+ Saklient::Util::validate_type(realIps, 'Array')
186
+ Saklient::Util::validate_type(isHighSpec, 'bool')
187
+ annot = self.raw_annotation
188
+ self.vrid = vrid
189
+ Saklient::Util::set_by_path(annot, 'Switch.ID', swytch._id)
190
+ if !(swytch.ipv4_nets).nil? && 0 < swytch.ipv4_nets.length
191
+ net = swytch.ipv4_nets[0]
192
+ self.default_route = net.default_route
193
+ self.mask_len = net.mask_len
194
+ else
195
+ self.default_route = swytch.user_default_route
196
+ self.mask_len = swytch.user_mask_len
197
+ end
198
+ servers = []
199
+ for ip in realIps
200
+ servers << { IPAddress: ip }
201
+ end
202
+ Saklient::Util::set_by_path(annot, 'Servers', servers)
203
+ self.plan_id = isHighSpec ? 2 : 1
204
+ return self
205
+ end
206
+
207
+ # @return [LoadBalancer]
208
+ def clear_virtual_ips
209
+ while 0 < @_virtual_ips.length do
210
+ @_virtual_ips.pop()
211
+ end
212
+ return self
213
+ end
214
+
215
+ # @param [any] settings
216
+ # @return [LbVirtualIp]
217
+ def add_virtual_ip(settings = nil)
218
+ ret = Saklient::Cloud::Resources::LbVirtualIp.new(settings)
219
+ @_virtual_ips << ret
220
+ return ret
221
+ end
222
+
223
+ # @param [String] address
224
+ # @return [LbVirtualIp]
225
+ def get_virtual_ip_by_address(address)
226
+ Saklient::Util::validate_type(address, 'String')
227
+ for vip in @_virtual_ips
228
+ return vip if vip.virtual_ip_address == address
229
+ end
230
+ return nil
231
+ end
232
+
233
+ # @return [LoadBalancer]
234
+ def reload_status
235
+ result = request_retry('GET', _api_path + '/' + Saklient::Util::url_encode(_id) + '/status')
236
+ vips = result[:LoadBalancer]
237
+ for vipDyn in vips
238
+ vipStr = vipDyn[:VirtualIPAddress]
239
+ vip = get_virtual_ip_by_address(vipStr)
240
+ next if (vip).nil?
241
+ vip.update_status(vipDyn[:Servers])
242
+ end
243
+ return self
244
+ end
245
+
246
+ end
247
+
248
+ end
249
+ end
250
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative '../../util'
4
4
  require_relative '../client'
5
+ require_relative '../../errors/http_exception'
5
6
 
6
7
  module Saklient
7
8
  module Cloud
@@ -102,9 +103,9 @@ module Saklient
102
103
  attr_accessor :is_incomplete
103
104
 
104
105
  # @private
105
- # @param [any] r
106
+ # @param [any] query
106
107
  # @return [void]
107
- def _on_before_save(r)
108
+ def _on_before_save(query)
108
109
  end
109
110
 
110
111
  # @private
@@ -114,6 +115,13 @@ module Saklient
114
115
  def _on_after_api_deserialize(r, root)
115
116
  end
116
117
 
118
+ # @private
119
+ # @param [bool] withClean
120
+ # @return [void]
121
+ def _on_before_api_serialize(withClean)
122
+ Saklient::Util::validate_type(withClean, 'bool')
123
+ end
124
+
117
125
  # @private
118
126
  # @param [any] r
119
127
  # @param [bool] withClean
@@ -172,6 +180,7 @@ module Saklient
172
180
  # @return [any]
173
181
  def api_serialize(withClean = false)
174
182
  Saklient::Util::validate_type(withClean, 'bool')
183
+ _on_before_api_serialize(withClean)
175
184
  ret = api_serialize_impl(withClean)
176
185
  _on_after_api_serialize(ret, withClean)
177
186
  return ret
@@ -198,21 +207,6 @@ module Saklient
198
207
  return name
199
208
  end
200
209
 
201
- public
202
-
203
- # @private
204
- # @param [String] name
205
- # @param [any] value
206
- # @return [void]
207
- def set_property(name, value)
208
- Saklient::Util::validate_type(name, 'String')
209
- name = normalize_field_name(name)
210
- instance_variable_set('@m_'+name, value)
211
- instance_variable_set('@n_'+name, true)
212
- end
213
-
214
- protected
215
-
216
210
  # このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し, 新規作成または上書き保存します.
217
211
  #
218
212
  # @private
@@ -226,12 +220,12 @@ module Saklient
226
220
  v = query[k.to_sym]
227
221
  r[k.to_sym] = v
228
222
  end
229
- _on_before_save(r)
230
223
  method = @is_new ? 'POST' : 'PUT'
231
224
  path = _api_path
232
225
  path += '/' + Saklient::Util::url_encode(_id) if !@is_new
233
226
  q = {}
234
227
  q[_root_key.to_sym] = r
228
+ _on_before_save(q)
235
229
  result = @_client.request(method, path, q)
236
230
  api_deserialize(result, true)
237
231
  return self
@@ -245,7 +239,7 @@ module Saklient
245
239
  def destroy
246
240
  return nil if @is_new
247
241
  path = _api_path + '/' + Saklient::Util::url_encode(_id)
248
- @_client.request('DELETE', path)
242
+ request_retry('DELETE', path)
249
243
  end
250
244
 
251
245
  protected
@@ -255,7 +249,7 @@ module Saklient
255
249
  # @private
256
250
  # @return [Resource] this
257
251
  def _reload
258
- result = @_client.request('GET', _api_path + '/' + Saklient::Util::url_encode(_id))
252
+ result = request_retry('GET', _api_path + '/' + Saklient::Util::url_encode(_id))
259
253
  api_deserialize(result, true)
260
254
  return self
261
255
  end
@@ -269,7 +263,7 @@ module Saklient
269
263
  query = {}
270
264
  Saklient::Util::set_by_path(query, 'Filter.ID', [_id])
271
265
  Saklient::Util::set_by_path(query, 'Include', ['ID'])
272
- result = @_client.request('GET', _api_path, query)
266
+ result = request_retry('GET', _api_path, query)
273
267
  cnt = result[:Count]
274
268
  return cnt == 1
275
269
  end
@@ -280,6 +274,64 @@ module Saklient
280
274
  return api_serialize(true)
281
275
  end
282
276
 
277
+ # @private
278
+ # @return [String]
279
+ def true_class_name
280
+ return nil
281
+ end
282
+
283
+ # @private
284
+ # @param [String] className
285
+ # @param [Saklient::Cloud::Client] client
286
+ # @param [any] obj
287
+ # @param [bool] wrapped
288
+ # @return [Resource]
289
+ def self.create_with(className, client, obj, wrapped = false)
290
+ Saklient::Util::validate_type(className, 'String')
291
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
292
+ Saklient::Util::validate_type(wrapped, 'bool')
293
+ a = [
294
+ client,
295
+ obj,
296
+ wrapped
297
+ ]
298
+ ret = Saklient::Util::create_class_instance('saklient.cloud.resources.' + className, a)
299
+ trueClassName = ret.true_class_name
300
+ ret = Saklient::Util::create_class_instance('saklient.cloud.resources.' + trueClassName, a) if !(trueClassName).nil?
301
+ return ret
302
+ end
303
+
304
+ # @param [String] method
305
+ # @param [String] path
306
+ # @param [any] query
307
+ # @param [Fixnum] retryCount
308
+ # @param [Fixnum] retrySleep
309
+ # @return [any]
310
+ def request_retry(method, path, query = nil, retryCount = 5, retrySleep = 5)
311
+ Saklient::Util::validate_type(method, 'String')
312
+ Saklient::Util::validate_type(path, 'String')
313
+ Saklient::Util::validate_type(retryCount, 'Fixnum')
314
+ Saklient::Util::validate_type(retrySleep, 'Fixnum')
315
+ ret = nil
316
+ while 1 < retryCount do
317
+ isOk = false
318
+ begin
319
+ ret = @_client.request(method, path, query)
320
+ isOk = true
321
+ rescue Saklient::Errors::HttpException
322
+ isOk = false
323
+ end
324
+ if isOk
325
+ retryCount = -1
326
+ else
327
+ retryCount -= 1
328
+ sleep(retrySleep)
329
+ end
330
+ end
331
+ ret = @_client.request(method, path, query) if retryCount == 0
332
+ return ret
333
+ end
334
+
283
335
  end
284
336
 
285
337
  end
@@ -132,7 +132,7 @@ module Saklient
132
132
  return true
133
133
  end
134
134
  timeoutSec -= step
135
- sleep step if 0 < timeoutSec
135
+ sleep(step) if 0 < timeoutSec
136
136
  end
137
137
  return false
138
138
  end
@@ -450,14 +450,14 @@ module Saklient
450
450
  end
451
451
  @n_description = false
452
452
  if Saklient::Util::exists_path(r, 'NetworkMaskLen')
453
- @m_network_mask_len = (Saklient::Util::get_by_path(r, 'NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'NetworkMaskLen').to_s).to_i(10)
453
+ @m_network_mask_len = (Saklient::Util::get_by_path(r, 'NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'NetworkMaskLen').to_s).to_s().to_i(10)
454
454
  else
455
455
  @m_network_mask_len = nil
456
456
  @is_incomplete = true
457
457
  end
458
458
  @n_network_mask_len = false
459
459
  if Saklient::Util::exists_path(r, 'BandWidthMbps')
460
- @m_band_width_mbps = (Saklient::Util::get_by_path(r, 'BandWidthMbps')).nil? ? nil : (Saklient::Util::get_by_path(r, 'BandWidthMbps').to_s).to_i(10)
460
+ @m_band_width_mbps = (Saklient::Util::get_by_path(r, 'BandWidthMbps')).nil? ? nil : (Saklient::Util::get_by_path(r, 'BandWidthMbps').to_s).to_s().to_i(10)
461
461
  else
462
462
  @m_band_width_mbps = nil
463
463
  @is_incomplete = true
@@ -195,7 +195,7 @@ module Saklient
195
195
  end
196
196
  @n_name = false
197
197
  if Saklient::Util::exists_path(r, 'BandWidthMbps')
198
- @m_band_width_mbps = (Saklient::Util::get_by_path(r, 'BandWidthMbps')).nil? ? nil : (Saklient::Util::get_by_path(r, 'BandWidthMbps').to_s).to_i(10)
198
+ @m_band_width_mbps = (Saklient::Util::get_by_path(r, 'BandWidthMbps')).nil? ? nil : (Saklient::Util::get_by_path(r, 'BandWidthMbps').to_s).to_s().to_i(10)
199
199
  else
200
200
  @m_band_width_mbps = nil
201
201
  @is_incomplete = true
@@ -280,6 +280,7 @@ module Saklient
280
280
  # @private
281
281
  # @return [Array<String>]
282
282
  def get_tags
283
+ @n_tags = true
283
284
  return @m_tags
284
285
  end
285
286
 
@@ -403,32 +404,17 @@ module Saklient
403
404
  return @m_annotation
404
405
  end
405
406
 
406
- # (This method is generated in Translator_default#buildImpl)
407
- #
408
- # @private
409
- # @param [any] v
410
- # @return [any]
411
- def set_annotation(v)
412
- @m_annotation = v
413
- @n_annotation = true
414
- return @m_annotation
415
- end
416
-
417
407
  public
418
408
 
419
409
  # 注釈
420
410
  #
421
411
  # @return [any]
422
- attr_accessor :annotation
412
+ attr_reader :annotation
423
413
 
424
414
  def annotation
425
415
  get_annotation
426
416
  end
427
417
 
428
- def annotation=(v)
429
- set_annotation(v)
430
- end
431
-
432
418
  protected
433
419
 
434
420
  # (This method is generated in Translator_default#buildImpl)
@@ -171,38 +171,15 @@ module Saklient
171
171
  return reload
172
172
  end
173
173
 
174
- # サーバが停止するまで待機します.
175
- #
176
- # @yield [Saklient::Cloud::Resources::Server, bool]
177
- # @yieldreturn [void]
178
- # @param [Fixnum] timeoutSec
179
- # @return [void] 成功時はtrue, タイムアウトやエラーによる失敗時はfalseを返します.
180
- def after_down(timeoutSec, &callback)
181
- Saklient::Util::validate_type(timeoutSec, 'Fixnum')
182
- Saklient::Util::validate_type(callback, 'Proc')
183
- after_status(Saklient::Cloud::Enums::EServerInstanceStatus::down, timeoutSec, &callback)
184
- end
185
-
186
- protected
187
-
188
- # サーバが指定のステータスに遷移するまで待機します.
174
+ # サーバが起動するまで待機します.
189
175
  #
190
- # @private
191
- # @yield [Saklient::Cloud::Resources::Server, bool]
192
- # @yieldreturn [void]
193
- # @param [String] status
194
176
  # @param [Fixnum] timeoutSec
195
- # @return [void]
196
- def after_status(status, timeoutSec, &callback)
197
- Saklient::Util::validate_type(status, 'String')
177
+ # @return [bool]
178
+ def sleep_until_up(timeoutSec = 180)
198
179
  Saklient::Util::validate_type(timeoutSec, 'Fixnum')
199
- Saklient::Util::validate_type(callback, 'Proc')
200
- ret = sleep_until(status, timeoutSec)
201
- callback.call(self, ret)
180
+ return sleep_until(Saklient::Cloud::Enums::EServerInstanceStatus::up, timeoutSec)
202
181
  end
203
182
 
204
- public
205
-
206
183
  # サーバが停止するまで待機します.
207
184
  #
208
185
  # @param [Fixnum] timeoutSec
@@ -223,14 +200,16 @@ module Saklient
223
200
  def sleep_until(status, timeoutSec = 180)
224
201
  Saklient::Util::validate_type(status, 'String')
225
202
  Saklient::Util::validate_type(timeoutSec, 'Fixnum')
226
- step = 3
203
+ step = 10
227
204
  while 0 < timeoutSec do
228
205
  reload
229
- s = get_instance.status
206
+ s = nil
207
+ inst = self.instance
208
+ s = inst.status if !(inst).nil?
230
209
  s = Saklient::Cloud::Enums::EServerInstanceStatus::down if (s).nil?
231
210
  return true if s == status
232
211
  timeoutSec -= step
233
- sleep step if 0 < timeoutSec
212
+ sleep(step) if 0 < timeoutSec
234
213
  end
235
214
  return false
236
215
  end
@@ -265,7 +244,7 @@ module Saklient
265
244
  def add_iface
266
245
  model = Saklient::Util::create_class_instance('saklient.cloud.models.Model_Iface', [@_client])
267
246
  res = model.create
268
- res.set_property('serverId', _id)
247
+ res.server_id = _id
269
248
  return res.save
270
249
  end
271
250
 
@@ -406,6 +385,7 @@ module Saklient
406
385
  # @private
407
386
  # @return [Array<String>]
408
387
  def get_tags
388
+ @n_tags = true
409
389
  return @m_tags
410
390
  end
411
391
 
@@ -242,14 +242,14 @@ module Saklient
242
242
  end
243
243
  @n_name = false
244
244
  if Saklient::Util::exists_path(r, 'CPU')
245
- @m_cpu = (Saklient::Util::get_by_path(r, 'CPU')).nil? ? nil : (Saklient::Util::get_by_path(r, 'CPU').to_s).to_i(10)
245
+ @m_cpu = (Saklient::Util::get_by_path(r, 'CPU')).nil? ? nil : (Saklient::Util::get_by_path(r, 'CPU').to_s).to_s().to_i(10)
246
246
  else
247
247
  @m_cpu = nil
248
248
  @is_incomplete = true
249
249
  end
250
250
  @n_cpu = false
251
251
  if Saklient::Util::exists_path(r, 'MemoryMB')
252
- @m_memory_mib = (Saklient::Util::get_by_path(r, 'MemoryMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'MemoryMB').to_s).to_i(10)
252
+ @m_memory_mib = (Saklient::Util::get_by_path(r, 'MemoryMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'MemoryMB').to_s).to_s().to_i(10)
253
253
  else
254
254
  @m_memory_mib = nil
255
255
  @is_incomplete = true
@@ -430,7 +430,7 @@ module Saklient
430
430
  end
431
431
  @n_user_default_route = false
432
432
  if Saklient::Util::exists_path(r, 'UserSubnet.NetworkMaskLen')
433
- @m_user_mask_len = (Saklient::Util::get_by_path(r, 'UserSubnet.NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'UserSubnet.NetworkMaskLen').to_s).to_i(10)
433
+ @m_user_mask_len = (Saklient::Util::get_by_path(r, 'UserSubnet.NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'UserSubnet.NetworkMaskLen').to_s).to_s().to_i(10)
434
434
  else
435
435
  @m_user_mask_len = nil
436
436
  @is_incomplete = true
@@ -0,0 +1,28 @@
1
+ # -*- encoding: UTF-8 -*-
2
+
3
+ require_relative '../../errors/saklient_exception'
4
+ require_relative '../client'
5
+ require_relative 'appliance'
6
+
7
+ module Saklient
8
+ module Cloud
9
+ module Resources
10
+
11
+ # ロードバランサの実体1つに対応し, 属性の取得や操作を行うためのクラス.
12
+ class VpcRouter < Saklient::Cloud::Resources::Appliance
13
+
14
+ # @private
15
+ # @param [Saklient::Cloud::Client] client
16
+ # @param [any] obj
17
+ # @param [bool] wrapped
18
+ def initialize(client, obj, wrapped = false)
19
+ super(client, obj, wrapped)
20
+ Saklient::Util::validate_type(client, 'Saklient::Cloud::Client')
21
+ Saklient::Util::validate_type(wrapped, 'bool')
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+ end
28
+ end
data/lib/saklient/util.rb CHANGED
@@ -37,6 +37,16 @@ module Saklient
37
37
  end
38
38
  return obj
39
39
  end
40
+
41
+ def self.get_by_path_any(objects, pathes)
42
+ for obj in objects
43
+ for path in pathes
44
+ ret = get_by_path(obj, path)
45
+ return ret if !ret.nil?
46
+ end
47
+ end
48
+ return nil
49
+ end
40
50
 
41
51
  # @todo array support
42
52
  # @todo overwriting
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
3
  module Saklient
4
- VERSION = "0.0.1.1"
4
+ VERSION = "0.0.2.2"
5
5
  end