RackSpace Cloud Server Client Library for PHP

15 thoughts on “RackSpace Cloud Server Client Library for PHP”

  1. I too am working on a Rackspace Cloud (specifically, Servers, right now) API, you can see it at:

    http://github.com/dshafik/rackspace-cloud-api/

    It uses Zend_Http_Client, and seems (to me) a little friendlier in handling errors with exceptions and such. You might care to take a look πŸ™‚

    Also, I chose not to hard-code in the flavors etc as they will change with time.

    Mine is perfect for those wishing to write a UI for handling the provisioning and management of cloud servers.

    I haven’t gotten resizing of instances, nor shared IP groups finished, but I believe everything else is there.

    – Davey

  2. Thanks Everyone

    Hi Davey
    I’ve tried to keep it as simple as possible. Your one is very structured, nice work.

    I’ve added support to all available methods supported by RS so far. And I’ve used Curl for making the POST/GET/DELETE requests. And used built in json parser.

    Other than that there is no external dependency.

    Thanks again for your comment.

  3. Have a patch to support switching between UK and US… backwards compat, just call setAuthUrl() if you need to change to the UK servers…

    I have to admit, I like this a lot, it is clean and allowed this patch in less than 5 minutes… πŸ™‚
    Username=$Username;
    $this->APIKey= $APIKey;
    $this->AuthUrl= “https://auth.api.rackspacecloud.com/v1.0”; //set default to US
    }

    public function setAuthUrl($url) {
    $this->AuthUrl = $url;
    }

    public function auth()
    {

    if(!$this->Username || !$this->APIKey)
    throw new Exception(‘Username or Password cannot be empty’);

    $Response = Request::post($this->AuthUrl,array(“X-Auth-User”=>$this->Username, “X-Auth-Key”=>$this->APIKey),null,true);
    $Headers = Request::parseHeaders($Response);
    print_r($Headers);
    if($Headers)
    {
    $this->XAuthToken = $Headers[‘X-Auth-Token’];
    $this->XStorageToken= $Headers[‘X-Storage-Token’];
    $this->XStorageUrl = $Headers[“X-Storage-Url”];
    $this->XServerManagementUrl = $Headers[‘X-Server-Management-Url’];
    $this->XCDNManagementUrl = $Headers[‘X-CDN-Management-Url’];
    return true;
    }

    }

    function getXAuthToken()
    {
    return $this->XAuthToken;
    }

    function setXAuthToken($AuthToken)
    {
    $this->XAuthToken=$AuthToken;
    }

    function getXStorageUrl()
    {
    return $this->XStorageUrl;
    }
    function setXStorageUrl($Url)
    {
    $this->XStorageUrl = $Url;
    }

    function getXStorageToken()
    {
    return $this->XStorageToken;
    }

    function setXStorageToken($Url)
    {
    $this->XStorageToken=$Url;
    }

    function getXCDNManagementUrl()
    {
    return $this->XCDNManagementUrl;
    }

    function setXCDNManagementUrl($Url)
    {
    $this->XCDNManagementUrl=$Url;
    }

    function getXServerManagementUrl()
    {
    return $this->XServerManagementUrl;
    }

    function setXServerManagementUrl($Url)
    {
    $this->XServerManagementUrl=$Url;
    }

    function getUsername()
    {
    return $this->Username;
    }

    function setUsername($Username)
    {
    $this->Username=$Username;
    }

    function getAPIKey()
    {
    return $this->APIKey;
    }

    function setAPIKey($APIKey)
    {
    $this->APIKey=$APIKey;
    }
    }

    ?>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s