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/LicenseInfo.php";
 12: use \Saklient\Cloud\Resources\LicenseInfo;
 13: require_once __DIR__ . "/../../../Saklient/Util.php";
 14: use \Saklient\Util;
 15: 
 16: /**
 17:  * ライセンスの実体1つに対応し、属性の取得や操作を行うためのクラス。
 18:  * 
 19:  * @property-read string $id ID 
 20:  * @property string $name 名前 
 21:  * @property \Saklient\Cloud\Resources\LicenseInfo $info ライセンス種別情報 
 22:  */
 23: class License extends Resource {
 24:     
 25:     /**
 26:      * ID
 27:      * 
 28:      * @access protected
 29:      * @ignore
 30:      * @var string
 31:      */
 32:     protected $m_id;
 33:     
 34:     /**
 35:      * 名前
 36:      * 
 37:      * @access protected
 38:      * @ignore
 39:      * @var string
 40:      */
 41:     protected $m_name;
 42:     
 43:     /**
 44:      * ライセンス種別情報
 45:      * 
 46:      * @access protected
 47:      * @ignore
 48:      * @var LicenseInfo
 49:      */
 50:     protected $m_info;
 51:     
 52:     /**
 53:      * @private
 54:      * @access protected
 55:      * @ignore
 56:      * @return string
 57:      */
 58:     protected function _apiPath()
 59:     {
 60:         return "/license";
 61:     }
 62:     
 63:     /**
 64:      * @private
 65:      * @access protected
 66:      * @ignore
 67:      * @return string
 68:      */
 69:     protected function _rootKey()
 70:     {
 71:         return "License";
 72:     }
 73:     
 74:     /**
 75:      * @private
 76:      * @access protected
 77:      * @ignore
 78:      * @return string
 79:      */
 80:     protected function _rootKeyM()
 81:     {
 82:         return "Licenses";
 83:     }
 84:     
 85:     /**
 86:      * @private
 87:      * @access public
 88:      * @ignore
 89:      * @return string
 90:      */
 91:     public function _className()
 92:     {
 93:         return "License";
 94:     }
 95:     
 96:     /**
 97:      * @private
 98:      * @access public
 99:      * @ignore
100:      * @return string
101:      */
102:     public function _id()
103:     {
104:         return $this->get_id();
105:     }
106:     
107:     /**
108:      * このローカルオブジェクトに現在設定されているリソース情報をAPIに送信し、新規作成または上書き保存します。
109:      * 
110:      * @access public
111:      * @return \Saklient\Cloud\Resources\License this
112:      */
113:     public function save()
114:     {
115:         return $this->_save();
116:     }
117:     
118:     /**
119:      * 最新のリソース情報を再取得します。
120:      * 
121:      * @access public
122:      * @return \Saklient\Cloud\Resources\License this
123:      */
124:     public function reload()
125:     {
126:         return $this->_reload();
127:     }
128:     
129:     /**
130:      * @ignore
131:      * @access public
132:      * @param \Saklient\Cloud\Client $client
133:      * @param mixed $obj
134:      * @param boolean $wrapped=false
135:      */
136:     public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
137:     {
138:         parent::__construct($client);
139:         Util::validateArgCount(func_num_args(), 2);
140:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
141:         Util::validateType($wrapped, "boolean");
142:         $this->apiDeserialize($obj, $wrapped);
143:     }
144:     
145:     /**
146:      * @access private
147:      * @ignore
148:      * @var boolean
149:      */
150:     private $n_id = false;
151:     
152:     /**
153:      * (This method is generated in Translator_default#buildImpl)
154:      * 
155:      * @access private
156:      * @ignore
157:      * @return string
158:      */
159:     private function get_id()
160:     {
161:         return $this->m_id;
162:     }
163:     
164:     
165:     
166:     /**
167:      * @access private
168:      * @ignore
169:      * @var boolean
170:      */
171:     private $n_name = false;
172:     
173:     /**
174:      * (This method is generated in Translator_default#buildImpl)
175:      * 
176:      * @access private
177:      * @ignore
178:      * @return string
179:      */
180:     private function get_name()
181:     {
182:         return $this->m_name;
183:     }
184:     
185:     /**
186:      * (This method is generated in Translator_default#buildImpl)
187:      * 
188:      * @access private
189:      * @ignore
190:      * @param string $v
191:      * @return string
192:      */
193:     private function set_name($v)
194:     {
195:         Util::validateArgCount(func_num_args(), 1);
196:         Util::validateType($v, "string");
197:         $this->m_name = $v;
198:         $this->n_name = true;
199:         return $this->m_name;
200:     }
201:     
202:     
203:     
204:     /**
205:      * @access private
206:      * @ignore
207:      * @var boolean
208:      */
209:     private $n_info = false;
210:     
211:     /**
212:      * (This method is generated in Translator_default#buildImpl)
213:      * 
214:      * @access private
215:      * @ignore
216:      * @return \Saklient\Cloud\Resources\LicenseInfo
217:      */
218:     private function get_info()
219:     {
220:         return $this->m_info;
221:     }
222:     
223:     /**
224:      * (This method is generated in Translator_default#buildImpl)
225:      * 
226:      * @access private
227:      * @ignore
228:      * @param \Saklient\Cloud\Resources\LicenseInfo $v
229:      * @return \Saklient\Cloud\Resources\LicenseInfo
230:      */
231:     private function set_info(\Saklient\Cloud\Resources\LicenseInfo $v)
232:     {
233:         Util::validateArgCount(func_num_args(), 1);
234:         Util::validateType($v, "\\Saklient\\Cloud\\Resources\\LicenseInfo");
235:         if (!$this->isNew) {
236:             throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " . "Saklient\\Cloud\\Resources\\License#info");
237:         }
238:         $this->m_info = $v;
239:         $this->n_info = true;
240:         return $this->m_info;
241:     }
242:     
243:     
244:     
245:     /**
246:      * (This method is generated in Translator_default#buildImpl)
247:      * 
248:      * @access protected
249:      * @ignore
250:      * @param mixed $r
251:      */
252:     protected function apiDeserializeImpl($r)
253:     {
254:         Util::validateArgCount(func_num_args(), 1);
255:         $this->isNew = $r == null;
256:         if ($this->isNew) {
257:             $r = (object)[];
258:         }
259:         $this->isIncomplete = false;
260:         if (Util::existsPath($r, "ID")) {
261:             $this->m_id = Util::getByPath($r, "ID") == null ? null : "" . Util::getByPath($r, "ID");
262:         }
263:         else {
264:             $this->m_id = null;
265:             $this->isIncomplete = true;
266:         }
267:         $this->n_id = false;
268:         if (Util::existsPath($r, "Name")) {
269:             $this->m_name = Util::getByPath($r, "Name") == null ? null : "" . Util::getByPath($r, "Name");
270:         }
271:         else {
272:             $this->m_name = null;
273:             $this->isIncomplete = true;
274:         }
275:         $this->n_name = false;
276:         if (Util::existsPath($r, "LicenseInfo")) {
277:             $this->m_info = Util::getByPath($r, "LicenseInfo") == null ? null : new LicenseInfo($this->_client, Util::getByPath($r, "LicenseInfo"));
278:         }
279:         else {
280:             $this->m_info = null;
281:             $this->isIncomplete = true;
282:         }
283:         $this->n_info = false;
284:     }
285:     
286:     /**
287:      * @ignore
288:      * @access protected
289:      * @param boolean $withClean=false
290:      * @return mixed
291:      */
292:     protected function apiSerializeImpl($withClean=false)
293:     {
294:         Util::validateType($withClean, "boolean");
295:         $missing = new \ArrayObject([]);
296:         $ret = (object)[];
297:         if ($withClean || $this->n_id) {
298:             Util::setByPath($ret, "ID", $this->m_id);
299:         }
300:         if ($withClean || $this->n_name) {
301:             Util::setByPath($ret, "Name", $this->m_name);
302:         }
303:         else {
304:             if ($this->isNew) {
305:                 $missing->append("name");
306:             }
307:         }
308:         if ($withClean || $this->n_info) {
309:             Util::setByPath($ret, "LicenseInfo", $withClean ? ($this->m_info == null ? null : $this->m_info->apiSerialize($withClean)) : ($this->m_info == null ? (object)['ID' => "0"] : $this->m_info->apiSerializeID()));
310:         }
311:         else {
312:             if ($this->isNew) {
313:                 $missing->append("info");
314:             }
315:         }
316:         if ($missing->count() > 0) {
317:             throw new SaklientException("required_field", "Required fields must be set before the License creation: " . implode(", ", (array)($missing)));
318:         }
319:         return $ret;
320:     }
321:     
322:     /**
323:      * @ignore
324:      */
325:     public function __get($key) {
326:         switch ($key) {
327:             case "id": return $this->get_id();
328:             case "name": return $this->get_name();
329:             case "info": return $this->get_info();
330:             default: return parent::__get($key);
331:         }
332:     }
333:     
334:     /**
335:      * @ignore
336:      */
337:     public function __set($key, $v) {
338:         switch ($key) {
339:             case "name": return $this->set_name($v);
340:             case "info": return $this->set_info($v);
341:             default: return parent::__set($key, $v);
342:         }
343:     }
344: 
345: }
346: 
347: 
API documentation generated by ApiGen 2.8.0