Skip to content

Instantly share code, notes, and snippets.

@etoews
Created October 10, 2012 01:20
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/3862575 to your computer and use it in GitHub Desktop.
Save etoews/3862575 to your computer and use it in GitHub Desktop.
jclouds workshop
private void init() {
Iterable<Module> modules = ImmutableSet.<Module> of(
new SshjSshClientModule(),
new SLF4JLoggingModule());
Properties overrides = new Properties();
overrides.setProperty(ComputeServiceProperties.POLL_INITIAL_PERIOD, "30000");
overrides.setProperty(ComputeServiceProperties.POLL_MAX_PERIOD, "30000");
String myHpTenantName = "";
String myHpUsername = "";
String myHpPassword = "";
if (!myHpTenantName.equals("") && !myHpUsername.equals("") && !myHpPassword.equals("")) {
ComputeServiceContext context = ContextBuilder.newBuilder("hpcloud-compute")
.credentials(myHpTenantName + ":" + myHpUsername, myHpPassword)
.modules(modules)
.overrides(overrides)
.buildView(ComputeServiceContext.class);
computeServices.add(context.getComputeService());
}
String myRaxUsername = "";
String myRaxPassword = "";
overrides.setProperty(KeystoneProperties.CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS);
ComputeServiceContext context = ContextBuilder.newBuilder("rackspace-cloudservers-us")
.credentials(myRaxUsername, myRaxPassword)
.modules(modules)
.overrides(overrides)
.buildView(ComputeServiceContext.class);
computeServices.add(context.getComputeService());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment