/** * Creates a new Server object and associates it with a Compute service * * @param mixed $info * * If NULL, an empty Server object is created * * If an object, then a Server object is created from the data in the * object * * If a string, then it's treated as a Server ID and retrieved from the * service * The normal use case for SDK clients is to treat it as either NULL or an * ID. The object value parameter is a special case used to construct * a Server object from a ServerList element to avoid a secondary * call to the Service. * @throws ServerNotFound if a 404 is returned * @throws UnknownError if another error status is reported */ public function __construct(\OpenCloud\Compute $service, $info = NULL) { // make the service persistent parent::__construct($service, $info); // the metadata item is an object, not an array $this->metadata = $this->Metadata(); }
/** * Deletes an isolated network * * @api * @return \OpenCloud\HttpResponse * @throws NetworkDeleteError if HTTP status is not Success */ public function Delete() { switch ($this->id) { case RAX_PUBLIC: case RAX_PRIVATE: throw new \OpenCloud\DeleteError(_('Network may not be deleted')); default: return parent::Delete(); } }
/** * Creates a new instance object * * This could use the default constructor, but we want to make sure that * the volume attribute is an object. * * @param \OpenCloud\DbService $service the DbService object associated * with this * @param mixed $info the ID or array of info for the object */ public function __construct(\OpenCloud\DbService $service, $info = NULL) { $this->volume = new \stdClass(); return parent::__construct($service, $info); }
/** * builds a new Node object * * @param LoadBalancer $lb the parent LB object * @param mixed $info either an ID or an array of values * @returns void */ public function __construct(LoadBalancer $lb, $info = NULL) { $this->_lb = $lb; parent::__construct($lb->Service(), $info); }
/** * 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); }