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