1: <?php
2: /**
3: * PHP OpenCloud library.
4: *
5: * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
6: * @license https://www.apache.org/licenses/LICENSE-2.0
7: * @author Glen Campbell <glen.campbell@rackspace.com>
8: * @author Jamie Hannaford <jamie.hannaford@rackspace.com>
9: */
10:
11: namespace OpenCloud\CloudMonitoring\Resource;
12:
13: use OpenCloud\Common\Http\Message\Formatter;
14:
15: /**
16: * NotificationHistory class.
17: */
18: class NotificationHistory extends ReadOnlyResource
19: {
20: private $id;
21: private $timestamp;
22: private $notification_plan_id;
23: private $transaction_id;
24: private $status;
25: private $state;
26: private $notification_results;
27: private $previous_state;
28:
29: protected static $json_name = false;
30: protected static $json_collection_name = 'values';
31: protected static $url_resource = 'notification_history';
32:
33: public function listChecks()
34: {
35: $response = $this->getClient()->get($this->url())->send();
36: return Formatter::decode($response);
37: }
38:
39: public function listHistory($checkId)
40: {
41: return $this->getService()->collection(get_class(), $this->url($checkId));
42: }
43:
44: public function getSingleHistoryItem($checkId, $historyId)
45: {
46: $url = $this->url($checkId . '/' . $historyId);
47: $response = $this->getClient()->get($url)->send();
48:
49: if (null !== ($decoded = Formatter::decode($response))) {
50: $this->populate($decoded);
51: }
52:
53: return false;
54: }
55:
56: }