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/Activity.php";
8: use \Saklient\Cloud\Resources\Activity;
9: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/DiskActivitySample.php";
10: use \Saklient\Cloud\Resources\DiskActivitySample;
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: class DiskActivity extends Activity {
18:
19: 20: 21: 22: 23: 24:
25: protected $_samples;
26:
27: 28: 29: 30: 31:
32: protected function get_samples()
33: {
34: return $this->_samples;
35: }
36:
37:
38:
39: 40: 41: 42: 43: 44:
45: protected function _apiPathPrefix()
46: {
47: return "/disk";
48: }
49:
50: 51: 52: 53: 54:
55: public function __construct(\Saklient\Cloud\Client $client)
56: {
57: parent::__construct($client);
58: Util::validateArgCount(func_num_args(), 1);
59: Util::validateType($client, "\\Saklient\\Cloud\\Client");
60: }
61:
62: 63: 64: 65: 66: 67: 68: 69:
70: protected function _addSample($atStr, $data)
71: {
72: Util::validateArgCount(func_num_args(), 2);
73: Util::validateType($atStr, "string");
74: $this->_samples->append(new DiskActivitySample($atStr, $data));
75: }
76:
77: 78: 79: 80: 81: 82: 83: 84: 85: 86:
87: public function fetch(NativeDate $startDate=null, NativeDate $endDate=null)
88: {
89: Util::validateType($startDate, "NativeDate");
90: Util::validateType($endDate, "NativeDate");
91: $this->_samples = new \ArrayObject([]);
92: return $this->_fetch($startDate, $endDate);
93: }
94:
95: 96: 97:
98: public function __get($key) {
99: switch ($key) {
100: case "samples": return $this->get_samples();
101: default: return parent::__get($key);
102: }
103: }
104:
105: }
106:
107: