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/IsoImage.php";
12: use \Saklient\Cloud\Resources\IsoImage;
13: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EScope.php";
14: use \Saklient\Cloud\Enums\EScope;
15: require_once __DIR__ . "/../../../Saklient/Util.php";
16: use \Saklient\Util;
17: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
18: use \Saklient\Errors\SaklientException;
19:
20:
21: class Model_IsoImage extends Model {
22:
23: 24: 25: 26: 27: 28:
29: protected function _apiPath()
30: {
31: return "/cdrom";
32: }
33:
34: 35: 36: 37: 38: 39:
40: protected function _rootKey()
41: {
42: return "CDROM";
43: }
44:
45: 46: 47: 48: 49: 50:
51: protected function _rootKeyM()
52: {
53: return "CDROMs";
54: }
55:
56: 57: 58: 59: 60: 61:
62: protected function _className()
63: {
64: return "IsoImage";
65: }
66:
67: 68: 69: 70: 71: 72: 73: 74:
75: protected function _createResourceImpl($obj, $wrapped=false)
76: {
77: Util::validateArgCount(func_num_args(), 1);
78: Util::validateType($wrapped, "boolean");
79: return new IsoImage($this->_client, $obj, $wrapped);
80: }
81:
82: 83: 84: 85: 86: 87: 88:
89: public function offset($offset)
90: {
91: Util::validateArgCount(func_num_args(), 1);
92: Util::validateType($offset, "int");
93: return $this->_offset($offset);
94: }
95:
96: 97: 98: 99: 100: 101: 102:
103: public function limit($count)
104: {
105: Util::validateArgCount(func_num_args(), 1);
106: Util::validateType($count, "int");
107: return $this->_limit($count);
108: }
109:
110: 111: 112: 113: 114: 115: 116: 117: 118:
119: public function filterBy($key, $value, $multiple=false)
120: {
121: Util::validateArgCount(func_num_args(), 2);
122: Util::validateType($key, "string");
123: Util::validateType($multiple, "boolean");
124: return $this->_filterBy($key, $value, $multiple);
125: }
126:
127: 128: 129: 130: 131: 132:
133: public function reset()
134: {
135: return $this->_reset();
136: }
137:
138: 139: 140: 141: 142: 143: 144: 145:
146: public function create()
147: {
148: return $this->_create();
149: }
150:
151: 152: 153: 154: 155: 156: 157:
158: public function getById($id)
159: {
160: Util::validateArgCount(func_num_args(), 1);
161: Util::validateType($id, "string");
162: return $this->_getById($id);
163: }
164:
165: 166: 167: 168: 169: 170:
171: public function find()
172: {
173: return $this->_find();
174: }
175:
176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186:
187: public function withNameLike($name)
188: {
189: Util::validateArgCount(func_num_args(), 1);
190: Util::validateType($name, "string");
191: return $this->_withNameLike($name);
192: }
193:
194: 195: 196: 197: 198: 199: 200: 201: 202: 203:
204: public function withTag($tag)
205: {
206: Util::validateArgCount(func_num_args(), 1);
207: Util::validateType($tag, "string");
208: return $this->_withTag($tag);
209: }
210:
211: 212: 213: 214: 215: 216: 217: 218:
219: public function withTags($tags)
220: {
221: Util::validateArgCount(func_num_args(), 1);
222: Util::validateType($tags, "\\ArrayObject");
223: return $this->_withTags($tags);
224: }
225:
226: 227: 228: 229: 230: 231: 232: 233:
234: public function withTagDnf($dnf)
235: {
236: Util::validateArgCount(func_num_args(), 1);
237: Util::validateType($dnf, "\\ArrayObject");
238: return $this->_withTagDnf($dnf);
239: }
240:
241: 242: 243: 244: 245: 246: 247: 248:
249: public function sortByName($reverse=false)
250: {
251: Util::validateType($reverse, "boolean");
252: return $this->_sortByName($reverse);
253: }
254:
255: 256: 257: 258: 259:
260: public function __construct(\Saklient\Cloud\Client $client)
261: {
262: parent::__construct($client);
263: Util::validateArgCount(func_num_args(), 1);
264: Util::validateType($client, "\\Saklient\\Cloud\\Client");
265: }
266:
267: 268: 269: 270: 271: 272: 273:
274: public function withSizeGib($sizeGib)
275: {
276: Util::validateArgCount(func_num_args(), 1);
277: Util::validateType($sizeGib, "int");
278: $this->_filterBy("SizeMB", new \ArrayObject([$sizeGib * 1024]));
279: return $this;
280: }
281:
282: 283: 284: 285: 286: 287:
288: public function withSharedScope()
289: {
290: $this->_filterBy("Scope", new \ArrayObject([EScope::shared]));
291: return $this;
292: }
293:
294: 295: 296: 297: 298: 299:
300: public function withUserScope()
301: {
302: $this->_filterBy("Scope", new \ArrayObject([EScope::user]));
303: return $this;
304: }
305:
306: 307: 308: 309: 310: 311: 312:
313: public function sortBySize($reverse=false)
314: {
315: Util::validateType($reverse, "boolean");
316: $this->_sort("SizeMB", $reverse);
317: return $this;
318: }
319:
320:
321:
322: }
323:
324: