Overview

Namespaces

  • PHP
  • Saklient
    • Cloud
      • Enums
      • Errors
      • Models
      • Resources
    • Errors

Classes

  • Activity
  • Appliance
  • Archive
  • Bridge
  • Disk
  • DiskActivity
  • DiskConfig
  • DiskPlan
  • FtpInfo
  • Icon
  • Iface
  • IfaceActivity
  • Ipv4Net
  • Ipv4Range
  • Ipv6Net
  • IsoImage
  • LbServer
  • LbVirtualIp
  • License
  • LicenseInfo
  • LoadBalancer
  • Region
  • Router
  • RouterActivity
  • RouterPlan
  • Script
  • Server
  • ServerActivity
  • ServerInstance
  • ServerPlan
  • Swytch
  • VpcRouter
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Saklient\Cloud\Resources;
  4: 
  5: require_once __DIR__ . "/../../../Saklient/Util.php";
  6: use \Saklient\Util;
  7: require_once __DIR__ . "/../../../Saklient/Cloud/Client.php";
  8: use \Saklient\Cloud\Client;
  9: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
 10: use \Saklient\Errors\SaklientException;
 11: 
 12: class Activity {
 13:     
 14:     /**
 15:      * @private
 16:      * @access protected
 17:      * @ignore
 18:      * @var Client
 19:      */
 20:     protected $_client;
 21:     
 22:     /**
 23:      * @private
 24:      * @access protected
 25:      * @ignore
 26:      * @var string
 27:      */
 28:     protected $_sourceId;
 29:     
 30:     /**
 31:      * @private
 32:      * @access protected
 33:      * @ignore
 34:      * @return string
 35:      */
 36:     protected function _apiPathPrefix()
 37:     {
 38:         return null;
 39:     }
 40:     
 41:     /**
 42:      * @private
 43:      * @access protected
 44:      * @ignore
 45:      * @return string
 46:      */
 47:     protected function _apiPathSuffix()
 48:     {
 49:         return "/monitor";
 50:     }
 51:     
 52:     /**
 53:      * @private
 54:      * @access protected
 55:      * @ignore
 56:      * @param string $atStr
 57:      * @param mixed $data
 58:      * @return void
 59:      */
 60:     protected function _addSample($atStr, $data)
 61:     {
 62:         Util::validateArgCount(func_num_args(), 2);
 63:         Util::validateType($atStr, "string");
 64:     }
 65:     
 66:     /**
 67:      * @ignore
 68:      * @access public
 69:      * @param \Saklient\Cloud\Client $client
 70:      */
 71:     public function __construct(\Saklient\Cloud\Client $client)
 72:     {
 73:         Util::validateArgCount(func_num_args(), 1);
 74:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
 75:         $this->_client = $client;
 76:     }
 77:     
 78:     /**
 79:      * @ignore
 80:      * @access public
 81:      * @param string $id
 82:      * @return void
 83:      */
 84:     public function setSourceId($id)
 85:     {
 86:         Util::validateArgCount(func_num_args(), 1);
 87:         Util::validateType($id, "string");
 88:         $this->_sourceId = $id;
 89:     }
 90:     
 91:     /**
 92:      * 現在の最新のアクティビティ情報を取得し、samplesに格納します。
 93:      *  
 94:      *       * @return this
 95:      * 
 96:      * @private
 97:      * @access public
 98:      * @ignore
 99:      * @param NativeDate|null $startDate=null
100:      * @param NativeDate|null $endDate=null
101:      * @return \Saklient\Cloud\Resources\Activity
102:      */
103:     public function _fetch(NativeDate $startDate=null, NativeDate $endDate=null)
104:     {
105:         Util::validateType($startDate, "NativeDate");
106:         Util::validateType($endDate, "NativeDate");
107:         $query = (object)[];
108:         if ($startDate != null) {
109:             $query->{"Start"} = Util::date2str($startDate);
110:         }
111:         if ($endDate != null) {
112:             $query->{"End"} = Util::date2str($endDate);
113:         }
114:         $path = $this->_apiPathPrefix() . "/" . Util::urlEncode($this->_sourceId) . $this->_apiPathSuffix();
115:         $data = $this->_client->request("GET", $path);
116:         if ($data == null) {
117:             return null;
118:         }
119:         $data = $data->{"Data"};
120:         if ($data == null) {
121:             return null;
122:         }
123:         $dates = new \ArrayObject(array_keys((array)$data));
124:         $dates = Util::sortArray($dates);
125:         foreach ($dates as $date) {
126:             $this->_addSample($date, $data->{$date});
127:         }
128:         return $this;
129:     }
130:     
131:     
132: 
133: }
134: 
135: 
API documentation generated by ApiGen 2.8.0