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    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\CloudMonitoring\Exception;
14: use OpenCloud\Common\Http\Message\Formatter;
15: 
16: /**
17:  * Agent class.
18:  */
19: class AgentTarget extends ReadOnlyResource
20: {
21:     
22:     private $type = 'agent.filesystem';
23:     
24:     protected static $json_name = 'targets';
25:     protected static $json_collection_name = 'targets';
26:     protected static $url_resource = 'targets';
27: 
28:     protected $allowedTypes = array(
29:         'agent.filesystem',
30:         'agent.memory',
31:         'agent.load_average',
32:         'agent.cpu',
33:         'agent.disk',
34:         'agent.network',
35:         'agent.plugin'
36:     );
37: 
38:     public function getUrl($path = null, array $query = array())
39:     {
40:         $path = "agent/check_types/{$this->type}/{$this->resourceName()}";
41:         return $this->getParent()->getUrl($path);
42:     }
43: 
44:     public function setType($type)
45:     {
46:         if (!in_array($type, $this->allowedTypes)) {
47:             throw new Exception\AgentException(sprintf(
48:                 'Incorrect target type. Please specify one of the following: %s',
49:                 implode(', ', $this->allowedTypes)
50:             ));
51:         }
52: 
53:         $this->type = $type;
54:     }
55:     
56:     public function getType()
57:     {
58:         return $this->type;
59:     }
60:     
61: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0