1: <?php
2:
3: namespace Saklient\Cloud\Models;
4:
5: require_once __DIR__ . "/../../../Saklient/Cloud/Client.php";
6: use \Saklient\Cloud\Client;
7: require_once __DIR__ . "/../../../Saklient/Cloud/Models/Model.php";
8: use \Saklient\Cloud\Models\Model;
9: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Resource.php";
10: use \Saklient\Cloud\Resources\Resource;
11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/DiskPlan.php";
12: use \Saklient\Cloud\Resources\DiskPlan;
13: require_once __DIR__ . "/../../../Saklient/Util.php";
14: use \Saklient\Util;
15: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
16: use \Saklient\Errors\SaklientException;
17:
18: 19: 20: 21: 22: 23:
24: class Model_DiskPlan extends Model {
25:
26: 27: 28: 29: 30: 31:
32: protected function _apiPath()
33: {
34: return "/product/disk";
35: }
36:
37: 38: 39: 40: 41: 42:
43: protected function _rootKey()
44: {
45: return "DiskPlan";
46: }
47:
48: 49: 50: 51: 52: 53:
54: protected function _rootKeyM()
55: {
56: return "DiskPlans";
57: }
58:
59: 60: 61: 62: 63: 64:
65: protected function _className()
66: {
67: return "DiskPlan";
68: }
69:
70: 71: 72: 73: 74: 75: 76: 77:
78: protected function _createResourceImpl($obj, $wrapped=false)
79: {
80: Util::validateArgCount(func_num_args(), 1);
81: Util::validateType($wrapped, "boolean");
82: return new DiskPlan($this->_client, $obj, $wrapped);
83: }
84:
85: 86: 87: 88: 89: 90: 91:
92: public function offset($offset)
93: {
94: Util::validateArgCount(func_num_args(), 1);
95: Util::validateType($offset, "int");
96: return $this->_offset($offset);
97: }
98:
99: 100: 101: 102: 103: 104: 105:
106: public function limit($count)
107: {
108: Util::validateArgCount(func_num_args(), 1);
109: Util::validateType($count, "int");
110: return $this->_limit($count);
111: }
112:
113: 114: 115: 116: 117: 118: 119: 120: 121:
122: public function filterBy($key, $value, $multiple=false)
123: {
124: Util::validateArgCount(func_num_args(), 2);
125: Util::validateType($key, "string");
126: Util::validateType($multiple, "boolean");
127: return $this->_filterBy($key, $value, $multiple);
128: }
129:
130: 131: 132: 133: 134: 135:
136: public function reset()
137: {
138: return $this->_reset();
139: }
140:
141: 142: 143: 144: 145: 146: 147:
148: public function getById($id)
149: {
150: Util::validateArgCount(func_num_args(), 1);
151: Util::validateType($id, "string");
152: return $this->_getById($id);
153: }
154:
155: 156: 157: 158: 159: 160:
161: public function find()
162: {
163: return $this->_find();
164: }
165:
166: 167: 168: 169: 170:
171: public function __construct(\Saklient\Cloud\Client $client)
172: {
173: parent::__construct($client);
174: Util::validateArgCount(func_num_args(), 1);
175: Util::validateType($client, "\\Saklient\\Cloud\\Client");
176: $this->_hdd = null;
177: $this->_ssd = null;
178: }
179:
180: 181: 182: 183: 184: 185:
186: protected $_hdd;
187:
188: 189: 190: 191: 192:
193: protected function get_hdd()
194: {
195: if ($this->_hdd == null) {
196: $this->_hdd = $this->getById("2");
197: }
198: return $this->_hdd;
199: }
200:
201:
202:
203: 204: 205: 206: 207: 208:
209: protected $_ssd;
210:
211: 212: 213: 214: 215:
216: protected function get_ssd()
217: {
218: if ($this->_ssd == null) {
219: $this->_ssd = $this->getById("4");
220: }
221: return $this->_ssd;
222: }
223:
224:
225:
226: 227: 228:
229: public function __get($key) {
230: switch ($key) {
231: case "hdd": return $this->get_hdd();
232: case "ssd": return $this->get_ssd();
233: default: return parent::__get($key);
234: }
235: }
236:
237: }
238:
239: