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/IfaceActivitySample.php";
10: use \Saklient\Cloud\Resources\IfaceActivitySample;
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 IfaceActivity 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 "/interface";
48: }
49:
50: 51: 52: 53: 54: 55:
56: protected function _apiPathSuffix()
57: {
58: return "/monitor";
59: }
60:
61: 62: 63: 64: 65:
66: public function __construct(\Saklient\Cloud\Client $client)
67: {
68: parent::__construct($client);
69: Util::validateArgCount(func_num_args(), 1);
70: Util::validateType($client, "\\Saklient\\Cloud\\Client");
71: }
72:
73: 74: 75: 76: 77: 78: 79: 80:
81: protected function _addSample($atStr, $data)
82: {
83: Util::validateArgCount(func_num_args(), 2);
84: Util::validateType($atStr, "string");
85: $this->_samples->append(new IfaceActivitySample($atStr, $data));
86: }
87:
88: 89: 90: 91: 92: 93: 94: 95: 96: 97:
98: public function fetch(NativeDate $startDate=null, NativeDate $endDate=null)
99: {
100: Util::validateType($startDate, "NativeDate");
101: Util::validateType($endDate, "NativeDate");
102: $this->_samples = new \ArrayObject([]);
103: return $this->_fetch($startDate, $endDate);
104: }
105:
106: 107: 108:
109: public function __get($key) {
110: switch ($key) {
111: case "samples": return $this->get_samples();
112: default: return parent::__get($key);
113: }
114: }
115:
116: }
117:
118: