CSharp-Cloudfiles ignores Cloudversion for unspecified AccountName

While building a demo app on Internap’s XIPCloud, I saw unexpected URLs sent by the CSharp-Cloudfiles library.  I changed the code to pass “v1.0” via the Cloudversion argument of UserCredential’s constructor (which is a questionable location in the first place).  Fiddler showed that the URL didn’t change at all.  Regardless of passing is a valid value (e.g., “v1.0”) for the Cloudversion argument or just an empty string, the resulting header always looks like:

GET https://auth.storage.santa-clara.internapcloudl.net/ HTTP/1.1

Why isn’t the Cloudversion appended?  By grokking thru com.mosso.cloudfiles.domain.request.GetAuthentication I found this code:

var uri = string.IsNullOrEmpty(_userCredentials.AccountName) ? _userCredentials.AuthUrl : new Uri(_userCredentials.AuthUrl + “/”
+ _userCredentials.Cloudversion.Encode() + “/”      + _userCredentials.AccountName.Encode() + “/auth”);

This code only includes the provided Cloudversion value when a valid AccountName has also been provided. These values seem orthogonal to me; the resulting URL should include the Cloudversion appropriately when is is provided. Since there don’t seem to be multiple cloud versions available, nor accounts available, it’s not currently a huge problem. But it’s going to bite someone eventually.

How-To: Connecting to Internap’s XIPCloud

I didn’t find straight-forward instructions for using .NET with XIPCloud on Internap’s portal, so I’ll pass along what I learned.  This article assumes you are using Visual Studio 2010 and that you have already acquired an Internap account for XIPCloud.

Step-by-Step

  1. Acquire & Build OpenStack C# SDK
  1. Download the Rackspace C# library for OpenStack. Go to the Rackspace / csharp-cloud page on GitHub, push the Downloads button and click on the zip file to download (this article is based on csharp-cloudfiles-1.5.0.0)
  2. Extract the zip files into your preferred location (where you typically keep external or 3rd party code or assemblies)
  3. Using Visual Studio open the solution file, com.mosso.cloudfiles.sln, from the extracted files location.
  4. Build the solution – I batch built all configs.  Assuming the builds completed successfully, you now have the OpenStack C# assemblies in <Sln file location>csharp-cloudfiles-1.5.0.0com.mosso.cloudfilesbin[Debug|Release]
  5. Close the solution
  1. Create A OpenStack Client Application
    1. Create a new .NET application – this article uses a C# console application.
    2. Right-click the References folder under your new project and select Add Reference…
    3. Push the Browse button, navigate to the csharp-cloudfiles assemblies (see #4 above), select com.mosso.cloudfiles.dll and log4net.dll, push the Add button and then Close
    4. Now, change Program.cs to:

using System;

using com.mosso.cloudfiles;

using com.mosso.cloudfiles.domain;

namespace XIPCloudDemo

{

class Program

{

static void Main(string[] args)

{

Uri uriAuth = new Uri(“https://auth.storage.santa-clara.internapcloud.net/v1.0”);

string userName = “<your user name goes here>”;

string apiKey = “<your user password goes here>”;

UserCredentials userCreds = new UserCredentials(uriAuth, userName, apiKey, string.Empty, string.Empty);

Connection connection = new Connection(userCreds);

/* Add more code here.  For example, to create a container and copy a file to it…

connection.CreateContainer(containerName);

connection.PutStorageItem(containerName, localFilePath);

*/

}

}

}

Now you’re ready to build and run your app!  If you have trouble, use Fiddler to diagnose what’s going across in requests, headers, responses, etc.

Somewhere on Internap’s portal or in the developer guide I found the note about using your portal username (email address) and password for X-Auth-User and X-Auth-Key.  Hopefully they’ll provide actual API keys like all the other storage providers do.

I hope this helped you get started.  Feel free to leave a comment if you have any questions.

Internap Launches XIPCloud beta

In the news today: Internap announced its cloud storage offering, XIPCloud™.  As per the announcement, the advantages are:

  1. “High performance” due to their own “patented Managed Internet Route Optimizer™ (MIRO) technology.”  The announcement was not clear, however, on how this improves performance.
  2. “Open” due to leveraging OpenStack.org

They also list “Available” and “Secure” as advantages, yet these do not distinguish them from other cloud storage providers.

So, what’s the best feature of XIPCloud?  It’s really inexpensive – well, for a little while.  During the beta period (currently through July 31, 2011), XIPCloud costs just a penny / GB / month for storage space and egress.  Wow! 1 TB of storage for just $10.24 / month! Their pricing page indicates that storage space and egress bandwidth are each just $0.01 /GB/m; ingress bandwidth is free.  Pretty good if you don’t mind working with OpenStack’s Swift.

They also show that CDN egress pricing will be just a penny / GB / month during beta, but the disclaimer is “Pricing for CDN dependent on availability of new feature.”  So, when (and if) CDN becomes available, you’ll get cheap egress there, too, until 7/31/11.