Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Identity
      • Log
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Resource
    • LoadBalancer
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • AbstractResource
  • Agent
  • AgentConnection
  • AgentHost
  • AgentHostInfo
  • AgentTarget
  • AgentToken
  • Alarm
  • Changelog
  • Check
  • CheckType
  • Entity
  • Metric
  • Notification
  • NotificationHistory
  • NotificationPlan
  • NotificationType
  • ReadonlyResource
  • View
  • Zone
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 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    Jamie Hannaford <jamie.hannaford@rackspace.com>
 8:  */
 9: 
10: namespace OpenCloud\CloudMonitoring\Resource;
11: 
12: use OpenCloud\CloudMonitoring\Exception;
13: use OpenCloud\Common\Http\Message\Formatter;
14: use Guzzle\Http\Exception\ClientErrorResponseException;
15: 
16: /**
17:  * Zone class.
18:  */
19: class Zone extends ReadOnlyResource
20: {
21:     /** @var string */
22:     private $id;
23: 
24:     /** @var string Country Code */
25:     private $country_code;
26: 
27:     /** @var string */
28:     private $label;
29: 
30:     /** @var array List of source IPs */
31:     private $source_ips;
32: 
33:     protected static $json_name = false;
34:     protected static $json_collection_name = 'values';
35:     protected static $url_resource = 'monitoring_zones';
36: 
37:     public function traceroute(array $options)
38:     {
39:         if (!$this->getId()) {
40:             throw new Exception\ZoneException(
41:                 'Please specify a zone ID'
42:             );    
43:         }
44:         
45:         if (!isset($options['target']) || !isset($options['target_resolver'])) {
46:             throw new Exception\ZoneException(
47:                 'Please specify a "target" and "target_resolver" value'
48:             );
49:         }
50: 
51:         $params = (object) array(
52:             'target' => $options['target'],
53:             'target_resolver' => $options['target_resolver']
54:         );
55:         try {
56:             $response = $this->getService()
57:                 ->getClient()
58:                 ->post($this->url('traceroute'), array(), json_encode($params))
59:                 ->send();
60: 
61:             $body = Formatter::decode($response);
62: 
63:             return (isset($body->result)) ? $body->result : false;
64: 
65:         } catch (ClientErrorResponseException $e) {
66:             return false;
67:         }
68:     }
69:     
70: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0