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/Cloud/Resources/Resource.php";
 10: use \Saklient\Cloud\Resources\Resource;
 11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/IsoImage.php";
 12: use \Saklient\Cloud\Resources\IsoImage;
 13: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EServerInstanceStatus.php";
 14: use \Saklient\Cloud\Enums\EServerInstanceStatus;
 15: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
 16: use \Saklient\Errors\SaklientException;
 17: 
 18: /**
 19:  * サーバインスタンスの実体1つに対応し、属性の取得や操作を行うためのクラス。
 20:  * 
 21:  * @property-read string $status 起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus} 
 22:  * @property-read string $beforeStatus 前回の起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus} 
 23:  * @property-read NativeDate $statusChangedAt 現在の起動状態に変化した日時 
 24:  * @property-read \Saklient\Cloud\Resources\IsoImage $isoImage 挿入されているISOイメージ 
 25:  */
 26: class ServerInstance extends Resource {
 27:     
 28:     /**
 29:      * 起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus}
 30:      * 
 31:      * @access protected
 32:      * @ignore
 33:      * @var string
 34:      */
 35:     protected $m_status;
 36:     
 37:     /**
 38:      * 前回の起動状態 {@link \Saklient\Cloud\Enums\EServerInstanceStatus}
 39:      * 
 40:      * @access protected
 41:      * @ignore
 42:      * @var string
 43:      */
 44:     protected $m_beforeStatus;
 45:     
 46:     /**
 47:      * 現在の起動状態に変化した日時
 48:      * 
 49:      * @access protected
 50:      * @ignore
 51:      * @var NativeDate
 52:      */
 53:     protected $m_statusChangedAt;
 54:     
 55:     /**
 56:      * 挿入されているISOイメージ
 57:      * 
 58:      * @access protected
 59:      * @ignore
 60:      * @var IsoImage
 61:      */
 62:     protected $m_isoImage;
 63:     
 64:     /**
 65:      * @ignore
 66:      * @access public
 67:      * @param \Saklient\Cloud\Client $client
 68:      * @param mixed $obj
 69:      * @param boolean $wrapped=false
 70:      */
 71:     public function __construct(\Saklient\Cloud\Client $client, $obj, $wrapped=false)
 72:     {
 73:         parent::__construct($client);
 74:         Util::validateArgCount(func_num_args(), 2);
 75:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
 76:         Util::validateType($wrapped, "boolean");
 77:         $this->apiDeserialize($obj, $wrapped);
 78:     }
 79:     
 80:     /**
 81:      * サーバが起動しているときtrueを返します。
 82:      * 
 83:      * @access public
 84:      * @return boolean
 85:      */
 86:     public function isUp()
 87:     {
 88:         return $this->get_status() != null && EServerInstanceStatus::compare($this->get_status(), EServerInstanceStatus::up) == 0;
 89:     }
 90:     
 91:     /**
 92:      * サーバが停止しているときtrueを返します。
 93:      * 
 94:      * @access public
 95:      * @return boolean
 96:      */
 97:     public function isDown()
 98:     {
 99:         return $this->get_status() == null || EServerInstanceStatus::compare($this->get_status(), EServerInstanceStatus::down) == 0;
100:     }
101:     
102:     /**
103:      * @access private
104:      * @ignore
105:      * @var boolean
106:      */
107:     private $n_status = false;
108:     
109:     /**
110:      * (This method is generated in Translator_default#buildImpl)
111:      * 
112:      * @access private
113:      * @ignore
114:      * @return string
115:      */
116:     private function get_status()
117:     {
118:         return $this->m_status;
119:     }
120:     
121:     
122:     
123:     /**
124:      * @access private
125:      * @ignore
126:      * @var boolean
127:      */
128:     private $n_beforeStatus = false;
129:     
130:     /**
131:      * (This method is generated in Translator_default#buildImpl)
132:      * 
133:      * @access private
134:      * @ignore
135:      * @return string
136:      */
137:     private function get_beforeStatus()
138:     {
139:         return $this->m_beforeStatus;
140:     }
141:     
142:     
143:     
144:     /**
145:      * @access private
146:      * @ignore
147:      * @var boolean
148:      */
149:     private $n_statusChangedAt = false;
150:     
151:     /**
152:      * (This method is generated in Translator_default#buildImpl)
153:      * 
154:      * @access private
155:      * @ignore
156:      * @return NativeDate
157:      */
158:     private function get_statusChangedAt()
159:     {
160:         return $this->m_statusChangedAt;
161:     }
162:     
163:     
164:     
165:     /**
166:      * @access private
167:      * @ignore
168:      * @var boolean
169:      */
170:     private $n_isoImage = false;
171:     
172:     /**
173:      * (This method is generated in Translator_default#buildImpl)
174:      * 
175:      * @access private
176:      * @ignore
177:      * @return \Saklient\Cloud\Resources\IsoImage
178:      */
179:     private function get_isoImage()
180:     {
181:         return $this->m_isoImage;
182:     }
183:     
184:     
185:     
186:     /**
187:      * (This method is generated in Translator_default#buildImpl)
188:      * 
189:      * @access protected
190:      * @ignore
191:      * @param mixed $r
192:      */
193:     protected function apiDeserializeImpl($r)
194:     {
195:         Util::validateArgCount(func_num_args(), 1);
196:         $this->isNew = $r == null;
197:         if ($this->isNew) {
198:             $r = (object)[];
199:         }
200:         $this->isIncomplete = false;
201:         if (Util::existsPath($r, "Status")) {
202:             $this->m_status = Util::getByPath($r, "Status") == null ? null : "" . Util::getByPath($r, "Status");
203:         }
204:         else {
205:             $this->m_status = null;
206:             $this->isIncomplete = true;
207:         }
208:         $this->n_status = false;
209:         if (Util::existsPath($r, "BeforeStatus")) {
210:             $this->m_beforeStatus = Util::getByPath($r, "BeforeStatus") == null ? null : "" . Util::getByPath($r, "BeforeStatus");
211:         }
212:         else {
213:             $this->m_beforeStatus = null;
214:             $this->isIncomplete = true;
215:         }
216:         $this->n_beforeStatus = false;
217:         if (Util::existsPath($r, "StatusChangedAt")) {
218:             $this->m_statusChangedAt = Util::getByPath($r, "StatusChangedAt") == null ? null : Util::str2date("" . Util::getByPath($r, "StatusChangedAt"));
219:         }
220:         else {
221:             $this->m_statusChangedAt = null;
222:             $this->isIncomplete = true;
223:         }
224:         $this->n_statusChangedAt = false;
225:         if (Util::existsPath($r, "CDROM")) {
226:             $this->m_isoImage = Util::getByPath($r, "CDROM") == null ? null : new IsoImage($this->_client, Util::getByPath($r, "CDROM"));
227:         }
228:         else {
229:             $this->m_isoImage = null;
230:             $this->isIncomplete = true;
231:         }
232:         $this->n_isoImage = false;
233:     }
234:     
235:     /**
236:      * @ignore
237:      * @access protected
238:      * @param boolean $withClean=false
239:      * @return mixed
240:      */
241:     protected function apiSerializeImpl($withClean=false)
242:     {
243:         Util::validateType($withClean, "boolean");
244:         $ret = (object)[];
245:         if ($withClean || $this->n_status) {
246:             Util::setByPath($ret, "Status", $this->m_status);
247:         }
248:         if ($withClean || $this->n_beforeStatus) {
249:             Util::setByPath($ret, "BeforeStatus", $this->m_beforeStatus);
250:         }
251:         if ($withClean || $this->n_statusChangedAt) {
252:             Util::setByPath($ret, "StatusChangedAt", $this->m_statusChangedAt == null ? null : Util::date2str($this->m_statusChangedAt));
253:         }
254:         if ($withClean || $this->n_isoImage) {
255:             Util::setByPath($ret, "CDROM", $withClean ? ($this->m_isoImage == null ? null : $this->m_isoImage->apiSerialize($withClean)) : ($this->m_isoImage == null ? (object)['ID' => "0"] : $this->m_isoImage->apiSerializeID()));
256:         }
257:         return $ret;
258:     }
259:     
260:     /**
261:      * @ignore
262:      */
263:     public function __get($key) {
264:         switch ($key) {
265:             case "status": return $this->get_status();
266:             case "beforeStatus": return $this->get_beforeStatus();
267:             case "statusChangedAt": return $this->get_statusChangedAt();
268:             case "isoImage": return $this->get_isoImage();
269:             default: return parent::__get($key);
270:         }
271:     }
272: 
273: }
274: 
275: 
API documentation generated by ApiGen 2.8.0