1: <?php
2:
3: namespace OpenCloud\CloudMonitoring\Resource;
4:
5: use OpenCloud\CloudMonitoring\Exception;
6:
7: /**
8: * Zone class.
9: *
10: * @extends ReadOnlyResource
11: */
12: class Zone extends ReadOnlyResource implements ResourceInterface
13: {
14: public $country_code;
15: public $label;
16: public $source_ips;
17:
18: protected static $json_name = false;
19: protected static $json_collection_name = 'values';
20: protected static $url_resource = 'monitoring_zones';
21:
22: public function baseUrl($subresource = '')
23: {
24: return $this->getParent()->url($this->resourceName());
25: }
26:
27: public function traceroute(array $options)
28: {
29: if (!$this->id) {
30: throw new Exception\ZoneException(
31: 'Please specify a zone ID'
32: );
33: }
34:
35: if (!isset($options['target'])) {
36: throw new Exception\ZoneException(
37: 'Please specify a "target" value'
38: );
39: }
40:
41: $params = (object) array('target' => $options['target']);
42:
43: if (isset($options['target_resolver'])) {
44: $params->target_resolver = $options['target_resolver'];
45: }
46:
47: return $this->customAction(
48: $this->url($this->id . '/traceroute'),
49: 'POST',
50: json_encode($params)
51: );
52: }
53:
54: }