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.
- checksums.yaml +4 -4
- data/lib/saklient/cloud/client.rb +2 -2
- data/lib/saklient/cloud/models/model.rb +19 -26
- data/lib/saklient/cloud/models/model_appliance.rb +22 -0
- data/lib/saklient/cloud/models/model_archive.rb +2 -0
- data/lib/saklient/cloud/models/model_router.rb +32 -0
- data/lib/saklient/cloud/models/model_swytch.rb +32 -0
- data/lib/saklient/cloud/resources/appliance.rb +417 -1
- data/lib/saklient/cloud/resources/archive.rb +5 -25
- data/lib/saklient/cloud/resources/disk.rb +5 -25
- data/lib/saklient/cloud/resources/ipv4_net.rb +1 -1
- data/lib/saklient/cloud/resources/ipv6_net.rb +1 -1
- data/lib/saklient/cloud/resources/iso_image.rb +3 -2
- data/lib/saklient/cloud/resources/lb_server.rb +304 -0
- data/lib/saklient/cloud/resources/lb_virtual_ip.rb +227 -0
- data/lib/saklient/cloud/resources/load_balancer.rb +250 -0
- data/lib/saklient/cloud/resources/resource.rb +73 -21
- data/lib/saklient/cloud/resources/router.rb +3 -3
- data/lib/saklient/cloud/resources/router_plan.rb +1 -1
- data/lib/saklient/cloud/resources/script.rb +2 -16
- data/lib/saklient/cloud/resources/server.rb +11 -31
- data/lib/saklient/cloud/resources/server_plan.rb +2 -2
- data/lib/saklient/cloud/resources/swytch.rb +1 -1
- data/lib/saklient/cloud/resources/vpc_router.rb +28 -0
- data/lib/saklient/util.rb +10 -0
- data/lib/saklient/version.rb +1 -1
- data/spec/loadbalancer_spec.rb +248 -0
- data/spec/router_spec.rb +1 -1
- metadata +9 -2
@@ -5,7 +5,10 @@ require_relative '../client'
|
|
5
5
|
require_relative 'resource'
|
6
6
|
require_relative 'icon'
|
7
7
|
require_relative 'iface'
|
8
|
+
require_relative 'swytch'
|
8
9
|
require_relative '../enums/eappliance_class'
|
10
|
+
require_relative '../enums/eavailability'
|
11
|
+
require_relative '../enums/eserver_instance_status'
|
9
12
|
|
10
13
|
module Saklient
|
11
14
|
module Cloud
|
@@ -48,14 +51,48 @@ module Saklient
|
|
48
51
|
|
49
52
|
# プラン
|
50
53
|
#
|
54
|
+
# @return [Fixnum]
|
55
|
+
attr_accessor :m_plan_id
|
56
|
+
|
57
|
+
# インタフェース
|
58
|
+
#
|
51
59
|
# @return [Array<Iface>]
|
52
60
|
attr_accessor :m_ifaces
|
53
61
|
|
62
|
+
# 注釈
|
63
|
+
#
|
64
|
+
# @return [any]
|
65
|
+
attr_accessor :m_raw_annotation
|
66
|
+
|
67
|
+
# 設定の生データ
|
68
|
+
#
|
69
|
+
# @return [any]
|
70
|
+
attr_accessor :m_raw_settings
|
71
|
+
|
72
|
+
# @private
|
73
|
+
# @return [String]
|
74
|
+
attr_accessor :m_raw_settings_hash
|
75
|
+
|
76
|
+
# 起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
attr_accessor :m_status
|
80
|
+
|
54
81
|
# サービスクラス
|
55
82
|
#
|
56
83
|
# @return [String]
|
57
84
|
attr_accessor :m_service_class
|
58
85
|
|
86
|
+
# 有効状態 {Saklient::Cloud::Enums::EAvailability}
|
87
|
+
#
|
88
|
+
# @return [String]
|
89
|
+
attr_accessor :m_availability
|
90
|
+
|
91
|
+
# 接続先スイッチID
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
attr_accessor :m_swytch_id
|
95
|
+
|
59
96
|
# @private
|
60
97
|
# @return [String]
|
61
98
|
def _api_path
|
@@ -102,6 +139,19 @@ module Saklient
|
|
102
139
|
return _reload
|
103
140
|
end
|
104
141
|
|
142
|
+
# @private
|
143
|
+
# @return [String]
|
144
|
+
def true_class_name
|
145
|
+
return nil if (self.clazz).nil?
|
146
|
+
case (self.clazz)
|
147
|
+
when 'loadbalancer'
|
148
|
+
return 'LoadBalancer'
|
149
|
+
when 'vpcrouter'
|
150
|
+
return 'VpcRouter'
|
151
|
+
end
|
152
|
+
return nil
|
153
|
+
end
|
154
|
+
|
105
155
|
# @private
|
106
156
|
# @param [Saklient::Cloud::Client] client
|
107
157
|
# @param [any] obj
|
@@ -113,6 +163,34 @@ module Saklient
|
|
113
163
|
api_deserialize(obj, wrapped)
|
114
164
|
end
|
115
165
|
|
166
|
+
protected
|
167
|
+
|
168
|
+
# @private
|
169
|
+
# @param [any] query
|
170
|
+
# @return [void]
|
171
|
+
def _on_before_save(query)
|
172
|
+
Saklient::Util::set_by_path(query, 'OriginalSettingsHash', get_raw_settings_hash)
|
173
|
+
end
|
174
|
+
|
175
|
+
public
|
176
|
+
|
177
|
+
# このルータが接続されているスイッチを取得します.
|
178
|
+
#
|
179
|
+
# @return [Swytch]
|
180
|
+
def get_swytch
|
181
|
+
model = Saklient::Util::create_class_instance('saklient.cloud.models.Model_Swytch', [@_client])
|
182
|
+
id = get_swytch_id
|
183
|
+
return model.get_by_id(id)
|
184
|
+
end
|
185
|
+
|
186
|
+
# アプライアンスの設定を反映します.
|
187
|
+
#
|
188
|
+
# @return [Appliance] this
|
189
|
+
def apply
|
190
|
+
@_client.request('PUT', _api_path + '/' + Saklient::Util::url_encode(_id) + '/config')
|
191
|
+
return self
|
192
|
+
end
|
193
|
+
|
116
194
|
# アプライアンスを起動します.
|
117
195
|
#
|
118
196
|
# @return [Appliance] this
|
@@ -145,8 +223,65 @@ module Saklient
|
|
145
223
|
return self
|
146
224
|
end
|
147
225
|
|
226
|
+
# 作成中のアプライアンスが利用可能になるまで待機します.
|
227
|
+
#
|
228
|
+
# @param [Fixnum] timeoutSec
|
229
|
+
# @return [bool] 成功時はtrue, タイムアウトやエラーによる失敗時はfalseを返します.
|
230
|
+
def sleep_while_creating(timeoutSec = 600)
|
231
|
+
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
232
|
+
step = 10
|
233
|
+
while 0 < timeoutSec do
|
234
|
+
reload
|
235
|
+
a = get_availability
|
236
|
+
return true if a == Saklient::Cloud::Enums::EAvailability::available
|
237
|
+
timeoutSec = 0 if a != Saklient::Cloud::Enums::EAvailability::migrating
|
238
|
+
timeoutSec -= step
|
239
|
+
sleep(step) if 0 < timeoutSec
|
240
|
+
end
|
241
|
+
return false
|
242
|
+
end
|
243
|
+
|
244
|
+
# アプライアンスが起動するまで待機します.
|
245
|
+
#
|
246
|
+
# @param [Fixnum] timeoutSec
|
247
|
+
# @return [bool]
|
248
|
+
def sleep_until_up(timeoutSec = 600)
|
249
|
+
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
250
|
+
return sleep_until(Saklient::Cloud::Enums::EServerInstanceStatus::up, timeoutSec)
|
251
|
+
end
|
252
|
+
|
253
|
+
# アプライアンスが停止するまで待機します.
|
254
|
+
#
|
255
|
+
# @param [Fixnum] timeoutSec
|
256
|
+
# @return [bool] 成功時はtrue, タイムアウトやエラーによる失敗時はfalseを返します.
|
257
|
+
def sleep_until_down(timeoutSec = 600)
|
258
|
+
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
259
|
+
return sleep_until(Saklient::Cloud::Enums::EServerInstanceStatus::down, timeoutSec)
|
260
|
+
end
|
261
|
+
|
148
262
|
protected
|
149
263
|
|
264
|
+
# アプライアンスが指定のステータスに遷移するまで待機します.
|
265
|
+
#
|
266
|
+
# @private
|
267
|
+
# @param [String] status
|
268
|
+
# @param [Fixnum] timeoutSec
|
269
|
+
# @return [bool]
|
270
|
+
def sleep_until(status, timeoutSec = 600)
|
271
|
+
Saklient::Util::validate_type(status, 'String')
|
272
|
+
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
273
|
+
step = 10
|
274
|
+
while 0 < timeoutSec do
|
275
|
+
reload
|
276
|
+
s = get_status
|
277
|
+
s = Saklient::Cloud::Enums::EServerInstanceStatus::down if (s).nil?
|
278
|
+
return true if s == status
|
279
|
+
timeoutSec -= step
|
280
|
+
sleep(step) if 0 < timeoutSec
|
281
|
+
end
|
282
|
+
return false
|
283
|
+
end
|
284
|
+
|
150
285
|
# @return [bool]
|
151
286
|
attr_accessor :n_id
|
152
287
|
|
@@ -300,6 +435,7 @@ module Saklient
|
|
300
435
|
# @private
|
301
436
|
# @return [Array<String>]
|
302
437
|
def get_tags
|
438
|
+
@n_tags = true
|
303
439
|
return @m_tags
|
304
440
|
end
|
305
441
|
|
@@ -372,6 +508,47 @@ module Saklient
|
|
372
508
|
|
373
509
|
protected
|
374
510
|
|
511
|
+
# @return [bool]
|
512
|
+
attr_accessor :n_plan_id
|
513
|
+
|
514
|
+
# (This method is generated in Translator_default#buildImpl)
|
515
|
+
#
|
516
|
+
# @private
|
517
|
+
# @return [Fixnum]
|
518
|
+
def get_plan_id
|
519
|
+
return @m_plan_id
|
520
|
+
end
|
521
|
+
|
522
|
+
# (This method is generated in Translator_default#buildImpl)
|
523
|
+
#
|
524
|
+
# @private
|
525
|
+
# @param [Fixnum] v
|
526
|
+
# @return [Fixnum]
|
527
|
+
def set_plan_id(v)
|
528
|
+
Saklient::Util::validate_type(v, 'Fixnum')
|
529
|
+
raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Appliance#plan_id') if !@is_new
|
530
|
+
@m_plan_id = v
|
531
|
+
@n_plan_id = true
|
532
|
+
return @m_plan_id
|
533
|
+
end
|
534
|
+
|
535
|
+
public
|
536
|
+
|
537
|
+
# プラン
|
538
|
+
#
|
539
|
+
# @return [Fixnum]
|
540
|
+
attr_accessor :plan_id
|
541
|
+
|
542
|
+
def plan_id
|
543
|
+
get_plan_id
|
544
|
+
end
|
545
|
+
|
546
|
+
def plan_id=(v)
|
547
|
+
set_plan_id(v)
|
548
|
+
end
|
549
|
+
|
550
|
+
protected
|
551
|
+
|
375
552
|
# @return [bool]
|
376
553
|
attr_accessor :n_ifaces
|
377
554
|
|
@@ -385,7 +562,7 @@ module Saklient
|
|
385
562
|
|
386
563
|
public
|
387
564
|
|
388
|
-
#
|
565
|
+
# インタフェース
|
389
566
|
#
|
390
567
|
# @return [Array<Iface>]
|
391
568
|
attr_reader :ifaces
|
@@ -396,6 +573,133 @@ module Saklient
|
|
396
573
|
|
397
574
|
protected
|
398
575
|
|
576
|
+
# @return [bool]
|
577
|
+
attr_accessor :n_raw_annotation
|
578
|
+
|
579
|
+
# (This method is generated in Translator_default#buildImpl)
|
580
|
+
#
|
581
|
+
# @private
|
582
|
+
# @return [any]
|
583
|
+
def get_raw_annotation
|
584
|
+
return @m_raw_annotation
|
585
|
+
end
|
586
|
+
|
587
|
+
# (This method is generated in Translator_default#buildImpl)
|
588
|
+
#
|
589
|
+
# @private
|
590
|
+
# @param [any] v
|
591
|
+
# @return [any]
|
592
|
+
def set_raw_annotation(v)
|
593
|
+
raise Saklient::Errors::SaklientException.new('immutable_field', 'Immutable fields cannot be modified after the resource creation: ' + 'Saklient::Cloud::Resources::Appliance#raw_annotation') if !@is_new
|
594
|
+
@m_raw_annotation = v
|
595
|
+
@n_raw_annotation = true
|
596
|
+
return @m_raw_annotation
|
597
|
+
end
|
598
|
+
|
599
|
+
public
|
600
|
+
|
601
|
+
# 注釈
|
602
|
+
#
|
603
|
+
# @return [any]
|
604
|
+
attr_accessor :raw_annotation
|
605
|
+
|
606
|
+
def raw_annotation
|
607
|
+
get_raw_annotation
|
608
|
+
end
|
609
|
+
|
610
|
+
def raw_annotation=(v)
|
611
|
+
set_raw_annotation(v)
|
612
|
+
end
|
613
|
+
|
614
|
+
protected
|
615
|
+
|
616
|
+
# @return [bool]
|
617
|
+
attr_accessor :n_raw_settings
|
618
|
+
|
619
|
+
# (This method is generated in Translator_default#buildImpl)
|
620
|
+
#
|
621
|
+
# @private
|
622
|
+
# @return [any]
|
623
|
+
def get_raw_settings
|
624
|
+
@n_raw_settings = true
|
625
|
+
return @m_raw_settings
|
626
|
+
end
|
627
|
+
|
628
|
+
# (This method is generated in Translator_default#buildImpl)
|
629
|
+
#
|
630
|
+
# @private
|
631
|
+
# @param [any] v
|
632
|
+
# @return [any]
|
633
|
+
def set_raw_settings(v)
|
634
|
+
@m_raw_settings = v
|
635
|
+
@n_raw_settings = true
|
636
|
+
return @m_raw_settings
|
637
|
+
end
|
638
|
+
|
639
|
+
public
|
640
|
+
|
641
|
+
# 設定の生データ
|
642
|
+
#
|
643
|
+
# @return [any]
|
644
|
+
attr_accessor :raw_settings
|
645
|
+
|
646
|
+
def raw_settings
|
647
|
+
get_raw_settings
|
648
|
+
end
|
649
|
+
|
650
|
+
def raw_settings=(v)
|
651
|
+
set_raw_settings(v)
|
652
|
+
end
|
653
|
+
|
654
|
+
protected
|
655
|
+
|
656
|
+
# @return [bool]
|
657
|
+
attr_accessor :n_raw_settings_hash
|
658
|
+
|
659
|
+
# (This method is generated in Translator_default#buildImpl)
|
660
|
+
#
|
661
|
+
# @private
|
662
|
+
# @return [String]
|
663
|
+
def get_raw_settings_hash
|
664
|
+
return @m_raw_settings_hash
|
665
|
+
end
|
666
|
+
|
667
|
+
public
|
668
|
+
|
669
|
+
# @private
|
670
|
+
# @return [String]
|
671
|
+
attr_reader :raw_settings_hash
|
672
|
+
|
673
|
+
def raw_settings_hash
|
674
|
+
get_raw_settings_hash
|
675
|
+
end
|
676
|
+
|
677
|
+
protected
|
678
|
+
|
679
|
+
# @return [bool]
|
680
|
+
attr_accessor :n_status
|
681
|
+
|
682
|
+
# (This method is generated in Translator_default#buildImpl)
|
683
|
+
#
|
684
|
+
# @private
|
685
|
+
# @return [String]
|
686
|
+
def get_status
|
687
|
+
return @m_status
|
688
|
+
end
|
689
|
+
|
690
|
+
public
|
691
|
+
|
692
|
+
# 起動状態 {Saklient::Cloud::Enums::EServerInstanceStatus}
|
693
|
+
#
|
694
|
+
# @return [String]
|
695
|
+
attr_reader :status
|
696
|
+
|
697
|
+
def status
|
698
|
+
get_status
|
699
|
+
end
|
700
|
+
|
701
|
+
protected
|
702
|
+
|
399
703
|
# @return [bool]
|
400
704
|
attr_accessor :n_service_class
|
401
705
|
|
@@ -420,6 +724,54 @@ module Saklient
|
|
420
724
|
|
421
725
|
protected
|
422
726
|
|
727
|
+
# @return [bool]
|
728
|
+
attr_accessor :n_availability
|
729
|
+
|
730
|
+
# (This method is generated in Translator_default#buildImpl)
|
731
|
+
#
|
732
|
+
# @private
|
733
|
+
# @return [String]
|
734
|
+
def get_availability
|
735
|
+
return @m_availability
|
736
|
+
end
|
737
|
+
|
738
|
+
public
|
739
|
+
|
740
|
+
# 有効状態 {Saklient::Cloud::Enums::EAvailability}
|
741
|
+
#
|
742
|
+
# @return [String]
|
743
|
+
attr_reader :availability
|
744
|
+
|
745
|
+
def availability
|
746
|
+
get_availability
|
747
|
+
end
|
748
|
+
|
749
|
+
protected
|
750
|
+
|
751
|
+
# @return [bool]
|
752
|
+
attr_accessor :n_swytch_id
|
753
|
+
|
754
|
+
# (This method is generated in Translator_default#buildImpl)
|
755
|
+
#
|
756
|
+
# @private
|
757
|
+
# @return [String]
|
758
|
+
def get_swytch_id
|
759
|
+
return @m_swytch_id
|
760
|
+
end
|
761
|
+
|
762
|
+
public
|
763
|
+
|
764
|
+
# 接続先スイッチID
|
765
|
+
#
|
766
|
+
# @return [String]
|
767
|
+
attr_reader :swytch_id
|
768
|
+
|
769
|
+
def swytch_id
|
770
|
+
get_swytch_id
|
771
|
+
end
|
772
|
+
|
773
|
+
protected
|
774
|
+
|
423
775
|
# (This method is generated in Translator_default#buildImpl)
|
424
776
|
#
|
425
777
|
# @param [any] r
|
@@ -478,6 +830,13 @@ module Saklient
|
|
478
830
|
@is_incomplete = true
|
479
831
|
end
|
480
832
|
@n_icon = false
|
833
|
+
if Saklient::Util::exists_path(r, 'Plan.ID')
|
834
|
+
@m_plan_id = (Saklient::Util::get_by_path(r, 'Plan.ID')).nil? ? nil : (Saklient::Util::get_by_path(r, 'Plan.ID').to_s).to_s().to_i(10)
|
835
|
+
else
|
836
|
+
@m_plan_id = nil
|
837
|
+
@is_incomplete = true
|
838
|
+
end
|
839
|
+
@n_plan_id = false
|
481
840
|
if Saklient::Util::exists_path(r, 'Interfaces')
|
482
841
|
if (Saklient::Util::get_by_path(r, 'Interfaces')).nil?
|
483
842
|
@m_ifaces = []
|
@@ -494,6 +853,34 @@ module Saklient
|
|
494
853
|
@is_incomplete = true
|
495
854
|
end
|
496
855
|
@n_ifaces = false
|
856
|
+
if Saklient::Util::exists_path(r, 'Remark')
|
857
|
+
@m_raw_annotation = Saklient::Util::get_by_path(r, 'Remark')
|
858
|
+
else
|
859
|
+
@m_raw_annotation = nil
|
860
|
+
@is_incomplete = true
|
861
|
+
end
|
862
|
+
@n_raw_annotation = false
|
863
|
+
if Saklient::Util::exists_path(r, 'Settings')
|
864
|
+
@m_raw_settings = Saklient::Util::get_by_path(r, 'Settings')
|
865
|
+
else
|
866
|
+
@m_raw_settings = nil
|
867
|
+
@is_incomplete = true
|
868
|
+
end
|
869
|
+
@n_raw_settings = false
|
870
|
+
if Saklient::Util::exists_path(r, 'SettingsHash')
|
871
|
+
@m_raw_settings_hash = (Saklient::Util::get_by_path(r, 'SettingsHash')).nil? ? nil : Saklient::Util::get_by_path(r, 'SettingsHash').to_s
|
872
|
+
else
|
873
|
+
@m_raw_settings_hash = nil
|
874
|
+
@is_incomplete = true
|
875
|
+
end
|
876
|
+
@n_raw_settings_hash = false
|
877
|
+
if Saklient::Util::exists_path(r, 'Instance.Status')
|
878
|
+
@m_status = (Saklient::Util::get_by_path(r, 'Instance.Status')).nil? ? nil : Saklient::Util::get_by_path(r, 'Instance.Status').to_s
|
879
|
+
else
|
880
|
+
@m_status = nil
|
881
|
+
@is_incomplete = true
|
882
|
+
end
|
883
|
+
@n_status = false
|
497
884
|
if Saklient::Util::exists_path(r, 'ServiceClass')
|
498
885
|
@m_service_class = (Saklient::Util::get_by_path(r, 'ServiceClass')).nil? ? nil : Saklient::Util::get_by_path(r, 'ServiceClass').to_s
|
499
886
|
else
|
@@ -501,6 +888,20 @@ module Saklient
|
|
501
888
|
@is_incomplete = true
|
502
889
|
end
|
503
890
|
@n_service_class = false
|
891
|
+
if Saklient::Util::exists_path(r, 'Availability')
|
892
|
+
@m_availability = (Saklient::Util::get_by_path(r, 'Availability')).nil? ? nil : Saklient::Util::get_by_path(r, 'Availability').to_s
|
893
|
+
else
|
894
|
+
@m_availability = nil
|
895
|
+
@is_incomplete = true
|
896
|
+
end
|
897
|
+
@n_availability = false
|
898
|
+
if Saklient::Util::exists_path(r, 'Switch.ID')
|
899
|
+
@m_swytch_id = (Saklient::Util::get_by_path(r, 'Switch.ID')).nil? ? nil : Saklient::Util::get_by_path(r, 'Switch.ID').to_s
|
900
|
+
else
|
901
|
+
@m_swytch_id = nil
|
902
|
+
@is_incomplete = true
|
903
|
+
end
|
904
|
+
@n_swytch_id = false
|
504
905
|
end
|
505
906
|
|
506
907
|
# @private
|
@@ -531,6 +932,11 @@ module Saklient
|
|
531
932
|
end
|
532
933
|
end
|
533
934
|
Saklient::Util::set_by_path(ret, 'Icon', withClean ? ((@m_icon).nil? ? nil : @m_icon.api_serialize(withClean)) : ((@m_icon).nil? ? { ID: '0' } : @m_icon.api_serialize_id)) if withClean || @n_icon
|
935
|
+
if withClean || @n_plan_id
|
936
|
+
Saklient::Util::set_by_path(ret, 'Plan.ID', @m_plan_id)
|
937
|
+
else
|
938
|
+
missing << 'plan_id' if @is_new
|
939
|
+
end
|
534
940
|
if withClean || @n_ifaces
|
535
941
|
Saklient::Util::set_by_path(ret, 'Interfaces', [])
|
536
942
|
for r2 in @m_ifaces
|
@@ -539,7 +945,17 @@ module Saklient
|
|
539
945
|
ret[:Interfaces] << v
|
540
946
|
end
|
541
947
|
end
|
948
|
+
if withClean || @n_raw_annotation
|
949
|
+
Saklient::Util::set_by_path(ret, 'Remark', @m_raw_annotation)
|
950
|
+
else
|
951
|
+
missing << 'raw_annotation' if @is_new
|
952
|
+
end
|
953
|
+
Saklient::Util::set_by_path(ret, 'Settings', @m_raw_settings) if withClean || @n_raw_settings
|
954
|
+
Saklient::Util::set_by_path(ret, 'SettingsHash', @m_raw_settings_hash) if withClean || @n_raw_settings_hash
|
955
|
+
Saklient::Util::set_by_path(ret, 'Instance.Status', @m_status) if withClean || @n_status
|
542
956
|
Saklient::Util::set_by_path(ret, 'ServiceClass', @m_service_class) if withClean || @n_service_class
|
957
|
+
Saklient::Util::set_by_path(ret, 'Availability', @m_availability) if withClean || @n_availability
|
958
|
+
Saklient::Util::set_by_path(ret, 'Switch.ID', @m_swytch_id) if withClean || @n_swytch_id
|
543
959
|
raise Saklient::Errors::SaklientException.new('required_field', 'Required fields must be set before the Appliance creation: ' + missing.join(', ')) if missing.length > 0
|
544
960
|
return ret
|
545
961
|
end
|
@@ -267,14 +267,7 @@ module Saklient
|
|
267
267
|
s = r[:SourceDisk]
|
268
268
|
if !(s).nil?
|
269
269
|
id = s[:ID]
|
270
|
-
if !(id).nil?
|
271
|
-
obj = Saklient::Util::create_class_instance('saklient.cloud.resources.Disk', [
|
272
|
-
@_client,
|
273
|
-
s,
|
274
|
-
false
|
275
|
-
])
|
276
|
-
@_source = obj
|
277
|
-
end
|
270
|
+
@_source = Saklient::Cloud::Resources::Resource::create_with('Disk', @_client, s) if !(id).nil?
|
278
271
|
end
|
279
272
|
end
|
280
273
|
end
|
@@ -331,20 +324,6 @@ module Saklient
|
|
331
324
|
return self
|
332
325
|
end
|
333
326
|
|
334
|
-
# コピー中のアーカイブが利用可能になるまで待機します.
|
335
|
-
#
|
336
|
-
# @private
|
337
|
-
# @yield [Saklient::Cloud::Resources::Archive, bool]
|
338
|
-
# @yieldreturn [void]
|
339
|
-
# @param [Fixnum] timeoutSec
|
340
|
-
# @return [void]
|
341
|
-
def after_copy(timeoutSec, &callback)
|
342
|
-
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
343
|
-
Saklient::Util::validate_type(callback, 'Proc')
|
344
|
-
ret = sleep_while_copying(timeoutSec)
|
345
|
-
callback.call(self, ret)
|
346
|
-
end
|
347
|
-
|
348
327
|
# コピー中のアーカイブが利用可能になるまで待機します.
|
349
328
|
#
|
350
329
|
# @param [Fixnum] timeoutSec
|
@@ -358,7 +337,7 @@ module Saklient
|
|
358
337
|
return true if a == Saklient::Cloud::Enums::EAvailability::available
|
359
338
|
timeoutSec = 0 if a != Saklient::Cloud::Enums::EAvailability::migrating
|
360
339
|
timeoutSec -= step
|
361
|
-
sleep
|
340
|
+
sleep(step) if 0 < timeoutSec
|
362
341
|
end
|
363
342
|
return false
|
364
343
|
end
|
@@ -501,6 +480,7 @@ module Saklient
|
|
501
480
|
# @private
|
502
481
|
# @return [Array<String>]
|
503
482
|
def get_tags
|
483
|
+
@n_tags = true
|
504
484
|
return @m_tags
|
505
485
|
end
|
506
486
|
|
@@ -785,14 +765,14 @@ module Saklient
|
|
785
765
|
end
|
786
766
|
@n_icon = false
|
787
767
|
if Saklient::Util::exists_path(r, 'DisplayOrder')
|
788
|
-
@m_display_order = (Saklient::Util::get_by_path(r, 'DisplayOrder')).nil? ? nil : (Saklient::Util::get_by_path(r, 'DisplayOrder').to_s).to_i(10)
|
768
|
+
@m_display_order = (Saklient::Util::get_by_path(r, 'DisplayOrder')).nil? ? nil : (Saklient::Util::get_by_path(r, 'DisplayOrder').to_s).to_s().to_i(10)
|
789
769
|
else
|
790
770
|
@m_display_order = nil
|
791
771
|
@is_incomplete = true
|
792
772
|
end
|
793
773
|
@n_display_order = false
|
794
774
|
if Saklient::Util::exists_path(r, 'SizeMB')
|
795
|
-
@m_size_mib = (Saklient::Util::get_by_path(r, 'SizeMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'SizeMB').to_s).to_i(10)
|
775
|
+
@m_size_mib = (Saklient::Util::get_by_path(r, 'SizeMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'SizeMB').to_s).to_s().to_i(10)
|
796
776
|
else
|
797
777
|
@m_size_mib = nil
|
798
778
|
@is_incomplete = true
|
@@ -234,14 +234,7 @@ module Saklient
|
|
234
234
|
s = r[:SourceArchive]
|
235
235
|
if !(s).nil?
|
236
236
|
id = s[:ID]
|
237
|
-
if !(id).nil?
|
238
|
-
obj = Saklient::Util::create_class_instance('saklient.cloud.resources.Archive', [
|
239
|
-
@_client,
|
240
|
-
s,
|
241
|
-
false
|
242
|
-
])
|
243
|
-
@_source = obj
|
244
|
-
end
|
237
|
+
@_source = Saklient::Cloud::Resources::Resource::create_with('Archive', @_client, s) if !(id).nil?
|
245
238
|
end
|
246
239
|
end
|
247
240
|
end
|
@@ -299,34 +292,20 @@ module Saklient
|
|
299
292
|
return Saklient::Cloud::Resources::DiskConfig.new(@_client, _id)
|
300
293
|
end
|
301
294
|
|
302
|
-
# コピー中のディスクが利用可能になるまで待機します.
|
303
|
-
#
|
304
|
-
# @private
|
305
|
-
# @yield [Saklient::Cloud::Resources::Disk, bool]
|
306
|
-
# @yieldreturn [void]
|
307
|
-
# @param [Fixnum] timeoutSec
|
308
|
-
# @return [void]
|
309
|
-
def after_copy(timeoutSec, &callback)
|
310
|
-
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
311
|
-
Saklient::Util::validate_type(callback, 'Proc')
|
312
|
-
ret = sleep_while_copying(timeoutSec)
|
313
|
-
callback.call(self, ret)
|
314
|
-
end
|
315
|
-
|
316
295
|
# コピー中のディスクが利用可能になるまで待機します.
|
317
296
|
#
|
318
297
|
# @param [Fixnum] timeoutSec
|
319
298
|
# @return [bool] 成功時はtrue, タイムアウトやエラーによる失敗時はfalseを返します.
|
320
299
|
def sleep_while_copying(timeoutSec = 3600)
|
321
300
|
Saklient::Util::validate_type(timeoutSec, 'Fixnum')
|
322
|
-
step =
|
301
|
+
step = 10
|
323
302
|
while 0 < timeoutSec do
|
324
303
|
reload
|
325
304
|
a = get_availability
|
326
305
|
return true if a == Saklient::Cloud::Enums::EAvailability::available
|
327
306
|
timeoutSec = 0 if a != Saklient::Cloud::Enums::EAvailability::migrating
|
328
307
|
timeoutSec -= step
|
329
|
-
sleep
|
308
|
+
sleep(step) if 0 < timeoutSec
|
330
309
|
end
|
331
310
|
return false
|
332
311
|
end
|
@@ -445,6 +424,7 @@ module Saklient
|
|
445
424
|
# @private
|
446
425
|
# @return [Array<String>]
|
447
426
|
def get_tags
|
427
|
+
@n_tags = true
|
448
428
|
return @m_tags
|
449
429
|
end
|
450
430
|
|
@@ -723,7 +703,7 @@ module Saklient
|
|
723
703
|
end
|
724
704
|
@n_icon = false
|
725
705
|
if Saklient::Util::exists_path(r, 'SizeMB')
|
726
|
-
@m_size_mib = (Saklient::Util::get_by_path(r, 'SizeMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'SizeMB').to_s).to_i(10)
|
706
|
+
@m_size_mib = (Saklient::Util::get_by_path(r, 'SizeMB')).nil? ? nil : (Saklient::Util::get_by_path(r, 'SizeMB').to_s).to_s().to_i(10)
|
727
707
|
else
|
728
708
|
@m_size_mib = nil
|
729
709
|
@is_incomplete = true
|
@@ -232,7 +232,7 @@ module Saklient
|
|
232
232
|
end
|
233
233
|
@n_address = false
|
234
234
|
if Saklient::Util::exists_path(r, 'NetworkMaskLen')
|
235
|
-
@m_mask_len = (Saklient::Util::get_by_path(r, 'NetworkMaskLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'NetworkMaskLen').to_s).to_i(10)
|
235
|
+
@m_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)
|
236
236
|
else
|
237
237
|
@m_mask_len = nil
|
238
238
|
@is_incomplete = true
|
@@ -203,7 +203,7 @@ module Saklient
|
|
203
203
|
end
|
204
204
|
@n_prefix = false
|
205
205
|
if Saklient::Util::exists_path(r, 'IPv6PrefixLen')
|
206
|
-
@m_prefix_len = (Saklient::Util::get_by_path(r, 'IPv6PrefixLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'IPv6PrefixLen').to_s).to_i(10)
|
206
|
+
@m_prefix_len = (Saklient::Util::get_by_path(r, 'IPv6PrefixLen')).nil? ? nil : (Saklient::Util::get_by_path(r, 'IPv6PrefixLen').to_s).to_s().to_i(10)
|
207
207
|
else
|
208
208
|
@m_prefix_len = nil
|
209
209
|
@is_incomplete = true
|