Overview

Namespaces

  • PHP
  • Saklient
    • Cloud
      • Enums
      • Errors
      • Models
      • Resources
    • Errors

Classes

  • Activity
  • Appliance
  • Archive
  • Bridge
  • Disk
  • DiskActivity
  • DiskConfig
  • DiskPlan
  • FtpInfo
  • Icon
  • Iface
  • IfaceActivity
  • Ipv4Net
  • Ipv4Range
  • Ipv6Net
  • IsoImage
  • LbServer
  • LbVirtualIp
  • License
  • LicenseInfo
  • LoadBalancer
  • Region
  • Router
  • RouterActivity
  • RouterPlan
  • Script
  • Server
  • ServerActivity
  • ServerInstance
  • ServerPlan
  • Swytch
  • VpcRouter
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Saklient\Cloud\Resources;
  4: 
  5: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
  6: use \Saklient\Errors\SaklientException;
  7: require_once __DIR__ . "/../../../Saklient/Errors/HttpException.php";
  8: use \Saklient\Errors\HttpException;
  9: require_once __DIR__ . "/../../../Saklient/Cloud/Client.php";
 10: use \Saklient\Cloud\Client;
 11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Resource.php";
 12: use \Saklient\Cloud\Resources\Resource;
 13: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Icon.php";
 14: use \Saklient\Cloud\Resources\Icon;
 15: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/DiskPlan.php";
 16: use \Saklient\Cloud\Resources\DiskPlan;
 17: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Server.php";
 18: use \Saklient\Cloud\Resources\Server;
 19: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/DiskConfig.php";
 20: use \Saklient\Cloud\Resources\DiskConfig;
 21: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/DiskActivity.php";
 22: use \Saklient\Cloud\Resources\DiskActivity;
 23: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EAvailability.php";
 24: use \Saklient\Cloud\Enums\EAvailability;
 25: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EDiskConnection.php";
 26: use \Saklient\Cloud\Enums\EDiskConnection;
 27: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EStorageClass.php";
 28: use \Saklient\Cloud\Enums\EStorageClass;
 29: require_once __DIR__ . "/../../../Saklient/Util.php";
 30: use \Saklient\Util;
 31: 
 32: /**
 33:  * ディスクの実体1つに対応し、属性の取得や操作を行うためのクラス。
 34:  * 
 35:  * @property-read \Saklient\Cloud\Resources\DiskActivity $activity アクティビティ 
 36:  * @property-read boolean $isAvailable ディスクが利用可能なときtrueを返します。 
 37:  * @property int $sizeGib サイズ[GiB] 
 38:  * @property \Saklient\Cloud\Resources\Resource $source ディスクのコピー元 
 39:  * @property-read string $id ID 
 40:  * @property string $name 名前 
 41:  * @property string $description 説明 
 42:  * @property \ArrayObject $tags タグ文字列の配列 
 43:  * @property \Saklient\Cloud\Resources\Icon $icon アイコン 
 44:  * @property int $sizeMib サイズ[MiB] 
 45:  * @property-read string $serviceClass サービスクラス 
 46:  * @property \Saklient\Cloud\Resources\DiskPlan $plan プラン 
 47:  * @property-read \Saklient\Cloud\Resources\Server $server 接続先のサーバ 
 48:  * @property-read string $availability 有効状態 {@link \Saklient\Cloud\Enums\EAvailability} 
 49:  */
 50: class Disk extends Resource {
 51:     
 52:     /**
 53:      * ID
 54:      * 
 55:      * @access protected
 56:      * @ignore
 57:      * @var string
 58:      */
 59:     protected $m_id;
 60:     
 61:     /**
 62:      * 名前
 63:      * 
 64:      * @access protected
 65:      * @ignore
 66:      * @var string
 67:      */
 68:     protected $m_name;
 69:     
 70:     /**
 71:      * 説明
 72:      * 
 73:      * @access protected
 74:      * @ignore
 75:      * @var string
 76:      */
 77:     protected $m_description;
 78:     
 79:     /**
 80:      * タグ文字列の配列
 81:      * 
 82:      * @access protected
 83:      * @ignore
 84:      * @var string[]
 85:      */
 86:     protected $m_tags;
 87:     
 88:     /**
 89:      * アイコン
 90:      * 
 91:      * @access protected
 92:      * @ignore
 93:      * @var Icon
 94:      */
 95:     protected $m_icon;
 96:     
 97:     /**
 98:      * サイズ[MiB]
 99:      * 
100:      * @access protected
101:      * @ignore
102:      * @var int
103:      */
104:     protected $m_sizeMib;
105:     
106:     /**
107:      * サービスクラス
108:      * 
109:      * @access protected
110:      * @ignore
111:      * @var string
112:      */
113:     protected $m_serviceClass;
114:     
115:     /**
116:      * プラン
117:      * 
118:      * @access protected
119:      * @ignore
120:      * @var DiskPlan
121:      */
122:     protected $m_plan;
123:     
124:     /**
125:      * 接続先のサーバ
126:      * 
127:      * @access protected
128:      * @ignore
129:      * @var Server
130:      */
131:     protected $m_server;
132:     
133:     /**
134:      * 有効状態 {@link \Saklient\Cloud\Enums\EAvailability}
135:      * 
136:      * @access protected
137:      * @ignore
138:      * @var string
139:      */
140:     protected $m_availability;
141:     
142:     /**
143:      * @private
144:      * @access protected
145:      * @ignore
146:      * @return string
147:      */
148:     protected function _apiPath()
149:     {
150:         return "/disk";
151:     }
152:     
153:     /**
154:      * @private
155:      * @access protected
156:      * @ignore
157:      * @return string
158:      */
159:     protected function _rootKey()
160:     {
161:         return "Disk";
162:     }
163:     
164:     /**
165:      * @private
166:      * @access protected
167:      * @ignore
168:      * @return string
169:      */
170:     protected function _rootKeyM()
171:     {
172:         return "Disks";
173:     }
174:     
175:     /**
176:      * @private
177:      * @access public
178:      * @ignore
179:      * @return string
180:      */
181:     public function _className()
182:     {
183:         return "Disk";
184:     }
185:     
186:     /**
187:      * @private
188:      * @access public
189:      * @ignore
190:      * @return string
191:      */
192:     public function _id()
193:     {
194:         return $this->get_id();
195:     }
196:     
197:     /**
198:      * このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し、新規作成または上書き保存します。
199:      * 
200:      * @access public
201:      * @return \Saklient\Cloud\Resources\Disk this
202:      */
203:     public function save()
204:     {
205:         return $this->_save();
206:     }
207:     
208:     /**
209:      * 最新のリソース情報を再取得します。
210:      * 
211:      * @access public
212:      * @return \Saklient\Cloud\Resources\Disk this
213:      */
214:     public function reload()
215:     {
216:         return $this->_reload();
217:     }
218:     
219:     /**
220:      * @private
221:      * @access protected
222:      * @ignore
223:      * @var DiskActivity
224:      */
225:     protected $_activity;
226:     
227:     /**
228:      * @access public
229:      * @ignore
230:      * @return \Saklient\Cloud\Resources\DiskActivity
231:      */
232:     public function get_activity()
233:     {
234:         return $this->_activity;
235:     }
236:     
237:     
238:     
239:     /**
240:      * @ignore
241:      * @access public
242:      * @param \Saklient\Cloud\Client $client
243:      * @param mixed $obj
244:      * @param boolean $wrapped=false
245:      */
246:     public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
247:     {
248:         parent::__construct($client);
249:         Util::validateArgCount(func_num_args(), 2);
250:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
251:         Util::validateType($wrapped, "boolean");
252:         $this->_activity = new DiskActivity($client);
253:         $this->apiDeserialize($obj, $wrapped);
254:     }
255:     
256:     /**
257:      * @access protected
258:      * @ignore
259:      * @return boolean
260:      */
261:     protected function get_isAvailable()
262:     {
263:         return $this->get_availability() == EAvailability::available;
264:     }
265:     
266:     
267:     
268:     /**
269:      * @access protected
270:      * @ignore
271:      * @return int
272:      */
273:     protected function get_sizeGib()
274:     {
275:         $sizeMib = $this->get_sizeMib();
276:         return $sizeMib == null ? null : $sizeMib >> 10;
277:     }
278:     
279:     /**
280:      * @access protected
281:      * @ignore
282:      * @param int|null $sizeGib
283:      * @return int
284:      */
285:     protected function set_sizeGib($sizeGib)
286:     {
287:         Util::validateArgCount(func_num_args(), 1);
288:         Util::validateType($sizeGib, "int");
289:         $this->set_sizeMib($sizeGib == null ? null : $sizeGib * 1024);
290:         return $sizeGib;
291:     }
292:     
293:     
294:     
295:     /**
296:      * @private
297:      * @access private
298:      * @ignore
299:      * @var Resource
300:      */
301:     private $_source;
302:     
303:     /**
304:      * @access public
305:      * @ignore
306:      * @return \Saklient\Cloud\Resources\Resource
307:      */
308:     public function get_source()
309:     {
310:         return $this->_source;
311:     }
312:     
313:     /**
314:      * @access public
315:      * @ignore
316:      * @param \Saklient\Cloud\Resources\Resource|null $source
317:      * @return \Saklient\Cloud\Resources\Resource
318:      */
319:     public function set_source(\Saklient\Cloud\Resources\Resource $source=null)
320:     {
321:         Util::validateArgCount(func_num_args(), 1);
322:         Util::validateType($source, "\\Saklient\\Cloud\\Resources\\Resource");
323:         $this->_source = $source;
324:         return $source;
325:     }
326:     
327:     
328:     
329:     /**
330:      * @private
331:      * @access protected
332:      * @ignore
333:      * @param mixed $r
334:      * @param mixed $root
335:      * @return void
336:      */
337:     protected function _onAfterApiDeserialize($r, $root)
338:     {
339:         Util::validateArgCount(func_num_args(), 2);
340:         if ($r != null) {
341:             $this->_activity->setSourceId($this->_id());
342:             if (array_key_exists("SourceDisk", (array)($r))) {
343:                 $s = $r->{"SourceDisk"};
344:                 if ($s != null) {
345:                     $id = $s->{"ID"};
346:                     if ($id != null) {
347:                         $this->_source = new Disk($this->_client, $s);
348:                     }
349:                 }
350:             }
351:             if (array_key_exists("SourceArchive", (array)($r))) {
352:                 $s = $r->{"SourceArchive"};
353:                 if ($s != null) {
354:                     $id = $s->{"ID"};
355:                     if ($id != null) {
356:                         $this->_source = Resource::createWith("Archive", $this->_client, $s);
357:                     }
358:                 }
359:             }
360:         }
361:     }
362:     
363:     /**
364:      * @private
365:      * @access protected
366:      * @ignore
367:      * @param mixed $r
368:      * @param boolean $withClean
369:      * @return void
370:      */
371:     protected function _onAfterApiSerialize($r, $withClean)
372:     {
373:         Util::validateArgCount(func_num_args(), 2);
374:         Util::validateType($withClean, "boolean");
375:         if ($r == null) {
376:             return;
377:         }
378:         if ($this->_source != null) {
379:             if ($this->_source->_className() == "Disk") {
380:                 $s = $withClean ? $this->_source->apiSerialize(true) : (object)['ID' => $this->_source->_id()];
381:                 $r->{"SourceDisk"} = $s;
382:             }
383:             else {
384:                 if ($this->_source->_className() == "Archive") {
385:                     $s = $withClean ? $this->_source->apiSerialize(true) : (object)['ID' => $this->_source->_id()];
386:                     $r->{"SourceArchive"} = $s;
387:                 }
388:                 else {
389:                     $this->_source = null;
390:                     Util::validateType($this->_source, "Disk or Archive", true);
391:                 }
392:             }
393:         }
394:     }
395:     
396:     /**
397:      * ディスクをサーバに取り付けます。
398:      * 
399:      * @access public
400:      * @param \Saklient\Cloud\Resources\Server $server
401:      * @return \Saklient\Cloud\Resources\Disk this
402:      */
403:     public function connectTo(\Saklient\Cloud\Resources\Server $server)
404:     {
405:         Util::validateArgCount(func_num_args(), 1);
406:         Util::validateType($server, "\\Saklient\\Cloud\\Resources\\Server");
407:         $this->_client->request("PUT", "/disk/" . $this->_id() . "/to/server/" . $server->_id());
408:         return $this;
409:     }
410:     
411:     /**
412:      * ディスクをサーバから取り外します。
413:      * 
414:      * @access public
415:      * @return \Saklient\Cloud\Resources\Disk this
416:      */
417:     public function disconnect()
418:     {
419:         $this->_client->request("DELETE", "/disk/" . $this->_id() . "/to/server");
420:         return $this;
421:     }
422:     
423:     /**
424:      * ディスク修正を行うためのオブジェクトを用意します。
425:      * 
426:      * 返り値のオブジェクトにパラメータを設定し、write() を呼ぶことで修正を行います。
427:      * 
428:      * @access public
429:      * @return \Saklient\Cloud\Resources\DiskConfig
430:      */
431:     public function createConfig()
432:     {
433:         return new DiskConfig($this->_client, $this->_id());
434:     }
435:     
436:     /**
437:      * コピー中のディスクが利用可能になるまで待機します。
438:      * 
439:      * @access public
440:      * @param int $timeoutSec=3600
441:      * @return boolean 成功時はtrue、タイムアウトやエラーによる失敗時はfalseを返します。
442:      */
443:     public function sleepWhileCopying($timeoutSec=3600)
444:     {
445:         Util::validateType($timeoutSec, "int");
446:         $step = 10;
447:         while (0 < $timeoutSec) {
448:             try {
449:                 $this->reload();
450:             }
451:             catch (HttpException $ex) {
452:             }
453:             $a = $this->get_availability();
454:             if ($a == EAvailability::available) {
455:                 return true;
456:             }
457:             if ($a != EAvailability::migrating) {
458:                 $timeoutSec = 0;
459:             }
460:             $timeoutSec -= $step;
461:             if (0 < $timeoutSec) {
462:                 Util::sleep($step);
463:             }
464:         }
465:         return false;
466:     }
467:     
468:     /**
469:      * @access private
470:      * @ignore
471:      * @var boolean
472:      */
473:     private $n_id = false;
474:     
475:     /**
476:      * (This method is generated in Translator_default#buildImpl)
477:      * 
478:      * @access private
479:      * @ignore
480:      * @return string
481:      */
482:     private function get_id()
483:     {
484:         return $this->m_id;
485:     }
486:     
487:     
488:     
489:     /**
490:      * @access private
491:      * @ignore
492:      * @var boolean
493:      */
494:     private $n_name = false;
495:     
496:     /**
497:      * (This method is generated in Translator_default#buildImpl)
498:      * 
499:      * @access private
500:      * @ignore
501:      * @return string
502:      */
503:     private function get_name()
504:     {
505:         return $this->m_name;
506:     }
507:     
508:     /**
509:      * (This method is generated in Translator_default#buildImpl)
510:      * 
511:      * @access private
512:      * @ignore
513:      * @param string $v
514:      * @return string
515:      */
516:     private function set_name($v)
517:     {
518:         Util::validateArgCount(func_num_args(), 1);
519:         Util::validateType($v, "string");
520:         $this->m_name = $v;
521:         $this->n_name = true;
522:         return $this->m_name;
523:     }
524:     
525:     
526:     
527:     /**
528:      * @access private
529:      * @ignore
530:      * @var boolean
531:      */
532:     private $n_description = false;
533:     
534:     /**
535:      * (This method is generated in Translator_default#buildImpl)
536:      * 
537:      * @access private
538:      * @ignore
539:      * @return string
540:      */
541:     private function get_description()
542:     {
543:         return $this->m_description;
544:     }
545:     
546:     /**
547:      * (This method is generated in Translator_default#buildImpl)
548:      * 
549:      * @access private
550:      * @ignore
551:      * @param string $v
552:      * @return string
553:      */
554:     private function set_description($v)
555:     {
556:         Util::validateArgCount(func_num_args(), 1);
557:         Util::validateType($v, "string");
558:         $this->m_description = $v;
559:         $this->n_description = true;
560:         return $this->m_description;
561:     }
562:     
563:     
564:     
565:     /**
566:      * @access private
567:      * @ignore
568:      * @var boolean
569:      */
570:     private $n_tags = false;
571:     
572:     /**
573:      * (This method is generated in Translator_default#buildImpl)
574:      * 
575:      * @access private
576:      * @ignore
577:      * @return string[]
578:      */
579:     private function get_tags()
580:     {
581:         $this->n_tags = true;
582:         return $this->m_tags;
583:     }
584:     
585:     /**
586:      * (This method is generated in Translator_default#buildImpl)
587:      * 
588:      * @access private
589:      * @ignore
590:      * @param string[] $v
591:      * @return string[]
592:      */
593:     private function set_tags($v)
594:     {
595:         Util::validateArgCount(func_num_args(), 1);
596:         Util::validateType($v, "\\ArrayObject");
597:         if (is_array($v)) $v = Client::array2ArrayObject($v);
598:         $this->m_tags = $v;
599:         $this->n_tags = true;
600:         return $this->m_tags;
601:     }
602:     
603:     
604:     
605:     /**
606:      * @access private
607:      * @ignore
608:      * @var boolean
609:      */
610:     private $n_icon = false;
611:     
612:     /**
613:      * (This method is generated in Translator_default#buildImpl)
614:      * 
615:      * @access private
616:      * @ignore
617:      * @return \Saklient\Cloud\Resources\Icon
618:      */
619:     private function get_icon()
620:     {
621:         return $this->m_icon;
622:     }
623:     
624:     /**
625:      * (This method is generated in Translator_default#buildImpl)
626:      * 
627:      * @access private
628:      * @ignore
629:      * @param \Saklient\Cloud\Resources\Icon|null $v
630:      * @return \Saklient\Cloud\Resources\Icon
631:      */
632:     private function set_icon(\Saklient\Cloud\Resources\Icon $v=null)
633:     {
634:         Util::validateArgCount(func_num_args(), 1);
635:         Util::validateType($v, "\\Saklient\\Cloud\\Resources\\Icon");
636:         $this->m_icon = $v;
637:         $this->n_icon = true;
638:         return $this->m_icon;
639:     }
640:     
641:     
642:     
643:     /**
644:      * @access private
645:      * @ignore
646:      * @var boolean
647:      */
648:     private $n_sizeMib = false;
649:     
650:     /**
651:      * (This method is generated in Translator_default#buildImpl)
652:      * 
653:      * @access private
654:      * @ignore
655:      * @return int
656:      */
657:     private function get_sizeMib()
658:     {
659:         return $this->m_sizeMib;
660:     }
661:     
662:     /**
663:      * (This method is generated in Translator_default#buildImpl)
664:      * 
665:      * @access private
666:      * @ignore
667:      * @param int|null $v
668:      * @return int
669:      */
670:     private function set_sizeMib($v)
671:     {
672:         Util::validateArgCount(func_num_args(), 1);
673:         Util::validateType($v, "int");
674:         if (!$this->isNew) {
675:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\Disk#sizeMib");
676:         }
677:         $this->m_sizeMib = $v;
678:         $this->n_sizeMib = true;
679:         return $this->m_sizeMib;
680:     }
681:     
682:     
683:     
684:     /**
685:      * @access private
686:      * @ignore
687:      * @var boolean
688:      */
689:     private $n_serviceClass = false;
690:     
691:     /**
692:      * (This method is generated in Translator_default#buildImpl)
693:      * 
694:      * @access private
695:      * @ignore
696:      * @return string
697:      */
698:     private function get_serviceClass()
699:     {
700:         return $this->m_serviceClass;
701:     }
702:     
703:     
704:     
705:     /**
706:      * @access private
707:      * @ignore
708:      * @var boolean
709:      */
710:     private $n_plan = false;
711:     
712:     /**
713:      * (This method is generated in Translator_default#buildImpl)
714:      * 
715:      * @access private
716:      * @ignore
717:      * @return \Saklient\Cloud\Resources\DiskPlan
718:      */
719:     private function get_plan()
720:     {
721:         return $this->m_plan;
722:     }
723:     
724:     /**
725:      * (This method is generated in Translator_default#buildImpl)
726:      * 
727:      * @access private
728:      * @ignore
729:      * @param \Saklient\Cloud\Resources\DiskPlan $v
730:      * @return \Saklient\Cloud\Resources\DiskPlan
731:      */
732:     private function set_plan(\Saklient\Cloud\Resources\DiskPlan $v)
733:     {
734:         Util::validateArgCount(func_num_args(), 1);
735:         Util::validateType($v, "\\Saklient\\Cloud\\Resources\\DiskPlan");
736:         if (!$this->isNew) {
737:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\Disk#plan");
738:         }
739:         $this->m_plan = $v;
740:         $this->n_plan = true;
741:         return $this->m_plan;
742:     }
743:     
744:     
745:     
746:     /**
747:      * @access private
748:      * @ignore
749:      * @var boolean
750:      */
751:     private $n_server = false;
752:     
753:     /**
754:      * (This method is generated in Translator_default#buildImpl)
755:      * 
756:      * @access private
757:      * @ignore
758:      * @return \Saklient\Cloud\Resources\Server
759:      */
760:     private function get_server()
761:     {
762:         return $this->m_server;
763:     }
764:     
765:     
766:     
767:     /**
768:      * @access private
769:      * @ignore
770:      * @var boolean
771:      */
772:     private $n_availability = false;
773:     
774:     /**
775:      * (This method is generated in Translator_default#buildImpl)
776:      * 
777:      * @access private
778:      * @ignore
779:      * @return string
780:      */
781:     private function get_availability()
782:     {
783:         return $this->m_availability;
784:     }
785:     
786:     
787:     
788:     /**
789:      * (This method is generated in Translator_default#buildImpl)
790:      * 
791:      * @access protected
792:      * @ignore
793:      * @param mixed $r
794:      */
795:     protected function apiDeserializeImpl($r)
796:     {
797:         Util::validateArgCount(func_num_args(), 1);
798:         $this->isNew = $r == null;
799:         if ($this->isNew) {
800:             $r = (object)[];
801:         }
802:         $this->isIncomplete = false;
803:         if (Util::existsPath($r, "ID")) {
804:             $this->m_id = Util::getByPath($r, "ID") == null ? null : "" . Util::getByPath($r, "ID");
805:         }
806:         else {
807:             $this->m_id = null;
808:             $this->isIncomplete = true;
809:         }
810:         $this->n_id = false;
811:         if (Util::existsPath($r, "Name")) {
812:             $this->m_name = Util::getByPath($r, "Name") == null ? null : "" . Util::getByPath($r, "Name");
813:         }
814:         else {
815:             $this->m_name = null;
816:             $this->isIncomplete = true;
817:         }
818:         $this->n_name = false;
819:         if (Util::existsPath($r, "Description")) {
820:             $this->m_description = Util::getByPath($r, "Description") == null ? null : "" . Util::getByPath($r, "Description");
821:         }
822:         else {
823:             $this->m_description = null;
824:             $this->isIncomplete = true;
825:         }
826:         $this->n_description = false;
827:         if (Util::existsPath($r, "Tags")) {
828:             if (Util::getByPath($r, "Tags") == null) {
829:                 $this->m_tags = new \ArrayObject([]);
830:             }
831:             else {
832:                 $this->m_tags = new \ArrayObject([]);
833:                 foreach (Util::getByPath($r, "Tags") as $t) {
834:                     $v1 = null;
835:                     $v1 = $t == null ? null : "" . $t;
836:                     $this->m_tags->append($v1);
837:                 }
838:             }
839:         }
840:         else {
841:             $this->m_tags = null;
842:             $this->isIncomplete = true;
843:         }
844:         $this->n_tags = false;
845:         if (Util::existsPath($r, "Icon")) {
846:             $this->m_icon = Util::getByPath($r, "Icon") == null ? null : new Icon($this->_client, Util::getByPath($r, "Icon"));
847:         }
848:         else {
849:             $this->m_icon = null;
850:             $this->isIncomplete = true;
851:         }
852:         $this->n_icon = false;
853:         if (Util::existsPath($r, "SizeMB")) {
854:             $this->m_sizeMib = Util::getByPath($r, "SizeMB") == null ? null : intval("" . Util::getByPath($r, "SizeMB"));
855:         }
856:         else {
857:             $this->m_sizeMib = null;
858:             $this->isIncomplete = true;
859:         }
860:         $this->n_sizeMib = false;
861:         if (Util::existsPath($r, "ServiceClass")) {
862:             $this->m_serviceClass = Util::getByPath($r, "ServiceClass") == null ? null : "" . Util::getByPath($r, "ServiceClass");
863:         }
864:         else {
865:             $this->m_serviceClass = null;
866:             $this->isIncomplete = true;
867:         }
868:         $this->n_serviceClass = false;
869:         if (Util::existsPath($r, "Plan")) {
870:             $this->m_plan = Util::getByPath($r, "Plan") == null ? null : new DiskPlan($this->_client, Util::getByPath($r, "Plan"));
871:         }
872:         else {
873:             $this->m_plan = null;
874:             $this->isIncomplete = true;
875:         }
876:         $this->n_plan = false;
877:         if (Util::existsPath($r, "Server")) {
878:             $this->m_server = Util::getByPath($r, "Server") == null ? null : new Server($this->_client, Util::getByPath($r, "Server"));
879:         }
880:         else {
881:             $this->m_server = null;
882:             $this->isIncomplete = true;
883:         }
884:         $this->n_server = false;
885:         if (Util::existsPath($r, "Availability")) {
886:             $this->m_availability = Util::getByPath($r, "Availability") == null ? null : "" . Util::getByPath($r, "Availability");
887:         }
888:         else {
889:             $this->m_availability = null;
890:             $this->isIncomplete = true;
891:         }
892:         $this->n_availability = false;
893:     }
894:     
895:     /**
896:      * @ignore
897:      * @access protected
898:      * @param boolean $withClean=false
899:      * @return mixed
900:      */
901:     protected function apiSerializeImpl($withClean=false)
902:     {
903:         Util::validateType($withClean, "boolean");
904:         $missing = new \ArrayObject([]);
905:         $ret = (object)[];
906:         if ($withClean || $this->n_id) {
907:             Util::setByPath($ret, "ID", $this->m_id);
908:         }
909:         if ($withClean || $this->n_name) {
910:             Util::setByPath($ret, "Name", $this->m_name);
911:         }
912:         else {
913:             if ($this->isNew) {
914:                 $missing->append("name");
915:             }
916:         }
917:         if ($withClean || $this->n_description) {
918:             Util::setByPath($ret, "Description", $this->m_description);
919:         }
920:         if ($withClean || $this->n_tags) {
921:             Util::setByPath($ret, "Tags", new \ArrayObject([]));
922:             foreach ($this->m_tags as $r1) {
923:                 $v = null;
924:                 $v = $r1;
925:                 $ret->{"Tags"}->append($v);
926:             }
927:         }
928:         if ($withClean || $this->n_icon) {
929:             Util::setByPath($ret, "Icon", $withClean ? ($this->m_icon == null ? null : $this->m_icon->apiSerialize($withClean)) : ($this->m_icon == null ? (object)['ID' => "0"] : $this->m_icon->apiSerializeID()));
930:         }
931:         if ($withClean || $this->n_sizeMib) {
932:             Util::setByPath($ret, "SizeMB", $this->m_sizeMib);
933:         }
934:         if ($withClean || $this->n_serviceClass) {
935:             Util::setByPath($ret, "ServiceClass", $this->m_serviceClass);
936:         }
937:         if ($withClean || $this->n_plan) {
938:             Util::setByPath($ret, "Plan", $withClean ? ($this->m_plan == null ? null : $this->m_plan->apiSerialize($withClean)) : ($this->m_plan == null ? (object)['ID' => "0"] : $this->m_plan->apiSerializeID()));
939:         }
940:         else {
941:             if ($this->isNew) {
942:                 $missing->append("plan");
943:             }
944:         }
945:         if ($withClean || $this->n_server) {
946:             Util::setByPath($ret, "Server", $withClean ? ($this->m_server == null ? null : $this->m_server->apiSerialize($withClean)) : ($this->m_server == null ? (object)['ID' => "0"] : $this->m_server->apiSerializeID()));
947:         }
948:         if ($withClean || $this->n_availability) {
949:             Util::setByPath($ret, "Availability", $this->m_availability);
950:         }
951:         if ($missing->count() > 0) {
952:             throw new SaklientException("required_field", "Required fields must be set before the Disk creation: " . implode(", ", (array)($missing)));
953:         }
954:         return $ret;
955:     }
956:     
957:     /**
958:      * @ignore
959:      */
960:     public function __get($key) {
961:         switch ($key) {
962:             case "activity": return $this->get_activity();
963:             case "isAvailable": return $this->get_isAvailable();
964:             case "sizeGib": return $this->get_sizeGib();
965:             case "source": return $this->get_source();
966:             case "id": return $this->get_id();
967:             case "name": return $this->get_name();
968:             case "description": return $this->get_description();
969:             case "tags": return $this->get_tags();
970:             case "icon": return $this->get_icon();
971:             case "sizeMib": return $this->get_sizeMib();
972:             case "serviceClass": return $this->get_serviceClass();
973:             case "plan": return $this->get_plan();
974:             case "server": return $this->get_server();
975:             case "availability": return $this->get_availability();
976:             default: return parent::__get($key);
977:         }
978:     }
979:     
980:     /**
981:      * @ignore
982:      */
983:     public function __set($key, $v) {
984:         switch ($key) {
985:             case "sizeGib": return $this->set_sizeGib($v);
986:             case "source": return $this->set_source($v);
987:             case "name": return $this->set_name($v);
988:             case "description": return $this->set_description($v);
989:             case "tags": return $this->set_tags($v);
990:             case "icon": return $this->set_icon($v);
991:             case "sizeMib": return $this->set_sizeMib($v);
992:             case "plan": return $this->set_plan($v);
993:             default: return parent::__set($key, $v);
994:         }
995:     }
996: 
997: }
998: 
999: 
API documentation generated by ApiGen 2.8.0