public function __construct(Instance $instance, $info = null)
 {
     $this->setParent($instance);
     // Catering for laziness
     if (is_string($info)) {
         $info = array('name' => $info);
     }
     return parent::__construct($instance->getService(), $info);
 }
Example #2
0
 /**
  * Creates a new database object
  *
  * Unlike other objects (Servers, DataObjects, etc.), passing a database
  * name to the constructor does *not* pull information from the database.
  * For example, if you pass an ID to the `Server()` constructor, it will
  * attempt to retrieve the information on that server from the service,
  * and will return an error if it is not found. However, the Cloud
  * Users service does not permit retrieval of information on
  * individual databases (only via Collection), and thus passing in a
  * name via the `$info` parameter only creates an in-memory object that
  * is not necessarily tied to an actual database.
  *
  * @param Instance $instance the parent DbService\Instance of the database
  * @param mixed    $info     if an array or object, treated as properties to set;
  *                           if a string, treated as the database name
  * @param array    $db       a list of database names to associate with the User
  * @return void
  * @throws UserNameError if `$info` is not a string, object, or array
  */
 public function __construct(Instance $instance, $info = null, $db = array())
 {
     $this->setParent($instance);
     if (!empty($db)) {
         $this->databases = $db;
     }
     // Lazy...
     if (is_string($info)) {
         $info = array('name' => $info);
     }
     return parent::__construct($instance->getService(), $info);
 }
Example #3
0
 /**
  * Creates a new isolated Network object
  *
  * NOTE: contains hacks to recognize the Rackspace public and private
  * networks. These are not really networks, but they show up in lists.
  *
  * @param \OpenCloud\Compute\Service $service The compute service associated with
  *                                            the network
  * @param string|null                $id      The ID of the network (this handles the pseudo-networks
  *                                            Network::RAX_PUBLIC and Network::RAX_PRIVATE
  * @return Network
  */
 public function __construct(Service $service, $id = null)
 {
     $this->id = $id;
     switch ($id) {
         case NetworkConst::RAX_PUBLIC:
             $this->label = 'public';
             $this->cidr = 'NA';
             break;
         case NetworkConst::RAX_PRIVATE:
             $this->label = 'private';
             $this->cidr = 'NA';
             break;
         default:
             return parent::__construct($service, $id);
     }
     return;
 }
Example #4
0
 public function __construct(Service $service, $info = null)
 {
     $this->instance = new \stdClass();
     return parent::__construct($service, $info);
 }