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/Cloud/Client.php";
  8: use \Saklient\Cloud\Client;
  9: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Resource.php";
 10: use \Saklient\Cloud\Resources\Resource;
 11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Icon.php";
 12: use \Saklient\Cloud\Resources\Icon;
 13: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EScope.php";
 14: use \Saklient\Cloud\Enums\EScope;
 15: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EScriptClass.php";
 16: use \Saklient\Cloud\Enums\EScriptClass;
 17: require_once __DIR__ . "/../../../Saklient/Util.php";
 18: use \Saklient\Util;
 19: 
 20: /**
 21:  * スクリプトの実体1つに対応し、属性の取得や操作を行うためのクラス。
 22:  * 
 23:  * @property-read string $id ID 
 24:  * @property-read string $scope スコープ {@link \Saklient\Cloud\Enums\EScope} 
 25:  * @property string $clazz クラス {@link \Saklient\Cloud\Enums\EScriptClass} 
 26:  * @property-read string $name 名前 
 27:  * @property string $description 説明 
 28:  * @property \ArrayObject $tags タグ文字列の配列 
 29:  * @property \Saklient\Cloud\Resources\Icon $icon アイコン 
 30:  * @property string $content 内容 
 31:  * @property-read mixed $annotation 注釈 
 32:  */
 33: class Script extends Resource {
 34:     
 35:     /**
 36:      * ID
 37:      * 
 38:      * @access protected
 39:      * @ignore
 40:      * @var string
 41:      */
 42:     protected $m_id;
 43:     
 44:     /**
 45:      * スコープ {@link \Saklient\Cloud\Enums\EScope}
 46:      * 
 47:      * @access protected
 48:      * @ignore
 49:      * @var string
 50:      */
 51:     protected $m_scope;
 52:     
 53:     /**
 54:      * クラス {@link \Saklient\Cloud\Enums\EScriptClass}
 55:      * 
 56:      * @access protected
 57:      * @ignore
 58:      * @var string
 59:      */
 60:     protected $m_clazz;
 61:     
 62:     /**
 63:      * 名前
 64:      * 
 65:      * @access protected
 66:      * @ignore
 67:      * @var string
 68:      */
 69:     protected $m_name;
 70:     
 71:     /**
 72:      * 説明
 73:      * 
 74:      * @access protected
 75:      * @ignore
 76:      * @var string
 77:      */
 78:     protected $m_description;
 79:     
 80:     /**
 81:      * タグ文字列の配列
 82:      * 
 83:      * @access protected
 84:      * @ignore
 85:      * @var string[]
 86:      */
 87:     protected $m_tags;
 88:     
 89:     /**
 90:      * アイコン
 91:      * 
 92:      * @access protected
 93:      * @ignore
 94:      * @var Icon
 95:      */
 96:     protected $m_icon;
 97:     
 98:     /**
 99:      * 内容
100:      * 
101:      * @access protected
102:      * @ignore
103:      * @var string
104:      */
105:     protected $m_content;
106:     
107:     /**
108:      * 注釈
109:      * 
110:      * @access protected
111:      * @ignore
112:      * @var mixed
113:      */
114:     protected $m_annotation;
115:     
116:     /**
117:      * @private
118:      * @access protected
119:      * @ignore
120:      * @return string
121:      */
122:     protected function _apiPath()
123:     {
124:         return "/note";
125:     }
126:     
127:     /**
128:      * @private
129:      * @access protected
130:      * @ignore
131:      * @return string
132:      */
133:     protected function _rootKey()
134:     {
135:         return "Note";
136:     }
137:     
138:     /**
139:      * @private
140:      * @access protected
141:      * @ignore
142:      * @return string
143:      */
144:     protected function _rootKeyM()
145:     {
146:         return "Notes";
147:     }
148:     
149:     /**
150:      * @private
151:      * @access public
152:      * @ignore
153:      * @return string
154:      */
155:     public function _className()
156:     {
157:         return "Script";
158:     }
159:     
160:     /**
161:      * @private
162:      * @access public
163:      * @ignore
164:      * @return string
165:      */
166:     public function _id()
167:     {
168:         return $this->get_id();
169:     }
170:     
171:     /**
172:      * このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し、新規作成または上書き保存します。
173:      * 
174:      * @access public
175:      * @return \Saklient\Cloud\Resources\Script this
176:      */
177:     public function save()
178:     {
179:         return $this->_save();
180:     }
181:     
182:     /**
183:      * 最新のリソース情報を再取得します。
184:      * 
185:      * @access public
186:      * @return \Saklient\Cloud\Resources\Script this
187:      */
188:     public function reload()
189:     {
190:         return $this->_reload();
191:     }
192:     
193:     /**
194:      * @ignore
195:      * @access public
196:      * @param \Saklient\Cloud\Client $client
197:      * @param mixed $obj
198:      * @param boolean $wrapped=false
199:      */
200:     public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
201:     {
202:         parent::__construct($client);
203:         Util::validateArgCount(func_num_args(), 2);
204:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
205:         Util::validateType($wrapped, "boolean");
206:         $this->apiDeserialize($obj, $wrapped);
207:     }
208:     
209:     /**
210:      * @access private
211:      * @ignore
212:      * @var boolean
213:      */
214:     private $n_id = false;
215:     
216:     /**
217:      * (This method is generated in Translator_default#buildImpl)
218:      * 
219:      * @access private
220:      * @ignore
221:      * @return string
222:      */
223:     private function get_id()
224:     {
225:         return $this->m_id;
226:     }
227:     
228:     
229:     
230:     /**
231:      * @access private
232:      * @ignore
233:      * @var boolean
234:      */
235:     private $n_scope = false;
236:     
237:     /**
238:      * (This method is generated in Translator_default#buildImpl)
239:      * 
240:      * @access private
241:      * @ignore
242:      * @return string
243:      */
244:     private function get_scope()
245:     {
246:         return $this->m_scope;
247:     }
248:     
249:     
250:     
251:     /**
252:      * @access private
253:      * @ignore
254:      * @var boolean
255:      */
256:     private $n_clazz = false;
257:     
258:     /**
259:      * (This method is generated in Translator_default#buildImpl)
260:      * 
261:      * @access private
262:      * @ignore
263:      * @return string
264:      */
265:     private function get_clazz()
266:     {
267:         return $this->m_clazz;
268:     }
269:     
270:     /**
271:      * (This method is generated in Translator_default#buildImpl)
272:      * 
273:      * @access private
274:      * @ignore
275:      * @param string $v
276:      * @return string
277:      */
278:     private function set_clazz($v)
279:     {
280:         Util::validateArgCount(func_num_args(), 1);
281:         Util::validateType($v, "string");
282:         $this->m_clazz = $v;
283:         $this->n_clazz = true;
284:         return $this->m_clazz;
285:     }
286:     
287:     
288:     
289:     /**
290:      * @access private
291:      * @ignore
292:      * @var boolean
293:      */
294:     private $n_name = false;
295:     
296:     /**
297:      * (This method is generated in Translator_default#buildImpl)
298:      * 
299:      * @access private
300:      * @ignore
301:      * @return string
302:      */
303:     private function get_name()
304:     {
305:         return $this->m_name;
306:     }
307:     
308:     
309:     
310:     /**
311:      * @access private
312:      * @ignore
313:      * @var boolean
314:      */
315:     private $n_description = false;
316:     
317:     /**
318:      * (This method is generated in Translator_default#buildImpl)
319:      * 
320:      * @access private
321:      * @ignore
322:      * @return string
323:      */
324:     private function get_description()
325:     {
326:         return $this->m_description;
327:     }
328:     
329:     /**
330:      * (This method is generated in Translator_default#buildImpl)
331:      * 
332:      * @access private
333:      * @ignore
334:      * @param string $v
335:      * @return string
336:      */
337:     private function set_description($v)
338:     {
339:         Util::validateArgCount(func_num_args(), 1);
340:         Util::validateType($v, "string");
341:         $this->m_description = $v;
342:         $this->n_description = true;
343:         return $this->m_description;
344:     }
345:     
346:     
347:     
348:     /**
349:      * @access private
350:      * @ignore
351:      * @var boolean
352:      */
353:     private $n_tags = false;
354:     
355:     /**
356:      * (This method is generated in Translator_default#buildImpl)
357:      * 
358:      * @access private
359:      * @ignore
360:      * @return string[]
361:      */
362:     private function get_tags()
363:     {
364:         $this->n_tags = true;
365:         return $this->m_tags;
366:     }
367:     
368:     /**
369:      * (This method is generated in Translator_default#buildImpl)
370:      * 
371:      * @access private
372:      * @ignore
373:      * @param string[] $v
374:      * @return string[]
375:      */
376:     private function set_tags($v)
377:     {
378:         Util::validateArgCount(func_num_args(), 1);
379:         Util::validateType($v, "\\ArrayObject");
380:         if (is_array($v)) $v = Client::array2ArrayObject($v);
381:         $this->m_tags = $v;
382:         $this->n_tags = true;
383:         return $this->m_tags;
384:     }
385:     
386:     
387:     
388:     /**
389:      * @access private
390:      * @ignore
391:      * @var boolean
392:      */
393:     private $n_icon = false;
394:     
395:     /**
396:      * (This method is generated in Translator_default#buildImpl)
397:      * 
398:      * @access private
399:      * @ignore
400:      * @return \Saklient\Cloud\Resources\Icon
401:      */
402:     private function get_icon()
403:     {
404:         return $this->m_icon;
405:     }
406:     
407:     /**
408:      * (This method is generated in Translator_default#buildImpl)
409:      * 
410:      * @access private
411:      * @ignore
412:      * @param \Saklient\Cloud\Resources\Icon|null $v
413:      * @return \Saklient\Cloud\Resources\Icon
414:      */
415:     private function set_icon(\Saklient\Cloud\Resources\Icon $v=null)
416:     {
417:         Util::validateArgCount(func_num_args(), 1);
418:         Util::validateType($v, "\\Saklient\\Cloud\\Resources\\Icon");
419:         $this->m_icon = $v;
420:         $this->n_icon = true;
421:         return $this->m_icon;
422:     }
423:     
424:     
425:     
426:     /**
427:      * @access private
428:      * @ignore
429:      * @var boolean
430:      */
431:     private $n_content = false;
432:     
433:     /**
434:      * (This method is generated in Translator_default#buildImpl)
435:      * 
436:      * @access private
437:      * @ignore
438:      * @return string
439:      */
440:     private function get_content()
441:     {
442:         return $this->m_content;
443:     }
444:     
445:     /**
446:      * (This method is generated in Translator_default#buildImpl)
447:      * 
448:      * @access private
449:      * @ignore
450:      * @param string $v
451:      * @return string
452:      */
453:     private function set_content($v)
454:     {
455:         Util::validateArgCount(func_num_args(), 1);
456:         Util::validateType($v, "string");
457:         $this->m_content = $v;
458:         $this->n_content = true;
459:         return $this->m_content;
460:     }
461:     
462:     
463:     
464:     /**
465:      * @access private
466:      * @ignore
467:      * @var boolean
468:      */
469:     private $n_annotation = false;
470:     
471:     /**
472:      * (This method is generated in Translator_default#buildImpl)
473:      * 
474:      * @access private
475:      * @ignore
476:      * @return mixed
477:      */
478:     private function get_annotation()
479:     {
480:         return $this->m_annotation;
481:     }
482:     
483:     
484:     
485:     /**
486:      * (This method is generated in Translator_default#buildImpl)
487:      * 
488:      * @access protected
489:      * @ignore
490:      * @param mixed $r
491:      */
492:     protected function apiDeserializeImpl($r)
493:     {
494:         Util::validateArgCount(func_num_args(), 1);
495:         $this->isNew = $r == null;
496:         if ($this->isNew) {
497:             $r = (object)[];
498:         }
499:         $this->isIncomplete = false;
500:         if (Util::existsPath($r, "ID")) {
501:             $this->m_id = Util::getByPath($r, "ID") == null ? null : "" . Util::getByPath($r, "ID");
502:         }
503:         else {
504:             $this->m_id = null;
505:             $this->isIncomplete = true;
506:         }
507:         $this->n_id = false;
508:         if (Util::existsPath($r, "Scope")) {
509:             $this->m_scope = Util::getByPath($r, "Scope") == null ? null : "" . Util::getByPath($r, "Scope");
510:         }
511:         else {
512:             $this->m_scope = null;
513:             $this->isIncomplete = true;
514:         }
515:         $this->n_scope = false;
516:         if (Util::existsPath($r, "Class")) {
517:             $this->m_clazz = Util::getByPath($r, "Class") == null ? null : "" . Util::getByPath($r, "Class");
518:         }
519:         else {
520:             $this->m_clazz = null;
521:             $this->isIncomplete = true;
522:         }
523:         $this->n_clazz = false;
524:         if (Util::existsPath($r, "Name")) {
525:             $this->m_name = Util::getByPath($r, "Name") == null ? null : "" . Util::getByPath($r, "Name");
526:         }
527:         else {
528:             $this->m_name = null;
529:             $this->isIncomplete = true;
530:         }
531:         $this->n_name = false;
532:         if (Util::existsPath($r, "Description")) {
533:             $this->m_description = Util::getByPath($r, "Description") == null ? null : "" . Util::getByPath($r, "Description");
534:         }
535:         else {
536:             $this->m_description = null;
537:             $this->isIncomplete = true;
538:         }
539:         $this->n_description = false;
540:         if (Util::existsPath($r, "Tags")) {
541:             if (Util::getByPath($r, "Tags") == null) {
542:                 $this->m_tags = new \ArrayObject([]);
543:             }
544:             else {
545:                 $this->m_tags = new \ArrayObject([]);
546:                 foreach (Util::getByPath($r, "Tags") as $t) {
547:                     $v1 = null;
548:                     $v1 = $t == null ? null : "" . $t;
549:                     $this->m_tags->append($v1);
550:                 }
551:             }
552:         }
553:         else {
554:             $this->m_tags = null;
555:             $this->isIncomplete = true;
556:         }
557:         $this->n_tags = false;
558:         if (Util::existsPath($r, "Icon")) {
559:             $this->m_icon = Util::getByPath($r, "Icon") == null ? null : new Icon($this->_client, Util::getByPath($r, "Icon"));
560:         }
561:         else {
562:             $this->m_icon = null;
563:             $this->isIncomplete = true;
564:         }
565:         $this->n_icon = false;
566:         if (Util::existsPath($r, "Content")) {
567:             $this->m_content = Util::getByPath($r, "Content") == null ? null : "" . Util::getByPath($r, "Content");
568:         }
569:         else {
570:             $this->m_content = null;
571:             $this->isIncomplete = true;
572:         }
573:         $this->n_content = false;
574:         if (Util::existsPath($r, "Remark")) {
575:             $this->m_annotation = Util::getByPath($r, "Remark");
576:         }
577:         else {
578:             $this->m_annotation = null;
579:             $this->isIncomplete = true;
580:         }
581:         $this->n_annotation = false;
582:     }
583:     
584:     /**
585:      * @ignore
586:      * @access protected
587:      * @param boolean $withClean=false
588:      * @return mixed
589:      */
590:     protected function apiSerializeImpl($withClean=false)
591:     {
592:         Util::validateType($withClean, "boolean");
593:         $missing = new \ArrayObject([]);
594:         $ret = (object)[];
595:         if ($withClean || $this->n_id) {
596:             Util::setByPath($ret, "ID", $this->m_id);
597:         }
598:         if ($withClean || $this->n_scope) {
599:             Util::setByPath($ret, "Scope", $this->m_scope);
600:         }
601:         if ($withClean || $this->n_clazz) {
602:             Util::setByPath($ret, "Class", $this->m_clazz);
603:         }
604:         if ($withClean || $this->n_name) {
605:             Util::setByPath($ret, "Name", $this->m_name);
606:         }
607:         else {
608:             if ($this->isNew) {
609:                 $missing->append("name");
610:             }
611:         }
612:         if ($withClean || $this->n_description) {
613:             Util::setByPath($ret, "Description", $this->m_description);
614:         }
615:         if ($withClean || $this->n_tags) {
616:             Util::setByPath($ret, "Tags", new \ArrayObject([]));
617:             foreach ($this->m_tags as $r1) {
618:                 $v = null;
619:                 $v = $r1;
620:                 $ret->{"Tags"}->append($v);
621:             }
622:         }
623:         if ($withClean || $this->n_icon) {
624:             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()));
625:         }
626:         if ($withClean || $this->n_content) {
627:             Util::setByPath($ret, "Content", $this->m_content);
628:         }
629:         else {
630:             if ($this->isNew) {
631:                 $missing->append("content");
632:             }
633:         }
634:         if ($withClean || $this->n_annotation) {
635:             Util::setByPath($ret, "Remark", $this->m_annotation);
636:         }
637:         if ($missing->count() > 0) {
638:             throw new SaklientException("required_field", "Required fields must be set before the Script creation: " . implode(", ", (array)($missing)));
639:         }
640:         return $ret;
641:     }
642:     
643:     /**
644:      * @ignore
645:      */
646:     public function __get($key) {
647:         switch ($key) {
648:             case "id": return $this->get_id();
649:             case "scope": return $this->get_scope();
650:             case "clazz": return $this->get_clazz();
651:             case "name": return $this->get_name();
652:             case "description": return $this->get_description();
653:             case "tags": return $this->get_tags();
654:             case "icon": return $this->get_icon();
655:             case "content": return $this->get_content();
656:             case "annotation": return $this->get_annotation();
657:             default: return parent::__get($key);
658:         }
659:     }
660:     
661:     /**
662:      * @ignore
663:      */
664:     public function __set($key, $v) {
665:         switch ($key) {
666:             case "clazz": return $this->set_clazz($v);
667:             case "description": return $this->set_description($v);
668:             case "tags": return $this->set_tags($v);
669:             case "icon": return $this->set_icon($v);
670:             case "content": return $this->set_content($v);
671:             default: return parent::__set($key, $v);
672:         }
673:     }
674: 
675: }
676: 
677: 
API documentation generated by ApiGen 2.8.0