Skip to content

Instantly share code, notes, and snippets.

@etoews
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etoews/9129de9c83fefd721316 to your computer and use it in GitHub Desktop.
Save etoews/9129de9c83fefd721316 to your computer and use it in GitHub Desktop.
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
import org.jclouds.ContextBuilder;
import org.jclouds.blobstore.BlobStore;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext;
import org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
Iterable<Module> modules = ImmutableSet.<Module>of(
new SLF4JLoggingModule());
ContextBuilder builder = ContextBuilder.newBuilder("rackspace-cloudfiles-uk")
.modules(modules)
.endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/")
.credentials("uk_username", "uk_apikey");
BlobStore blobStore = builder.buildView(RegionScopedBlobStoreContext.class).blobStoreInRegion("LON");
CloudFilesApi cloudFilesApi = blobStore.getContext().unwrapApi(CloudFilesApi.class);
System.out.println("cloudFilesApi.getConfiguredRegions() = " + cloudFilesApi.getConfiguredRegions());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment