Example #1
0
 /**
  * Returns a Collection of server objects, filtered by the specified
  * parameters
  *
  * This is a factory method and should normally be called instead of
  * creating a ServerList object directly.
  *
  * @api
  * @param boolean $details - if TRUE, full server details are returned; if
  *      FALSE, just the minimal set of info is listed. Defaults to TRUE;
  *      you might set this to FALSE to improve performance at the risk of
  *      not having all the information you need.
  * @param array $filter - a set of key/value pairs that is passed to the
  *    servers list for filtering
  * @returns Collection
  */
 public function ServerList($details = TRUE, $filter = array())
 {
     if (!is_bool($details)) {
         throw new Exceptions\InvalidArgumentException(Lang::translate('First argument for Compute::ServerList() must be boolean'));
     }
     if (!is_array($filter)) {
         throw new Exceptions\InvalidArgumentException(Lang::translate('Second argument for Compute::ServerList() must be array'));
     }
     if ($details) {
         $url = $this->Url(Server::ResourceName() . '/detail', $filter);
     } else {
         $url = $this->Url(Server::ResourceName(), $filter);
     }
     return $this->Collection('\\OpenCloud\\Compute\\Server', $url);
 }
Example #2
0
 /**
  * returns a Collection of PTR records for a given Server
  *
  * @param \OpenCloud\Compute\Server $server the server for which to
  *      retrieve the PTR records
  * @return Collection
  */
 public function ptrRecordList(Server $server)
 {
     $url = $this->url('rdns/' . $server->getService()->name(), array('href' => $server->url()));
     return $this->collection('\\OpenCloud\\DNS\\PtrRecord', $url);
 }
Example #3
0
 /**
  * Returns a Collection of server objects, filtered by the specified
  * parameters
  *
  * This is a factory method and should normally be called instead of
  * creating a ServerList object directly.
  *
  * @api
  * @param boolean $details - if TRUE, full server details are returned; if
  *      FALSE, just the minimal set of info is listed. Defaults to TRUE;
  *      you might set this to FALSE to improve performance at the risk of
  *      not having all the information you need.
  * @param array $filter - a set of key/value pairs that is passed to the
  *    servers list for filtering
  * @returns Collection
  */
 public function serverList($details = true, array $filter = array())
 {
     $url = $this->url(Server::resourceName() . ($details ? '/detail' : ''), $filter);
     return $this->collection('OpenCloud\\Compute\\Server', $url);
 }
Example #4
0
 /**
  * returns a Collection of PTR records for a given Server
  *
  * @param \OpenCloud\Compute\Server $server the server for which to
  *      retrieve the PTR records
  * @return Collection
  */
 public function PtrRecordList(Server $server)
 {
     $service_name = $server->Service()->Name();
     $url = $this->Url('rdns/' . $service_name) . '?' . $this->MakeQueryString(array('href' => $server->Url()));
     return $this->Collection('\\OpenCloud\\DNS\\PtrRecord', $url);
 }
Example #5
0
 public function CreateJson($x = 'server')
 {
     return parent::CreateJson($x);
 }
Example #6
0
 /**
  * creates the object
  *
  * This overrides the default constructor so that we can save off the
  * server to which this attachment is associated.
  */
 public function __construct(Server $server, $id = null)
 {
     $this->_server = $server;
     return parent::__construct($server->Service(), $id);
 }