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/Util.php";
10: use \Saklient\Util;
11: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
12: use \Saklient\Errors\SaklientException;
13:
14: 15: 16: 17: 18: 19: 20: 21:
22: class RouterPlan extends Resource {
23:
24: 25: 26: 27: 28: 29: 30:
31: protected $m_id;
32:
33: 34: 35: 36: 37: 38: 39:
40: protected $m_name;
41:
42: 43: 44: 45: 46: 47: 48:
49: protected $m_bandWidthMbps;
50:
51: 52: 53: 54: 55: 56: 57:
58: protected $m_serviceClass;
59:
60: 61: 62: 63: 64: 65:
66: protected function _apiPath()
67: {
68: return "/product/internet";
69: }
70:
71: 72: 73: 74: 75: 76:
77: protected function _rootKey()
78: {
79: return "InternetPlan";
80: }
81:
82: 83: 84: 85: 86: 87:
88: protected function _rootKeyM()
89: {
90: return "InternetPlans";
91: }
92:
93: 94: 95: 96: 97: 98:
99: public function _className()
100: {
101: return "RouterPlan";
102: }
103:
104: 105: 106: 107: 108: 109:
110: public function _id()
111: {
112: return $this->get_id();
113: }
114:
115: 116: 117: 118: 119: 120: 121:
122: public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
123: {
124: parent::__construct($client);
125: Util::validateArgCount(func_num_args(), 2);
126: Util::validateType($client, "\\Saklient\\Cloud\\Client");
127: Util::validateType($wrapped, "boolean");
128: $this->apiDeserialize($obj, $wrapped);
129: }
130:
131: 132: 133: 134: 135:
136: private $n_id = false;
137:
138: 139: 140: 141: 142: 143: 144:
145: private function get_id()
146: {
147: return $this->m_id;
148: }
149:
150:
151:
152: 153: 154: 155: 156:
157: private $n_name = false;
158:
159: 160: 161: 162: 163: 164: 165:
166: private function get_name()
167: {
168: return $this->m_name;
169: }
170:
171:
172:
173: 174: 175: 176: 177:
178: private $n_bandWidthMbps = false;
179:
180: 181: 182: 183: 184: 185: 186:
187: private function get_bandWidthMbps()
188: {
189: return $this->m_bandWidthMbps;
190: }
191:
192:
193:
194: 195: 196: 197: 198:
199: private $n_serviceClass = false;
200:
201: 202: 203: 204: 205: 206: 207:
208: private function get_serviceClass()
209: {
210: return $this->m_serviceClass;
211: }
212:
213:
214:
215: 216: 217: 218: 219: 220: 221:
222: protected function apiDeserializeImpl($r)
223: {
224: Util::validateArgCount(func_num_args(), 1);
225: $this->isNew = $r == null;
226: if ($this->isNew) {
227: $r = (object)[];
228: }
229: $this->isIncomplete = false;
230: if (Util::existsPath($r, "ID")) {
231: $this->m_id = Util::getByPath($r, "ID") == null ? null : "" . Util::getByPath($r, "ID");
232: }
233: else {
234: $this->m_id = null;
235: $this->isIncomplete = true;
236: }
237: $this->n_id = false;
238: if (Util::existsPath($r, "Name")) {
239: $this->m_name = Util::getByPath($r, "Name") == null ? null : "" . Util::getByPath($r, "Name");
240: }
241: else {
242: $this->m_name = null;
243: $this->isIncomplete = true;
244: }
245: $this->n_name = false;
246: if (Util::existsPath($r, "BandWidthMbps")) {
247: $this->m_bandWidthMbps = Util::getByPath($r, "BandWidthMbps") == null ? null : intval("" . Util::getByPath($r, "BandWidthMbps"));
248: }
249: else {
250: $this->m_bandWidthMbps = null;
251: $this->isIncomplete = true;
252: }
253: $this->n_bandWidthMbps = false;
254: if (Util::existsPath($r, "ServiceClass")) {
255: $this->m_serviceClass = Util::getByPath($r, "ServiceClass") == null ? null : "" . Util::getByPath($r, "ServiceClass");
256: }
257: else {
258: $this->m_serviceClass = null;
259: $this->isIncomplete = true;
260: }
261: $this->n_serviceClass = false;
262: }
263:
264: 265: 266: 267: 268: 269:
270: protected function apiSerializeImpl($withClean=false)
271: {
272: Util::validateType($withClean, "boolean");
273: $ret = (object)[];
274: if ($withClean || $this->n_id) {
275: Util::setByPath($ret, "ID", $this->m_id);
276: }
277: if ($withClean || $this->n_name) {
278: Util::setByPath($ret, "Name", $this->m_name);
279: }
280: if ($withClean || $this->n_bandWidthMbps) {
281: Util::setByPath($ret, "BandWidthMbps", $this->m_bandWidthMbps);
282: }
283: if ($withClean || $this->n_serviceClass) {
284: Util::setByPath($ret, "ServiceClass", $this->m_serviceClass);
285: }
286: return $ret;
287: }
288:
289: 290: 291:
292: public function __get($key) {
293: switch ($key) {
294: case "id": return $this->get_id();
295: case "name": return $this->get_name();
296: case "bandWidthMbps": return $this->get_bandWidthMbps();
297: case "serviceClass": return $this->get_serviceClass();
298: default: return parent::__get($key);
299: }
300: }
301:
302: }
303:
304: