Overview

Namespaces

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

Classes

  • Model_Appliance
  • Model_Archive
  • Model_Bridge
  • Model_Disk
  • Model_DiskPlan
  • Model_Icon
  • Model_Iface
  • Model_Ipv6Net
  • Model_IsoImage
  • Model_License
  • Model_LicenseInfo
  • Model_Region
  • Model_Router
  • Model_RouterPlan
  • Model_Script
  • Model_Server
  • Model_ServerPlan
  • Model_Swytch
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Saklient\Cloud\Models;
  4: 
  5: require_once __DIR__ . "/../../../Saklient/Cloud/Client.php";
  6: use \Saklient\Cloud\Client;
  7: require_once __DIR__ . "/../../../Saklient/Cloud/Models/Model.php";
  8: use \Saklient\Cloud\Models\Model;
  9: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Resource.php";
 10: use \Saklient\Cloud\Resources\Resource;
 11: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/Server.php";
 12: use \Saklient\Cloud\Resources\Server;
 13: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/ServerPlan.php";
 14: use \Saklient\Cloud\Resources\ServerPlan;
 15: require_once __DIR__ . "/../../../Saklient/Cloud/Resources/IsoImage.php";
 16: use \Saklient\Cloud\Resources\IsoImage;
 17: require_once __DIR__ . "/../../../Saklient/Cloud/Enums/EServerInstanceStatus.php";
 18: use \Saklient\Cloud\Enums\EServerInstanceStatus;
 19: require_once __DIR__ . "/../../../Saklient/Util.php";
 20: use \Saklient\Util;
 21: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
 22: use \Saklient\Errors\SaklientException;
 23: 
 24: /** サーバを検索・作成するための機能を備えたクラス。 */
 25: class Model_Server extends Model {
 26:     
 27:     /**
 28:      * @private
 29:      * @access protected
 30:      * @ignore
 31:      * @return string
 32:      */
 33:     protected function _apiPath()
 34:     {
 35:         return "/server";
 36:     }
 37:     
 38:     /**
 39:      * @private
 40:      * @access protected
 41:      * @ignore
 42:      * @return string
 43:      */
 44:     protected function _rootKey()
 45:     {
 46:         return "Server";
 47:     }
 48:     
 49:     /**
 50:      * @private
 51:      * @access protected
 52:      * @ignore
 53:      * @return string
 54:      */
 55:     protected function _rootKeyM()
 56:     {
 57:         return "Servers";
 58:     }
 59:     
 60:     /**
 61:      * @private
 62:      * @access protected
 63:      * @ignore
 64:      * @return string
 65:      */
 66:     protected function _className()
 67:     {
 68:         return "Server";
 69:     }
 70:     
 71:     /**
 72:      * @private
 73:      * @access protected
 74:      * @ignore
 75:      * @param mixed $obj
 76:      * @param boolean $wrapped=false
 77:      * @return \Saklient\Cloud\Resources\Resource
 78:      */
 79:     protected function _createResourceImpl($obj, $wrapped=false)
 80:     {
 81:         Util::validateArgCount(func_num_args(), 1);
 82:         Util::validateType($wrapped, "boolean");
 83:         return new Server($this->_client, $obj, $wrapped);
 84:     }
 85:     
 86:     /**
 87:      * 次に取得するリストの開始オフセットを指定します。
 88:      * 
 89:      * @access public
 90:      * @param int $offset オフセット
 91:      * @return \Saklient\Cloud\Models\Model_Server this
 92:      */
 93:     public function offset($offset)
 94:     {
 95:         Util::validateArgCount(func_num_args(), 1);
 96:         Util::validateType($offset, "int");
 97:         return $this->_offset($offset);
 98:     }
 99:     
100:     /**
101:      * 次に取得するリストの上限レコード数を指定します。
102:      * 
103:      * @access public
104:      * @param int $count 上限レコード数
105:      * @return \Saklient\Cloud\Models\Model_Server this
106:      */
107:     public function limit($count)
108:     {
109:         Util::validateArgCount(func_num_args(), 1);
110:         Util::validateType($count, "int");
111:         return $this->_limit($count);
112:     }
113:     
114:     /**
115:      * Web APIのフィルタリング設定を直接指定します。
116:      * 
117:      * @access public
118:      * @param string $key キー
119:      * @param mixed $value 値
120:      * @param boolean $multiple=false valueに配列を与え、OR条件で完全一致検索する場合にtrueを指定します。通常、valueはスカラ値であいまい検索されます。
121:      * @return \Saklient\Cloud\Models\Model_Server
122:      */
123:     public function filterBy($key, $value, $multiple=false)
124:     {
125:         Util::validateArgCount(func_num_args(), 2);
126:         Util::validateType($key, "string");
127:         Util::validateType($multiple, "boolean");
128:         return $this->_filterBy($key, $value, $multiple);
129:     }
130:     
131:     /**
132:      * 次のリクエストのために設定されているステートをすべて破棄します。
133:      * 
134:      * @access public
135:      * @return \Saklient\Cloud\Models\Model_Server this
136:      */
137:     public function reset()
138:     {
139:         return $this->_reset();
140:     }
141:     
142:     /**
143:      * 新規リソース作成用のオブジェクトを用意します。
144:      * 
145:      * 返り値のオブジェクトにパラメータを設定し、save() を呼ぶことで実際のリソースが作成されます。
146:      * 
147:      * @access public
148:      * @return \Saklient\Cloud\Resources\Server リソースオブジェクト
149:      */
150:     public function create()
151:     {
152:         return $this->_create();
153:     }
154:     
155:     /**
156:      * 指定したIDを持つ唯一のリソースを取得します。
157:      * 
158:      * @access public
159:      * @param string $id
160:      * @return \Saklient\Cloud\Resources\Server リソースオブジェクト
161:      */
162:     public function getById($id)
163:     {
164:         Util::validateArgCount(func_num_args(), 1);
165:         Util::validateType($id, "string");
166:         return $this->_getById($id);
167:     }
168:     
169:     /**
170:      * リソースの検索リクエストを実行し、結果をリストで取得します。
171:      * 
172:      * @access public
173:      * @return \Saklient\Cloud\Resources\Server[] リソースオブジェクトの配列
174:      */
175:     public function find()
176:     {
177:         return $this->_find();
178:     }
179:     
180:     /**
181:      * 指定した文字列を名前に含むリソースに絞り込みます。
182:      * 
183:      * 大文字・小文字は区別されません。
184:      * 半角スペースで区切られた複数の文字列は、それらをすべて含むことが条件とみなされます。
185:      * 
186:      * @todo Implement test case
187:      * @access public
188:      * @param string $name
189:      * @return \Saklient\Cloud\Models\Model_Server
190:      */
191:     public function withNameLike($name)
192:     {
193:         Util::validateArgCount(func_num_args(), 1);
194:         Util::validateType($name, "string");
195:         return $this->_withNameLike($name);
196:     }
197:     
198:     /**
199:      * 指定したタグを持つリソースに絞り込みます。
200:      * 
201:      * 複数のタグを指定する場合は withTags() を利用してください。
202:      * 
203:      * @todo Implement test case
204:      * @access public
205:      * @param string $tag
206:      * @return \Saklient\Cloud\Models\Model_Server
207:      */
208:     public function withTag($tag)
209:     {
210:         Util::validateArgCount(func_num_args(), 1);
211:         Util::validateType($tag, "string");
212:         return $this->_withTag($tag);
213:     }
214:     
215:     /**
216:      * 指定したすべてのタグを持つリソースに絞り込みます。
217:      * 
218:      * @todo Implement test case
219:      * @access public
220:      * @param string[] $tags
221:      * @return \Saklient\Cloud\Models\Model_Server
222:      */
223:     public function withTags($tags)
224:     {
225:         Util::validateArgCount(func_num_args(), 1);
226:         Util::validateType($tags, "\\ArrayObject");
227:         return $this->_withTags($tags);
228:     }
229:     
230:     /**
231:      * 指定したDNFに合致するタグを持つリソースに絞り込みます。
232:      * 
233:      * @todo Implement test case
234:      * @access public
235:      * @param string[][] $dnf
236:      * @return \Saklient\Cloud\Models\Model_Server
237:      */
238:     public function withTagDnf($dnf)
239:     {
240:         Util::validateArgCount(func_num_args(), 1);
241:         Util::validateType($dnf, "\\ArrayObject");
242:         return $this->_withTagDnf($dnf);
243:     }
244:     
245:     /**
246:      * 名前でソートします。
247:      * 
248:      * @todo Implement test case
249:      * @access public
250:      * @param boolean $reverse=false
251:      * @return \Saklient\Cloud\Models\Model_Server
252:      */
253:     public function sortByName($reverse=false)
254:     {
255:         Util::validateType($reverse, "boolean");
256:         return $this->_sortByName($reverse);
257:     }
258:     
259:     /**
260:      * @ignore
261:      * @access public
262:      * @param \Saklient\Cloud\Client $client
263:      */
264:     public function __construct(\Saklient\Cloud\Client $client)
265:     {
266:         parent::__construct($client);
267:         Util::validateArgCount(func_num_args(), 1);
268:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
269:     }
270:     
271:     /**
272:      * 指定したプランのサーバに絞り込みます。
273:      * 
274:      * @access public
275:      * @param \Saklient\Cloud\Resources\ServerPlan $plan
276:      * @return \Saklient\Cloud\Models\Model_Server
277:      */
278:     public function withPlan(\Saklient\Cloud\Resources\ServerPlan $plan)
279:     {
280:         Util::validateArgCount(func_num_args(), 1);
281:         Util::validateType($plan, "\\Saklient\\Cloud\\Resources\\ServerPlan");
282:         $this->_filterBy("ServerPlan.ID", new \ArrayObject([$plan->_id()]));
283:         return $this;
284:     }
285:     
286:     /**
287:      * インスタンスが指定した状態にあるサーバに絞り込みます。
288:      * 
289:      * @access public
290:      * @param string $status
291:      * @return \Saklient\Cloud\Models\Model_Server
292:      */
293:     public function withStatus($status)
294:     {
295:         Util::validateArgCount(func_num_args(), 1);
296:         Util::validateType($status, "string");
297:         $this->_filterBy("Instance.Status", new \ArrayObject([$status]));
298:         return $this;
299:     }
300:     
301:     /**
302:      * インスタンスが起動中のサーバに絞り込みます。
303:      * 
304:      * @access public
305:      * @return \Saklient\Cloud\Models\Model_Server
306:      */
307:     public function withStatusUp()
308:     {
309:         return $this->withStatus(EServerInstanceStatus::up);
310:     }
311:     
312:     /**
313:      * インスタンスが停止中のサーバに絞り込みます。
314:      * 
315:      * @access public
316:      * @return \Saklient\Cloud\Models\Model_Server
317:      */
318:     public function withStatusDown()
319:     {
320:         return $this->withStatus(EServerInstanceStatus::down);
321:     }
322:     
323:     /**
324:      * 指定したISOイメージが挿入されているサーバに絞り込みます。
325:      * 
326:      * @access public
327:      * @param \Saklient\Cloud\Resources\IsoImage $iso
328:      * @return \Saklient\Cloud\Models\Model_Server
329:      */
330:     public function withIsoImage(\Saklient\Cloud\Resources\IsoImage $iso)
331:     {
332:         Util::validateArgCount(func_num_args(), 1);
333:         Util::validateType($iso, "\\Saklient\\Cloud\\Resources\\IsoImage");
334:         $this->_filterBy("Instance.CDROM.ID", new \ArrayObject([$iso->_id()]));
335:         return $this;
336:     }
337:     
338:     /**
339:      * 仮想コア数でソートします。
340:      * 
341:      * @access public
342:      * @param boolean $reverse=false
343:      * @return \Saklient\Cloud\Models\Model_Server
344:      */
345:     public function sortByCpu($reverse=false)
346:     {
347:         Util::validateType($reverse, "boolean");
348:         $this->_sort("ServerPlan.CPU", $reverse);
349:         return $this;
350:     }
351:     
352:     /**
353:      * メモリ容量でソートします。
354:      * 
355:      * @access public
356:      * @param boolean $reverse=false
357:      * @return \Saklient\Cloud\Models\Model_Server
358:      */
359:     public function sortByMemory($reverse=false)
360:     {
361:         Util::validateType($reverse, "boolean");
362:         $this->_sort("ServerPlan.MemoryMB", $reverse);
363:         return $this;
364:     }
365:     
366:     
367: 
368: }
369: 
370: 
API documentation generated by ApiGen 2.8.0