Skip to content

Rackspace Cloud Files Code Samples

jasonmitschke edited this page Apr 12, 2013 · 2 revisions

CloudFilesProvider Samples

Here we will provide samples for basic operation on CloudFilesProvider.

CloudFilesProvider requires we pass in CloudIdentity. We can create CloudIdentity by passing any 2 combination. Username/Password or Username/APIKey.

var cloudIdentity = new CloudIdentity() { Username = "username", Password = "password" }; or var cloudIdentity = new CloudIdentity() { APIKey = "apikey", Username = "username" };

For more information on IdentityProvider

There are 2 ways to pass in the identity credentials to CloudFilesProvider:

  1. In the constructor.

  2. Into each method individually.

Our samples below will assume the identity has been passed into the constructor.

Container

Create Container

var cloudFilesProvider = new CloudFilesProvider(cloudIdentity); ObjectStore createContainerResponse = cloudFilesProvider.CreateContainer("Container Name");

Check the createContainerResponse for status ObjectStore.ContainerCreated for container creation.

Here are the ObjectStore values.

Unknown

ContainerCreated

ContainerExists

ContainerDeleted

ContainerNotEmpty

ContainerNotFound

ObjectDeleted

ObjectCreated

ObjectPurged

Files (Objects)

Account