Overview

Namespaces

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

Classes

  • API
  • Facility
  • Product
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Saklient\Cloud;
  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/Product.php";
 10: use \Saklient\Cloud\Product;
 11: require_once __DIR__ . "/../../Saklient/Cloud/Facility.php";
 12: use \Saklient\Cloud\Facility;
 13: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Icon.php";
 14: use \Saklient\Cloud\Models\Model_Icon;
 15: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Server.php";
 16: use \Saklient\Cloud\Models\Model_Server;
 17: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Disk.php";
 18: use \Saklient\Cloud\Models\Model_Disk;
 19: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Appliance.php";
 20: use \Saklient\Cloud\Models\Model_Appliance;
 21: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Archive.php";
 22: use \Saklient\Cloud\Models\Model_Archive;
 23: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_IsoImage.php";
 24: use \Saklient\Cloud\Models\Model_IsoImage;
 25: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Iface.php";
 26: use \Saklient\Cloud\Models\Model_Iface;
 27: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Swytch.php";
 28: use \Saklient\Cloud\Models\Model_Swytch;
 29: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Router.php";
 30: use \Saklient\Cloud\Models\Model_Router;
 31: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Bridge.php";
 32: use \Saklient\Cloud\Models\Model_Bridge;
 33: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Ipv6Net.php";
 34: use \Saklient\Cloud\Models\Model_Ipv6Net;
 35: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_Script.php";
 36: use \Saklient\Cloud\Models\Model_Script;
 37: require_once __DIR__ . "/../../Saklient/Cloud/Models/Model_License.php";
 38: use \Saklient\Cloud\Models\Model_License;
 39: require_once __DIR__ . "/../../Saklient/Errors/SaklientException.php";
 40: use \Saklient\Errors\SaklientException;
 41: 
 42: /**
 43:  * さくらのクラウドAPIクライアントを利用する際、最初にアクセスすべきルートとなるクラス。
 44:  * 
 45:  * @see API.authorize
 46:  * @property-read \Saklient\Cloud\Product $product 商品情報にアクセスするためのモデルを集めたオブジェクト。 
 47:  * @property-read \Saklient\Cloud\Facility $facility 設備情報にアクセスするためのモデルを集めたオブジェクト。 
 48:  * @property-read \Saklient\Cloud\Models\Model_Icon $icon アイコンにアクセスするためのモデル。 
 49:  * @property-read \Saklient\Cloud\Models\Model_Server $server サーバにアクセスするためのモデル。 
 50:  * @property-read \Saklient\Cloud\Models\Model_Disk $disk ディスクにアクセスするためのモデル。 
 51:  * @property-read \Saklient\Cloud\Models\Model_Appliance $appliance アプライアンスにアクセスするためのモデル。 
 52:  * @property-read \Saklient\Cloud\Models\Model_Archive $archive アーカイブにアクセスするためのモデル。 
 53:  * @property-read \Saklient\Cloud\Models\Model_IsoImage $isoImage ISOイメージにアクセスするためのモデル。 
 54:  * @property-read \Saklient\Cloud\Models\Model_Iface $iface インタフェースにアクセスするためのモデル。 
 55:  * @property-read \Saklient\Cloud\Models\Model_Swytch $swytch スイッチにアクセスするためのモデル。 
 56:  * @property-read \Saklient\Cloud\Models\Model_Router $router ルータにアクセスするためのモデル。 
 57:  * @property-read \Saklient\Cloud\Models\Model_Bridge $bridge ブリッジにアクセスするためのモデル。 
 58:  * @property-read \Saklient\Cloud\Models\Model_Ipv6Net $ipv6Net IPv6ネットワークにアクセスするためのモデル。 
 59:  * @property-read \Saklient\Cloud\Models\Model_Script $script スクリプトにアクセスするためのモデル。 
 60:  * @property-read \Saklient\Cloud\Models\Model_License $license ライセンスにアクセスするためのモデル。 
 61:  */
 62: class API {
 63:     
 64:     /**
 65:      * @private
 66:      * @access protected
 67:      * @ignore
 68:      * @var Client
 69:      */
 70:     protected $_client;
 71:     
 72:     /**
 73:      * @access protected
 74:      * @ignore
 75:      * @return \Saklient\Cloud\Client
 76:      */
 77:     protected function get_client()
 78:     {
 79:         return $this->_client;
 80:     }
 81:     
 82:     
 83:     
 84:     /**
 85:      * @private
 86:      * @access protected
 87:      * @ignore
 88:      * @var Product
 89:      */
 90:     protected $_product;
 91:     
 92:     /**
 93:      * @access protected
 94:      * @ignore
 95:      * @return \Saklient\Cloud\Product
 96:      */
 97:     protected function get_product()
 98:     {
 99:         return $this->_product;
100:     }
101:     
102:     
103:     
104:     /**
105:      * @private
106:      * @access protected
107:      * @ignore
108:      * @var Facility
109:      */
110:     protected $_facility;
111:     
112:     /**
113:      * @access protected
114:      * @ignore
115:      * @return \Saklient\Cloud\Facility
116:      */
117:     protected function get_facility()
118:     {
119:         return $this->_facility;
120:     }
121:     
122:     
123:     
124:     /**
125:      * @private
126:      * @access protected
127:      * @ignore
128:      * @var Model_Icon
129:      */
130:     protected $_icon;
131:     
132:     /**
133:      * @access protected
134:      * @ignore
135:      * @return \Saklient\Cloud\Models\Model_Icon
136:      */
137:     protected function get_icon()
138:     {
139:         return $this->_icon;
140:     }
141:     
142:     
143:     
144:     /**
145:      * @private
146:      * @access protected
147:      * @ignore
148:      * @var Model_Server
149:      */
150:     protected $_server;
151:     
152:     /**
153:      * @access protected
154:      * @ignore
155:      * @return \Saklient\Cloud\Models\Model_Server
156:      */
157:     protected function get_server()
158:     {
159:         return $this->_server;
160:     }
161:     
162:     
163:     
164:     /**
165:      * @private
166:      * @access protected
167:      * @ignore
168:      * @var Model_Disk
169:      */
170:     protected $_disk;
171:     
172:     /**
173:      * @access protected
174:      * @ignore
175:      * @return \Saklient\Cloud\Models\Model_Disk
176:      */
177:     protected function get_disk()
178:     {
179:         return $this->_disk;
180:     }
181:     
182:     
183:     
184:     /**
185:      * @private
186:      * @access protected
187:      * @ignore
188:      * @var Model_Appliance
189:      */
190:     protected $_appliance;
191:     
192:     /**
193:      * @access protected
194:      * @ignore
195:      * @return \Saklient\Cloud\Models\Model_Appliance
196:      */
197:     protected function get_appliance()
198:     {
199:         return $this->_appliance;
200:     }
201:     
202:     
203:     
204:     /**
205:      * @private
206:      * @access protected
207:      * @ignore
208:      * @var Model_Archive
209:      */
210:     protected $_archive;
211:     
212:     /**
213:      * @access protected
214:      * @ignore
215:      * @return \Saklient\Cloud\Models\Model_Archive
216:      */
217:     protected function get_archive()
218:     {
219:         return $this->_archive;
220:     }
221:     
222:     
223:     
224:     /**
225:      * @private
226:      * @access protected
227:      * @ignore
228:      * @var Model_IsoImage
229:      */
230:     protected $_isoImage;
231:     
232:     /**
233:      * @access protected
234:      * @ignore
235:      * @return \Saklient\Cloud\Models\Model_IsoImage
236:      */
237:     protected function get_isoImage()
238:     {
239:         return $this->_isoImage;
240:     }
241:     
242:     
243:     
244:     /**
245:      * @private
246:      * @access protected
247:      * @ignore
248:      * @var Model_Iface
249:      */
250:     protected $_iface;
251:     
252:     /**
253:      * @access protected
254:      * @ignore
255:      * @return \Saklient\Cloud\Models\Model_Iface
256:      */
257:     protected function get_iface()
258:     {
259:         return $this->_iface;
260:     }
261:     
262:     
263:     
264:     /**
265:      * @private
266:      * @access protected
267:      * @ignore
268:      * @var Model_Swytch
269:      */
270:     protected $_swytch;
271:     
272:     /**
273:      * @access protected
274:      * @ignore
275:      * @return \Saklient\Cloud\Models\Model_Swytch
276:      */
277:     protected function get_swytch()
278:     {
279:         return $this->_swytch;
280:     }
281:     
282:     
283:     
284:     /**
285:      * @private
286:      * @access protected
287:      * @ignore
288:      * @var Model_Router
289:      */
290:     protected $_router;
291:     
292:     /**
293:      * @access protected
294:      * @ignore
295:      * @return \Saklient\Cloud\Models\Model_Router
296:      */
297:     protected function get_router()
298:     {
299:         return $this->_router;
300:     }
301:     
302:     
303:     
304:     /**
305:      * @private
306:      * @access protected
307:      * @ignore
308:      * @var Model_Bridge
309:      */
310:     protected $_bridge;
311:     
312:     /**
313:      * @access protected
314:      * @ignore
315:      * @return \Saklient\Cloud\Models\Model_Bridge
316:      */
317:     protected function get_bridge()
318:     {
319:         return $this->_bridge;
320:     }
321:     
322:     
323:     
324:     /**
325:      * @private
326:      * @access protected
327:      * @ignore
328:      * @var Model_Ipv6Net
329:      */
330:     protected $_ipv6Net;
331:     
332:     /**
333:      * @access protected
334:      * @ignore
335:      * @return \Saklient\Cloud\Models\Model_Ipv6Net
336:      */
337:     protected function get_ipv6Net()
338:     {
339:         return $this->_ipv6Net;
340:     }
341:     
342:     
343:     
344:     /**
345:      * @private
346:      * @access protected
347:      * @ignore
348:      * @var Model_Script
349:      */
350:     protected $_script;
351:     
352:     /**
353:      * @access protected
354:      * @ignore
355:      * @return \Saklient\Cloud\Models\Model_Script
356:      */
357:     protected function get_script()
358:     {
359:         return $this->_script;
360:     }
361:     
362:     
363:     
364:     /**
365:      * @private
366:      * @access protected
367:      * @ignore
368:      * @var Model_License
369:      */
370:     protected $_license;
371:     
372:     /**
373:      * @access protected
374:      * @ignore
375:      * @return \Saklient\Cloud\Models\Model_License
376:      */
377:     protected function get_license()
378:     {
379:         return $this->_license;
380:     }
381:     
382:     
383:     
384:     /**
385:      * @ignore
386:      * @access protected
387:      * @param \Saklient\Cloud\Client $client
388:      */
389:     protected function __construct(\Saklient\Cloud\Client $client)
390:     {
391:         Util::validateArgCount(func_num_args(), 1);
392:         Util::validateType($client, "\\Saklient\\Cloud\\Client");
393:         $this->_client = $client;
394:         $this->_product = new Product($client);
395:         $this->_facility = new Facility($client);
396:         $this->_icon = new Model_Icon($client);
397:         $this->_server = new Model_Server($client);
398:         $this->_disk = new Model_Disk($client);
399:         $this->_appliance = new Model_Appliance($client);
400:         $this->_archive = new Model_Archive($client);
401:         $this->_isoImage = new Model_IsoImage($client);
402:         $this->_iface = new Model_Iface($client);
403:         $this->_swytch = new Model_Swytch($client);
404:         $this->_router = new Model_Router($client);
405:         $this->_bridge = new Model_Bridge($client);
406:         $this->_ipv6Net = new Model_Ipv6Net($client);
407:         $this->_script = new Model_Script($client);
408:         $this->_license = new Model_License($client);
409:     }
410:     
411:     /**
412:      * 指定した認証情報を用いてアクセスを行うAPIクライアントを作成します。
413:      * 
414:      * 必要な認証情報は、コントロールパネル右上にあるアカウントのプルダウンから
415:      * 「設定」を選択し、「APIキー」のページにて作成できます。
416:      * 
417:      * @access public
418:      * @param string $token ACCESS TOKEN
419:      * @param string $secret ACCESS TOKEN SECRET
420:      * @param string $zone=null ゾーン名
421:      * @return \Saklient\Cloud\API APIクライアント
422:      */
423:     static public function authorize($token, $secret, $zone=null)
424:     {
425:         Util::validateArgCount(func_num_args(), 2);
426:         Util::validateType($token, "string");
427:         Util::validateType($secret, "string");
428:         Util::validateType($zone, "string");
429:         $c = new Client($token, $secret);
430:         $ret = new API($c);
431:         return $zone != null ? $ret->inZone($zone) : $ret;
432:     }
433:     
434:     /**
435:      * 認証情報を引き継ぎ、指定したゾーンへのアクセスを行うAPIクライアントを作成します。
436:      * 
437:      * @access public
438:      * @param string $name ゾーン名
439:      * @return \Saklient\Cloud\API APIクライアント
440:      */
441:     public function inZone($name)
442:     {
443:         Util::validateArgCount(func_num_args(), 1);
444:         Util::validateType($name, "string");
445:         $ret = new API($this->_client->cloneInstance());
446:         $suffix = "";
447:         if ($name == "is1x" || $name == "is1y") {
448:             $suffix = "-test";
449:         }
450:         $ret->_client->setApiRoot("https://secure.sakura.ad.jp/cloud" . $suffix . "/");
451:         $ret->_client->setApiRootSuffix("zone/" . $name);
452:         return $ret;
453:     }
454:     
455:     /**
456:      * @ignore
457:      */
458:     public function __get($key) {
459:         switch ($key) {
460:             case "client": return $this->get_client();
461:             case "product": return $this->get_product();
462:             case "facility": return $this->get_facility();
463:             case "icon": return $this->get_icon();
464:             case "server": return $this->get_server();
465:             case "disk": return $this->get_disk();
466:             case "appliance": return $this->get_appliance();
467:             case "archive": return $this->get_archive();
468:             case "isoImage": return $this->get_isoImage();
469:             case "iface": return $this->get_iface();
470:             case "swytch": return $this->get_swytch();
471:             case "router": return $this->get_router();
472:             case "bridge": return $this->get_bridge();
473:             case "ipv6Net": return $this->get_ipv6Net();
474:             case "script": return $this->get_script();
475:             case "license": return $this->get_license();
476:             default: return null;
477:         }
478:     }
479: 
480: }
481: 
482: 
API documentation generated by ApiGen 2.8.0