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