OpenStack .NET SDK Released

openstack-cloud-software-vertical-small.png

The OpenStack .NET SDK team is pleased to announce its first public release with this 0.9.1 version release, which includes support for the Swift storage service. The team firmly believes in an iterative development approach, I can’t wait to show you what we have up our sleves!

The SDK is compatible with OpenStack, DevStack, and with minor modifications can support the HP Helion Public Cloud. The single Nuget SDK package includes binaries for both .NET 4.0 and 4.5 frameworks. The 4.5 binary has been built as a Portable Class Library and can be used to build applications for Microsoft Store and Windows Phone. The SDK can also be consumed by Xamarin Studio and used in cross-platform and mobile applications, including iOS and Mac Store apps.

 

Enough already! Show me how use it!!

At the core of the SDK is the OpenStackClient class. The client can be used to connect to an instance of OpenStack, and to create clients that can be used to interact with services that are enabled, or present on the OpenStack instance. Before the OpenStackClient can connect, it will need some credentials.

 

var authUri = new Uri("https://region.identity.host.com:12345/v2.0");

var userName = "user name";

var password = "password";

var tenantId = "XXXXXXXXXXXXXX-Project";

 

var credential = new OpenStackCredential(authUri, userName, password, tenantId);

var client = OpenStackClientFactory.CreateClient(credential);

 

First you will need to supply the public Keystone/Identity endpoint for the OpenStack instance. From here, you'll supply the user name, password, and tenant id. After the credentials have been created, you can use the OpenStackClientFactory to create a new OpenStackClient object to interact with. Once you have a client, you'll want to connect it to the OpenStack instance.

await client.Connect();

 

When this call is made, the client will take the credentials it was given and attempt to authenticate with the OpenStack instance. After it has successfully authenticated, the client can be used to create service clients that give you access to supported OpenStack services (i.e. Swift, Nova, Neutron, etc).

 

var storageServiceClient = client.CreateServiceClient<IStorageServiceClient>();

 

Currently the SDK support two services: Identity and Storage. The Identity client only supports authentication, but may be expanded in the near future. The Storage client supports working with containers, objects, and folders. It also has limited support for accounts. The call above will return a client that can be used to interact with the storage service.

 

var storageAccount = await storageServiceClient.GetStorageAccount();

foreach(var container in storageAccount.Containers)

{

    Console.WriteLine(container.Name);

}

 

Start by asking the storage client for the current storage account. The class that is returned can then be used to list out all of the containers in the account.

This is a very basic introduction to the OpenStack .NET SDK. More information can be found on the OpenStack projects wiki  while additional examples and a complete source code listing can be found on the StackForge repository.  The OpenStack .NET SDK project is just getting started, so your feedback is important!  Report bugs and add feature requests on the project’s Launchpad page. The team is excited to see what cool and amazing projects we can enable, so be creative, and start developing!

Labels: HP cloud
Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
Showing results for 
Search instead for 
Do you mean 
About the Author
Featured


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.