Created
October 10, 2012 01:20
-
-
Save etoews/3862575 to your computer and use it in GitHub Desktop.
jclouds workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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