diff -r 877f952ae2bd -r 6b6c2214f778 web/lib/Zend/Service/Rackspace/Servers/SharedIpGroup.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Service/Rackspace/Servers/SharedIpGroup.php Thu Mar 21 19:52:38 2013 +0100 @@ -0,0 +1,165 @@ +service= $service; + $this->name = $data['name']; + $this->id = $data['id']; + if (isset($data['servers'])) { + $this->serversId= $data['servers']; + } + } + /** + * Get the name of the shared IP group + * + * @return string + */ + public function getName() + { + return $this->name; + } + /** + * Get the id of the shared IP group + * + * @return string + */ + public function getId() + { + return $this->id; + } + /** + * Get the server's array of the shared IP group + * + * @return string + */ + public function getServersId() + { + if (empty($this->serversId)) { + $info= $this->service->getSharedIpGroup($this->id); + if (($info!==false)) { + $info= $info->toArray(); + if (isset($info['servers'])) { + $this->serversId= $info['servers']; + } + } + } + return $this->serversId; + } + /** + * Get the server + * + * @param integer $id + * @return Zend_Service_Rackspace_Servers_Server|boolean + */ + public function getServer($id) + { + if (empty($this->serversId)) { + $this->getServersId(); + } + if (in_array($id,$this->serversId)) { + return $this->service->getServer($id); + } + return false; + } + /** + * Create a server in the shared Ip Group + * + * @param array $data + * @param array $metadata + * @param array $files + * @return Zend_Service_Rackspace_Servers_Server|boolean + */ + public function createServer(array $data, $metadata=array(),$files=array()) + { + $data['sharedIpGroupId']= (integer) $this->id; + return $this->service->createServer($data,$metadata,$files); + } + /** + * To Array + * + * @return array + */ + public function toArray() + { + return array ( + 'name' => $this->name, + 'id' => $this->id, + 'servers' => $this->serversId + ); + } +} \ No newline at end of file