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/HttpException.php";
   6: use \Saklient\Errors\HttpException;
   7: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
   8: use \Saklient\Errors\SaklientException;
   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/Iface.php";
  16: use \Saklient\Cloud\Resources\Iface;
  17: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Swytch.php";
  18: use \Saklient\Cloud\Resources\Swytch;
  19: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EApplianceClass.php";
  20: use \Saklient\Cloud\Enums\EApplianceClass;
  21: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EAvailability.php";
  22: use \Saklient\Cloud\Enums\EAvailability;
  23: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EServerInstanceStatus.php";
  24: use \Saklient\Cloud\Enums\EServerInstanceStatus;
  25: require_once __DIR__ . "/../../../Saklient/Cloud/Models/Model_Swytch.php";
  26: use \Saklient\Cloud\Models\Model_Swytch;
  27: require_once __DIR__ . "/../../../Saklient/Util.php";
  28: use \Saklient\Util;
  29: 
  30: /**
  31:  * アプライアンスの実体1つに対応し、属性の取得や操作を行うためのクラス。
  32:  * 
  33:  * @property-read string $id ID 
  34:  * @property string $clazz クラス {@link \Saklient\Cloud\Enums\EApplianceClass} 
  35:  * @property string $name 名前 
  36:  * @property string $description 説明 
  37:  * @property \ArrayObject $tags タグ文字列の配列 
  38:  * @property \Saklient\Cloud\Resources\Icon $icon アイコン 
  39:  * @property int $planId プラン 
  40:  * @property-read \ArrayObject $ifaces インタフェース {@link \Saklient\Cloud\Resources\Iface} の配列 
  41:  * @property mixed $rawAnnotation 注釈 
  42:  * @property mixed $rawSettings 設定の生データ 
  43:  * @property-read string $status 起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus} 
  44:  * @property-read string $serviceClass サービスクラス 
  45:  * @property-read string $availability 有効状態 {@link \Saklient\Cloud\Enums\EAvailability} 
  46:  * @property-read string $swytchId 接続先スイッチID 
  47:  */
  48: class Appliance extends Resource {
  49:     
  50:     /**
  51:      * ID
  52:      * 
  53:      * @access protected
  54:      * @ignore
  55:      * @var string
  56:      */
  57:     protected $m_id;
  58:     
  59:     /**
  60:      * クラス {@link \Saklient\Cloud\Enums\EApplianceClass}
  61:      * 
  62:      * @access protected
  63:      * @ignore
  64:      * @var string
  65:      */
  66:     protected $m_clazz;
  67:     
  68:     /**
  69:      * 名前
  70:      * 
  71:      * @access protected
  72:      * @ignore
  73:      * @var string
  74:      */
  75:     protected $m_name;
  76:     
  77:     /**
  78:      * 説明
  79:      * 
  80:      * @access protected
  81:      * @ignore
  82:      * @var string
  83:      */
  84:     protected $m_description;
  85:     
  86:     /**
  87:      * タグ文字列の配列
  88:      * 
  89:      * @access protected
  90:      * @ignore
  91:      * @var string[]
  92:      */
  93:     protected $m_tags;
  94:     
  95:     /**
  96:      * アイコン
  97:      * 
  98:      * @access protected
  99:      * @ignore
 100:      * @var Icon
 101:      */
 102:     protected $m_icon;
 103:     
 104:     /**
 105:      * プラン
 106:      * 
 107:      * @access protected
 108:      * @ignore
 109:      * @var int
 110:      */
 111:     protected $m_planId;
 112:     
 113:     /**
 114:      * インタフェース {@link \Saklient\Cloud\Resources\Iface} の配列
 115:      * 
 116:      * @access protected
 117:      * @ignore
 118:      * @var Iface[]
 119:      */
 120:     protected $m_ifaces;
 121:     
 122:     /**
 123:      * 注釈
 124:      * 
 125:      * @access protected
 126:      * @ignore
 127:      * @var mixed
 128:      */
 129:     protected $m_rawAnnotation;
 130:     
 131:     /**
 132:      * 設定の生データ
 133:      * 
 134:      * @access protected
 135:      * @ignore
 136:      * @var mixed
 137:      */
 138:     protected $m_rawSettings;
 139:     
 140:     /**
 141:      * @ignore
 142:      * @access protected
 143:      * @var string
 144:      */
 145:     protected $m_rawSettingsHash;
 146:     
 147:     /**
 148:      * 起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus}
 149:      * 
 150:      * @access protected
 151:      * @ignore
 152:      * @var string
 153:      */
 154:     protected $m_status;
 155:     
 156:     /**
 157:      * サービスクラス
 158:      * 
 159:      * @access protected
 160:      * @ignore
 161:      * @var string
 162:      */
 163:     protected $m_serviceClass;
 164:     
 165:     /**
 166:      * 有効状態 {@link \Saklient\Cloud\Enums\EAvailability}
 167:      * 
 168:      * @access protected
 169:      * @ignore
 170:      * @var string
 171:      */
 172:     protected $m_availability;
 173:     
 174:     /**
 175:      * 接続先スイッチID
 176:      * 
 177:      * @access protected
 178:      * @ignore
 179:      * @var string
 180:      */
 181:     protected $m_swytchId;
 182:     
 183:     /**
 184:      * @private
 185:      * @access protected
 186:      * @ignore
 187:      * @return string
 188:      */
 189:     protected function _apiPath()
 190:     {
 191:         return "/appliance";
 192:     }
 193:     
 194:     /**
 195:      * @private
 196:      * @access protected
 197:      * @ignore
 198:      * @return string
 199:      */
 200:     protected function _rootKey()
 201:     {
 202:         return "Appliance";
 203:     }
 204:     
 205:     /**
 206:      * @private
 207:      * @access protected
 208:      * @ignore
 209:      * @return string
 210:      */
 211:     protected function _rootKeyM()
 212:     {
 213:         return "Appliances";
 214:     }
 215:     
 216:     /**
 217:      * @private
 218:      * @access public
 219:      * @ignore
 220:      * @return string
 221:      */
 222:     public function _className()
 223:     {
 224:         return "Appliance";
 225:     }
 226:     
 227:     /**
 228:      * @private
 229:      * @access public
 230:      * @ignore
 231:      * @return string
 232:      */
 233:     public function _id()
 234:     {
 235:         return $this->get_id();
 236:     }
 237:     
 238:     /**
 239:      * このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し、新規作成または上書き保存します。
 240:      * 
 241:      * @access public
 242:      * @return \Saklient\Cloud\Resources\Appliance this
 243:      */
 244:     public function save()
 245:     {
 246:         return $this->_save();
 247:     }
 248:     
 249:     /**
 250:      * 最新のリソース情報を再取得します。
 251:      * 
 252:      * @access public
 253:      * @return \Saklient\Cloud\Resources\Appliance this
 254:      */
 255:     public function reload()
 256:     {
 257:         return $this->_reload();
 258:     }
 259:     
 260:     /**
 261:      * @ignore
 262:      * @access public
 263:      * @param \Saklient\Cloud\Client $client
 264:      * @param mixed $obj
 265:      * @param boolean $wrapped=false
 266:      */
 267:     public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
 268:     {
 269:         parent::__construct($client);
 270:         Util::validateArgCount(func_num_args(), 2);
 271:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
 272:         Util::validateType($wrapped, "boolean");
 273:         $this->apiDeserialize($obj, $wrapped);
 274:     }
 275:     
 276:     /**
 277:      * @private
 278:      * @access protected
 279:      * @ignore
 280:      * @param mixed $query
 281:      * @return void
 282:      */
 283:     protected function _onBeforeSave($query)
 284:     {
 285:         Util::validateArgCount(func_num_args(), 1);
 286:         Util::setByPath($query, "OriginalSettingsHash", $this->get_rawSettingsHash());
 287:     }
 288:     
 289:     /**
 290:      * このルータが接続されているスイッチを取得します。
 291:      * 
 292:      * @access public
 293:      * @return \Saklient\Cloud\Resources\Swytch
 294:      */
 295:     public function getSwytch()
 296:     {
 297:         $model = Util::createClassInstance("saklient.cloud.models.Model_Swytch", new \ArrayObject([$this->_client]));
 298:         $id = $this->get_swytchId();
 299:         return $model->getById($id);
 300:     }
 301:     
 302:     /**
 303:      * アプライアンスの設定を反映します。
 304:      * 
 305:      * @access public
 306:      * @return \Saklient\Cloud\Resources\Appliance this
 307:      */
 308:     public function apply()
 309:     {
 310:         $this->_client->request("PUT", $this->_apiPath() . "/" . Util::urlEncode($this->_id()) . "/config");
 311:         return $this;
 312:     }
 313:     
 314:     /**
 315:      * アプライアンスを起動します。
 316:      * 
 317:      * @access public
 318:      * @return \Saklient\Cloud\Resources\Appliance this
 319:      */
 320:     public function boot()
 321:     {
 322:         $this->_client->request("PUT", $this->_apiPath() . "/" . Util::urlEncode($this->_id()) . "/power");
 323:         return $this;
 324:     }
 325:     
 326:     /**
 327:      * アプライアンスをシャットダウンします。
 328:      * 
 329:      * @access public
 330:      * @return \Saklient\Cloud\Resources\Appliance this
 331:      */
 332:     public function shutdown()
 333:     {
 334:         $this->_client->request("DELETE", $this->_apiPath() . "/" . Util::urlEncode($this->_id()) . "/power");
 335:         return $this;
 336:     }
 337:     
 338:     /**
 339:      * アプライアンスを強制停止します。
 340:      * 
 341:      * @access public
 342:      * @return \Saklient\Cloud\Resources\Appliance this
 343:      */
 344:     public function stop()
 345:     {
 346:         $this->_client->request("DELETE", $this->_apiPath() . "/" . Util::urlEncode($this->_id()) . "/power", (object)['Force' => true]);
 347:         return $this;
 348:     }
 349:     
 350:     /**
 351:      * アプライアンスを強制再起動します。
 352:      * 
 353:      * @access public
 354:      * @return \Saklient\Cloud\Resources\Appliance this
 355:      */
 356:     public function reboot()
 357:     {
 358:         $this->_client->request("PUT", $this->_apiPath() . "/" . Util::urlEncode($this->_id()) . "/reset");
 359:         return $this;
 360:     }
 361:     
 362:     /**
 363:      * 作成中のアプライアンスが利用可能になるまで待機します。
 364:      * 
 365:      * @access public
 366:      * @param int $timeoutSec=600
 367:      * @return boolean 成功時はtrue、タイムアウトやエラーによる失敗時はfalseを返します。
 368:      */
 369:     public function sleepWhileCreating($timeoutSec=600)
 370:     {
 371:         Util::validateType($timeoutSec, "int");
 372:         $step = 10;
 373:         while (0 < $timeoutSec) {
 374:             try {
 375:                 $this->reload();
 376:             }
 377:             catch (HttpException $ex) {
 378:             }
 379:             $a = $this->get_availability();
 380:             if ($a == EAvailability::available) {
 381:                 return true;
 382:             }
 383:             if ($a != EAvailability::migrating) {
 384:                 $timeoutSec = 0;
 385:             }
 386:             $timeoutSec -= $step;
 387:             if (0 < $timeoutSec) {
 388:                 Util::sleep($step);
 389:             }
 390:         }
 391:         return false;
 392:     }
 393:     
 394:     /**
 395:      * アプライアンスが起動するまで待機します。
 396:      * 
 397:      * @access public
 398:      * @param int $timeoutSec=600
 399:      * @return boolean
 400:      */
 401:     public function sleepUntilUp($timeoutSec=600)
 402:     {
 403:         Util::validateType($timeoutSec, "int");
 404:         return $this->sleepUntil(EServerInstanceStatus::up, $timeoutSec);
 405:     }
 406:     
 407:     /**
 408:      * アプライアンスが停止するまで待機します。
 409:      * 
 410:      * @access public
 411:      * @param int $timeoutSec=600
 412:      * @return boolean 成功時はtrue、タイムアウトやエラーによる失敗時はfalseを返します。
 413:      */
 414:     public function sleepUntilDown($timeoutSec=600)
 415:     {
 416:         Util::validateType($timeoutSec, "int");
 417:         return $this->sleepUntil(EServerInstanceStatus::down, $timeoutSec);
 418:     }
 419:     
 420:     /**
 421:      * アプライアンスが指定のステータスに遷移するまで待機します。
 422:      * 
 423:      * @ignore
 424:      * @access private
 425:      * @param string $status
 426:      * @param int $timeoutSec=600
 427:      * @return boolean
 428:      */
 429:     private function sleepUntil($status, $timeoutSec=600)
 430:     {
 431:         Util::validateArgCount(func_num_args(), 1);
 432:         Util::validateType($status, "string");
 433:         Util::validateType($timeoutSec, "int");
 434:         $step = 10;
 435:         while (0 < $timeoutSec) {
 436:             try {
 437:                 $this->reload();
 438:             }
 439:             catch (HttpException $ex) {
 440:             }
 441:             $s = $this->get_status();
 442:             if ($s == null) {
 443:                 $s = EServerInstanceStatus::down;
 444:             }
 445:             if ($s == $status) {
 446:                 return true;
 447:             }
 448:             $timeoutSec -= $step;
 449:             if (0 < $timeoutSec) {
 450:                 Util::sleep($step);
 451:             }
 452:         }
 453:         return false;
 454:     }
 455:     
 456:     /**
 457:      * @access private
 458:      * @ignore
 459:      * @var boolean
 460:      */
 461:     private $n_id = false;
 462:     
 463:     /**
 464:      * (This method is generated in Translator_default#buildImpl)
 465:      * 
 466:      * @access private
 467:      * @ignore
 468:      * @return string
 469:      */
 470:     private function get_id()
 471:     {
 472:         return $this->m_id;
 473:     }
 474:     
 475:     
 476:     
 477:     /**
 478:      * @access private
 479:      * @ignore
 480:      * @var boolean
 481:      */
 482:     private $n_clazz = false;
 483:     
 484:     /**
 485:      * (This method is generated in Translator_default#buildImpl)
 486:      * 
 487:      * @access private
 488:      * @ignore
 489:      * @return string
 490:      */
 491:     private function get_clazz()
 492:     {
 493:         return $this->m_clazz;
 494:     }
 495:     
 496:     /**
 497:      * (This method is generated in Translator_default#buildImpl)
 498:      * 
 499:      * @access private
 500:      * @ignore
 501:      * @param string $v
 502:      * @return string
 503:      */
 504:     private function set_clazz($v)
 505:     {
 506:         Util::validateArgCount(func_num_args(), 1);
 507:         Util::validateType($v, "string");
 508:         if (!$this->isNew) {
 509:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\Appliance#clazz");
 510:         }
 511:         $this->m_clazz = $v;
 512:         $this->n_clazz = true;
 513:         return $this->m_clazz;
 514:     }
 515:     
 516:     
 517:     
 518:     /**
 519:      * @access private
 520:      * @ignore
 521:      * @var boolean
 522:      */
 523:     private $n_name = false;
 524:     
 525:     /**
 526:      * (This method is generated in Translator_default#buildImpl)
 527:      * 
 528:      * @access private
 529:      * @ignore
 530:      * @return string
 531:      */
 532:     private function get_name()
 533:     {
 534:         return $this->m_name;
 535:     }
 536:     
 537:     /**
 538:      * (This method is generated in Translator_default#buildImpl)
 539:      * 
 540:      * @access private
 541:      * @ignore
 542:      * @param string $v
 543:      * @return string
 544:      */
 545:     private function set_name($v)
 546:     {
 547:         Util::validateArgCount(func_num_args(), 1);
 548:         Util::validateType($v, "string");
 549:         $this->m_name = $v;
 550:         $this->n_name = true;
 551:         return $this->m_name;
 552:     }
 553:     
 554:     
 555:     
 556:     /**
 557:      * @access private
 558:      * @ignore
 559:      * @var boolean
 560:      */
 561:     private $n_description = false;
 562:     
 563:     /**
 564:      * (This method is generated in Translator_default#buildImpl)
 565:      * 
 566:      * @access private
 567:      * @ignore
 568:      * @return string
 569:      */
 570:     private function get_description()
 571:     {
 572:         return $this->m_description;
 573:     }
 574:     
 575:     /**
 576:      * (This method is generated in Translator_default#buildImpl)
 577:      * 
 578:      * @access private
 579:      * @ignore
 580:      * @param string $v
 581:      * @return string
 582:      */
 583:     private function set_description($v)
 584:     {
 585:         Util::validateArgCount(func_num_args(), 1);
 586:         Util::validateType($v, "string");
 587:         $this->m_description = $v;
 588:         $this->n_description = true;
 589:         return $this->m_description;
 590:     }
 591:     
 592:     
 593:     
 594:     /**
 595:      * @access private
 596:      * @ignore
 597:      * @var boolean
 598:      */
 599:     private $n_tags = false;
 600:     
 601:     /**
 602:      * (This method is generated in Translator_default#buildImpl)
 603:      * 
 604:      * @access private
 605:      * @ignore
 606:      * @return string[]
 607:      */
 608:     private function get_tags()
 609:     {
 610:         $this->n_tags = true;
 611:         return $this->m_tags;
 612:     }
 613:     
 614:     /**
 615:      * (This method is generated in Translator_default#buildImpl)
 616:      * 
 617:      * @access private
 618:      * @ignore
 619:      * @param string[] $v
 620:      * @return string[]
 621:      */
 622:     private function set_tags($v)
 623:     {
 624:         Util::validateArgCount(func_num_args(), 1);
 625:         Util::validateType($v, "\\ArrayObject");
 626:         if (is_array($v)) $v = Client::array2ArrayObject($v);
 627:         $this->m_tags = $v;
 628:         $this->n_tags = true;
 629:         return $this->m_tags;
 630:     }
 631:     
 632:     
 633:     
 634:     /**
 635:      * @access private
 636:      * @ignore
 637:      * @var boolean
 638:      */
 639:     private $n_icon = false;
 640:     
 641:     /**
 642:      * (This method is generated in Translator_default#buildImpl)
 643:      * 
 644:      * @access private
 645:      * @ignore
 646:      * @return \Saklient\Cloud\Resources\Icon
 647:      */
 648:     private function get_icon()
 649:     {
 650:         return $this->m_icon;
 651:     }
 652:     
 653:     /**
 654:      * (This method is generated in Translator_default#buildImpl)
 655:      * 
 656:      * @access private
 657:      * @ignore
 658:      * @param \Saklient\Cloud\Resources\Icon|null $v
 659:      * @return \Saklient\Cloud\Resources\Icon
 660:      */
 661:     private function set_icon(\Saklient\Cloud\Resources\Icon $v=null)
 662:     {
 663:         Util::validateArgCount(func_num_args(), 1);
 664:         Util::validateType($v, "\\Saklient\\Cloud\\Resources\\Icon");
 665:         $this->m_icon = $v;
 666:         $this->n_icon = true;
 667:         return $this->m_icon;
 668:     }
 669:     
 670:     
 671:     
 672:     /**
 673:      * @access private
 674:      * @ignore
 675:      * @var boolean
 676:      */
 677:     private $n_planId = false;
 678:     
 679:     /**
 680:      * (This method is generated in Translator_default#buildImpl)
 681:      * 
 682:      * @access private
 683:      * @ignore
 684:      * @return int
 685:      */
 686:     private function get_planId()
 687:     {
 688:         return $this->m_planId;
 689:     }
 690:     
 691:     /**
 692:      * (This method is generated in Translator_default#buildImpl)
 693:      * 
 694:      * @access private
 695:      * @ignore
 696:      * @param int|null $v
 697:      * @return int
 698:      */
 699:     private function set_planId($v)
 700:     {
 701:         Util::validateArgCount(func_num_args(), 1);
 702:         Util::validateType($v, "int");
 703:         if (!$this->isNew) {
 704:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\Appliance#planId");
 705:         }
 706:         $this->m_planId = $v;
 707:         $this->n_planId = true;
 708:         return $this->m_planId;
 709:     }
 710:     
 711:     
 712:     
 713:     /**
 714:      * @access private
 715:      * @ignore
 716:      * @var boolean
 717:      */
 718:     private $n_ifaces = false;
 719:     
 720:     /**
 721:      * (This method is generated in Translator_default#buildImpl)
 722:      * 
 723:      * @access private
 724:      * @ignore
 725:      * @return \Saklient\Cloud\Resources\Iface[]
 726:      */
 727:     private function get_ifaces()
 728:     {
 729:         return $this->m_ifaces;
 730:     }
 731:     
 732:     
 733:     
 734:     /**
 735:      * @access private
 736:      * @ignore
 737:      * @var boolean
 738:      */
 739:     private $n_rawAnnotation = false;
 740:     
 741:     /**
 742:      * (This method is generated in Translator_default#buildImpl)
 743:      * 
 744:      * @access private
 745:      * @ignore
 746:      * @return mixed
 747:      */
 748:     private function get_rawAnnotation()
 749:     {
 750:         return $this->m_rawAnnotation;
 751:     }
 752:     
 753:     /**
 754:      * (This method is generated in Translator_default#buildImpl)
 755:      * 
 756:      * @access private
 757:      * @ignore
 758:      * @param mixed $v
 759:      * @return mixed
 760:      */
 761:     private function set_rawAnnotation($v)
 762:     {
 763:         Util::validateArgCount(func_num_args(), 1);
 764:         if (!$this->isNew) {
 765:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\Appliance#rawAnnotation");
 766:         }
 767:         $this->m_rawAnnotation = $v;
 768:         $this->n_rawAnnotation = true;
 769:         return $this->m_rawAnnotation;
 770:     }
 771:     
 772:     
 773:     
 774:     /**
 775:      * @access private
 776:      * @ignore
 777:      * @var boolean
 778:      */
 779:     private $n_rawSettings = false;
 780:     
 781:     /**
 782:      * (This method is generated in Translator_default#buildImpl)
 783:      * 
 784:      * @access private
 785:      * @ignore
 786:      * @return mixed
 787:      */
 788:     private function get_rawSettings()
 789:     {
 790:         $this->n_rawSettings = true;
 791:         return $this->m_rawSettings;
 792:     }
 793:     
 794:     /**
 795:      * (This method is generated in Translator_default#buildImpl)
 796:      * 
 797:      * @access private
 798:      * @ignore
 799:      * @param mixed $v
 800:      * @return mixed
 801:      */
 802:     private function set_rawSettings($v)
 803:     {
 804:         Util::validateArgCount(func_num_args(), 1);
 805:         $this->m_rawSettings = $v;
 806:         $this->n_rawSettings = true;
 807:         return $this->m_rawSettings;
 808:     }
 809:     
 810:     
 811:     
 812:     /**
 813:      * @access private
 814:      * @ignore
 815:      * @var boolean
 816:      */
 817:     private $n_rawSettingsHash = false;
 818:     
 819:     /**
 820:      * (This method is generated in Translator_default#buildImpl)
 821:      * 
 822:      * @access private
 823:      * @ignore
 824:      * @return string
 825:      */
 826:     private function get_rawSettingsHash()
 827:     {
 828:         return $this->m_rawSettingsHash;
 829:     }
 830:     
 831:     
 832:     
 833:     /**
 834:      * @access private
 835:      * @ignore
 836:      * @var boolean
 837:      */
 838:     private $n_status = false;
 839:     
 840:     /**
 841:      * (This method is generated in Translator_default#buildImpl)
 842:      * 
 843:      * @access private
 844:      * @ignore
 845:      * @return string
 846:      */
 847:     private function get_status()
 848:     {
 849:         return $this->m_status;
 850:     }
 851:     
 852:     
 853:     
 854:     /**
 855:      * @access private
 856:      * @ignore
 857:      * @var boolean
 858:      */
 859:     private $n_serviceClass = false;
 860:     
 861:     /**
 862:      * (This method is generated in Translator_default#buildImpl)
 863:      * 
 864:      * @access private
 865:      * @ignore
 866:      * @return string
 867:      */
 868:     private function get_serviceClass()
 869:     {
 870:         return $this->m_serviceClass;
 871:     }
 872:     
 873:     
 874:     
 875:     /**
 876:      * @access private
 877:      * @ignore
 878:      * @var boolean
 879:      */
 880:     private $n_availability = false;
 881:     
 882:     /**
 883:      * (This method is generated in Translator_default#buildImpl)
 884:      * 
 885:      * @access private
 886:      * @ignore
 887:      * @return string
 888:      */
 889:     private function get_availability()
 890:     {
 891:         return $this->m_availability;
 892:     }
 893:     
 894:     
 895:     
 896:     /**
 897:      * @access private
 898:      * @ignore
 899:      * @var boolean
 900:      */
 901:     private $n_swytchId = false;
 902:     
 903:     /**
 904:      * (This method is generated in Translator_default#buildImpl)
 905:      * 
 906:      * @access private
 907:      * @ignore
 908:      * @return string
 909:      */
 910:     private function get_swytchId()
 911:     {
 912:         return $this->m_swytchId;
 913:     }
 914:     
 915:     
 916:     
 917:     /**
 918:      * (This method is generated in Translator_default#buildImpl)
 919:      * 
 920:      * @access protected
 921:      * @ignore
 922:      * @param mixed $r
 923:      */
 924:     protected function apiDeserializeImpl($r)
 925:     {
 926:         Util::validateArgCount(func_num_args(), 1);
 927:         $this->isNew = $r == null;
 928:         if ($this->isNew) {
 929:             $r = (object)[];
 930:         }
 931:         $this->isIncomplete = false;
 932:         if (Util::existsPath($r, "ID")) {
 933:             $this->m_id = Util::getByPath($r, "ID") == null ? null : "" . Util::getByPath($r, "ID");
 934:         }
 935:         else {
 936:             $this->m_id = null;
 937:             $this->isIncomplete = true;
 938:         }
 939:         $this->n_id = false;
 940:         if (Util::existsPath($r, "Class")) {
 941:             $this->m_clazz = Util::getByPath($r, "Class") == null ? null : "" . Util::getByPath($r, "Class");
 942:         }
 943:         else {
 944:             $this->m_clazz = null;
 945:             $this->isIncomplete = true;
 946:         }
 947:         $this->n_clazz = false;
 948:         if (Util::existsPath($r, "Name")) {
 949:             $this->m_name = Util::getByPath($r, "Name") == null ? null : "" . Util::getByPath($r, "Name");
 950:         }
 951:         else {
 952:             $this->m_name = null;
 953:             $this->isIncomplete = true;
 954:         }
 955:         $this->n_name = false;
 956:         if (Util::existsPath($r, "Description")) {
 957:             $this->m_description = Util::getByPath($r, "Description") == null ? null : "" . Util::getByPath($r, "Description");
 958:         }
 959:         else {
 960:             $this->m_description = null;
 961:             $this->isIncomplete = true;
 962:         }
 963:         $this->n_description = false;
 964:         if (Util::existsPath($r, "Tags")) {
 965:             if (Util::getByPath($r, "Tags") == null) {
 966:                 $this->m_tags = new \ArrayObject([]);
 967:             }
 968:             else {
 969:                 $this->m_tags = new \ArrayObject([]);
 970:                 foreach (Util::getByPath($r, "Tags") as $t) {
 971:                     $v1 = null;
 972:                     $v1 = $t == null ? null : "" . $t;
 973:                     $this->m_tags->append($v1);
 974:                 }
 975:             }
 976:         }
 977:         else {
 978:             $this->m_tags = null;
 979:             $this->isIncomplete = true;
 980:         }
 981:         $this->n_tags = false;
 982:         if (Util::existsPath($r, "Icon")) {
 983:             $this->m_icon = Util::getByPath($r, "Icon") == null ? null : new Icon($this->_client, Util::getByPath($r, "Icon"));
 984:         }
 985:         else {
 986:             $this->m_icon = null;
 987:             $this->isIncomplete = true;
 988:         }
 989:         $this->n_icon = false;
 990:         if (Util::existsPath($r, "Plan.ID")) {
 991:             $this->m_planId = Util::getByPath($r, "Plan.ID") == null ? null : intval("" . Util::getByPath($r, "Plan.ID"));
 992:         }
 993:         else {
 994:             $this->m_planId = null;
 995:             $this->isIncomplete = true;
 996:         }
 997:         $this->n_planId = false;
 998:         if (Util::existsPath($r, "Interfaces")) {
 999:             if (Util::getByPath($r, "Interfaces") == null) {
1000:                 $this->m_ifaces = new \ArrayObject([]);
1001:             }
1002:             else {
1003:                 $this->m_ifaces = new \ArrayObject([]);
1004:                 foreach (Util::getByPath($r, "Interfaces") as $t) {
1005:                     $v2 = null;
1006:                     $v2 = $t == null ? null : new Iface($this->_client, $t);
1007:                     $this->m_ifaces->append($v2);
1008:                 }
1009:             }
1010:         }
1011:         else {
1012:             $this->m_ifaces = null;
1013:             $this->isIncomplete = true;
1014:         }
1015:         $this->n_ifaces = false;
1016:         if (Util::existsPath($r, "Remark")) {
1017:             $this->m_rawAnnotation = Util::getByPath($r, "Remark");
1018:         }
1019:         else {
1020:             $this->m_rawAnnotation = null;
1021:             $this->isIncomplete = true;
1022:         }
1023:         $this->n_rawAnnotation = false;
1024:         if (Util::existsPath($r, "Settings")) {
1025:             $this->m_rawSettings = Util::getByPath($r, "Settings");
1026:         }
1027:         else {
1028:             $this->m_rawSettings = null;
1029:             $this->isIncomplete = true;
1030:         }
1031:         $this->n_rawSettings = false;
1032:         if (Util::existsPath($r, "SettingsHash")) {
1033:             $this->m_rawSettingsHash = Util::getByPath($r, "SettingsHash") == null ? null : "" . Util::getByPath($r, "SettingsHash");
1034:         }
1035:         else {
1036:             $this->m_rawSettingsHash = null;
1037:             $this->isIncomplete = true;
1038:         }
1039:         $this->n_rawSettingsHash = false;
1040:         if (Util::existsPath($r, "Instance.Status")) {
1041:             $this->m_status = Util::getByPath($r, "Instance.Status") == null ? null : "" . Util::getByPath($r, "Instance.Status");
1042:         }
1043:         else {
1044:             $this->m_status = null;
1045:             $this->isIncomplete = true;
1046:         }
1047:         $this->n_status = false;
1048:         if (Util::existsPath($r, "ServiceClass")) {
1049:             $this->m_serviceClass = Util::getByPath($r, "ServiceClass") == null ? null : "" . Util::getByPath($r, "ServiceClass");
1050:         }
1051:         else {
1052:             $this->m_serviceClass = null;
1053:             $this->isIncomplete = true;
1054:         }
1055:         $this->n_serviceClass = false;
1056:         if (Util::existsPath($r, "Availability")) {
1057:             $this->m_availability = Util::getByPath($r, "Availability") == null ? null : "" . Util::getByPath($r, "Availability");
1058:         }
1059:         else {
1060:             $this->m_availability = null;
1061:             $this->isIncomplete = true;
1062:         }
1063:         $this->n_availability = false;
1064:         if (Util::existsPath($r, "Switch.ID")) {
1065:             $this->m_swytchId = Util::getByPath($r, "Switch.ID") == null ? null : "" . Util::getByPath($r, "Switch.ID");
1066:         }
1067:         else {
1068:             $this->m_swytchId = null;
1069:             $this->isIncomplete = true;
1070:         }
1071:         $this->n_swytchId = false;
1072:     }
1073:     
1074:     /**
1075:      * @ignore
1076:      * @access protected
1077:      * @param boolean $withClean=false
1078:      * @return mixed
1079:      */
1080:     protected function apiSerializeImpl($withClean=false)
1081:     {
1082:         Util::validateType($withClean, "boolean");
1083:         $missing = new \ArrayObject([]);
1084:         $ret = (object)[];
1085:         if ($withClean || $this->n_id) {
1086:             Util::setByPath($ret, "ID", $this->m_id);
1087:         }
1088:         if ($withClean || $this->n_clazz) {
1089:             Util::setByPath($ret, "Class", $this->m_clazz);
1090:         }
1091:         else {
1092:             if ($this->isNew) {
1093:                 $missing->append("clazz");
1094:             }
1095:         }
1096:         if ($withClean || $this->n_name) {
1097:             Util::setByPath($ret, "Name", $this->m_name);
1098:         }
1099:         else {
1100:             if ($this->isNew) {
1101:                 $missing->append("name");
1102:             }
1103:         }
1104:         if ($withClean || $this->n_description) {
1105:             Util::setByPath($ret, "Description", $this->m_description);
1106:         }
1107:         if ($withClean || $this->n_tags) {
1108:             Util::setByPath($ret, "Tags", new \ArrayObject([]));
1109:             foreach ($this->m_tags as $r1) {
1110:                 $v = null;
1111:                 $v = $r1;
1112:                 $ret->{"Tags"}->append($v);
1113:             }
1114:         }
1115:         if ($withClean || $this->n_icon) {
1116:             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()));
1117:         }
1118:         if ($withClean || $this->n_planId) {
1119:             Util::setByPath($ret, "Plan.ID", $this->m_planId);
1120:         }
1121:         else {
1122:             if ($this->isNew) {
1123:                 $missing->append("planId");
1124:             }
1125:         }
1126:         if ($withClean || $this->n_ifaces) {
1127:             Util::setByPath($ret, "Interfaces", new \ArrayObject([]));
1128:             foreach ($this->m_ifaces as $r2) {
1129:                 $v = null;
1130:                 $v = $withClean ? ($r2 == null ? null : $r2->apiSerialize($withClean)) : ($r2 == null ? (object)['ID' => "0"] : $r2->apiSerializeID());
1131:                 $ret->{"Interfaces"}->append($v);
1132:             }
1133:         }
1134:         if ($withClean || $this->n_rawAnnotation) {
1135:             Util::setByPath($ret, "Remark", $this->m_rawAnnotation);
1136:         }
1137:         else {
1138:             if ($this->isNew) {
1139:                 $missing->append("rawAnnotation");
1140:             }
1141:         }
1142:         if ($withClean || $this->n_rawSettings) {
1143:             Util::setByPath($ret, "Settings", $this->m_rawSettings);
1144:         }
1145:         if ($withClean || $this->n_rawSettingsHash) {
1146:             Util::setByPath($ret, "SettingsHash", $this->m_rawSettingsHash);
1147:         }
1148:         if ($withClean || $this->n_status) {
1149:             Util::setByPath($ret, "Instance.Status", $this->m_status);
1150:         }
1151:         if ($withClean || $this->n_serviceClass) {
1152:             Util::setByPath($ret, "ServiceClass", $this->m_serviceClass);
1153:         }
1154:         if ($withClean || $this->n_availability) {
1155:             Util::setByPath($ret, "Availability", $this->m_availability);
1156:         }
1157:         if ($withClean || $this->n_swytchId) {
1158:             Util::setByPath($ret, "Switch.ID", $this->m_swytchId);
1159:         }
1160:         if ($missing->count() > 0) {
1161:             throw new SaklientException("required_field", "Required fields must be set before the Appliance creation: " . implode(", ", (array)($missing)));
1162:         }
1163:         return $ret;
1164:     }
1165:     
1166:     /**
1167:      * @ignore
1168:      */
1169:     public function __get($key) {
1170:         switch ($key) {
1171:             case "id": return $this->get_id();
1172:             case "clazz": return $this->get_clazz();
1173:             case "name": return $this->get_name();
1174:             case "description": return $this->get_description();
1175:             case "tags": return $this->get_tags();
1176:             case "icon": return $this->get_icon();
1177:             case "planId": return $this->get_planId();
1178:             case "ifaces": return $this->get_ifaces();
1179:             case "rawAnnotation": return $this->get_rawAnnotation();
1180:             case "rawSettings": return $this->get_rawSettings();
1181:             case "rawSettingsHash": return $this->get_rawSettingsHash();
1182:             case "status": return $this->get_status();
1183:             case "serviceClass": return $this->get_serviceClass();
1184:             case "availability": return $this->get_availability();
1185:             case "swytchId": return $this->get_swytchId();
1186:             default: return parent::__get($key);
1187:         }
1188:     }
1189:     
1190:     /**
1191:      * @ignore
1192:      */
1193:     public function __set($key, $v) {
1194:         switch ($key) {
1195:             case "clazz": return $this->set_clazz($v);
1196:             case "name": return $this->set_name($v);
1197:             case "description": return $this->set_description($v);
1198:             case "tags": return $this->set_tags($v);
1199:             case "icon": return $this->set_icon($v);
1200:             case "planId": return $this->set_planId($v);
1201:             case "rawAnnotation": return $this->set_rawAnnotation($v);
1202:             case "rawSettings": return $this->set_rawSettings($v);
1203:             default: return parent::__set($key, $v);
1204:         }
1205:     }
1206: 
1207: }
1208: 
1209: 
API documentation generated by ApiGen 2.8.0