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