Overview

Namespaces

  • None
  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Exceptions
      • Log
      • Request
        • Response
    • Compute
    • Database
    • DNS
    • LoadBalancer
      • Resources
    • ObjectStore
      • Resource
    • Orchestration
    • Volume
  • PHP

Classes

  • AbstractResource
  • Account
  • Agent
  • AgentConnection
  • AgentHost
  • AgentHostInfo
  • AgentTarget
  • AgentToken
  • Alarm
  • Changelog
  • Check
  • CheckType
  • Entity
  • Metric
  • Notification
  • NotificationHistory
  • NotificationPlan
  • NotificationType
  • ReadonlyResource
  • View
  • Zone

Interfaces

  • ResourceInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: 
 3: namespace OpenCloud\CloudMonitoring\Resource;
 4: 
 5: use OpenCloud\Common\PersistentObject;
 6: use OpenCloud\CloudMonitoring\Exception;
 7: 
 8: /**
 9:  * Agent class.
10:  * 
11:  * @extends ReadOnlyResource
12:  * @implements ResourceInterface
13:  */
14: class Agent extends ReadOnlyResource implements ResourceInterface
15: {
16:     
17:     public $last_connected;
18:     
19:     protected static $json_name = false;
20:     protected static $json_collection_name = 'values';
21:     protected static $url_resource = 'agents';
22:         
23:     public function baseUrl()
24:     {
25:         return $this->Service()->Url($this->ResourceName());
26:     }
27:     
28:     public function getConnections()
29:     {
30:         if (!$this->id) {
31:             throw new Exception\AgentException(
32:                'Please specify an "ID" value'
33:             );
34:         }
35:         
36:         $url = $this->Url($this->id . '/connections');
37:         return $this->Service()->Collection(__NAMESPACE__ . '\\AgentConnection', $url);
38:     }
39:     
40:     public function getConnection($connectionId)
41:     {
42:         if (!$this->id) {
43:             throw new Exception\AgentException(
44:                'Please specify an "ID" value'
45:             );
46:         }
47:         
48:         $url = $this->Url($this->id . '/connections/' . $connectionId);
49:         $response = $this->Request($url);
50:         return $this->Service()->resource('AgentConnection', $response);
51:     }
52:     
53: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0