use of org.jclouds.ssh.jsch.config.JschSshClientModule in project whirr by apache.
the class ComputeServiceContextBuilder method build.
public static ComputeServiceContext build(ClusterSpec spec) throws IOException {
Set<AbstractModule> wiring = ImmutableSet.of(new JschSshClientModule(), new Log4JLoggingModule());
ComputeServiceContext context = new ComputeServiceContextFactory().createContext(spec.getProvider(), spec.getIdentity(), spec.getCredential(), wiring);
return context;
}
use of org.jclouds.ssh.jsch.config.JschSshClientModule in project SimianArmy by Netflix.
the class AWSClient method getJcloudsComputeService.
/**
* {@inheritDoc}
*/
@Override
public ComputeService getJcloudsComputeService() {
if (jcloudsComputeService == null) {
synchronized (this) {
if (jcloudsComputeService == null) {
AWSCredentials awsCredentials = awsCredentialsProvider.getCredentials();
String username = awsCredentials.getAWSAccessKeyId();
String password = awsCredentials.getAWSSecretKey();
Credentials credentials;
if (awsCredentials instanceof AWSSessionCredentials) {
AWSSessionCredentials awsSessionCredentials = (AWSSessionCredentials) awsCredentials;
credentials = SessionCredentials.builder().accessKeyId(username).secretAccessKey(password).sessionToken(awsSessionCredentials.getSessionToken()).build();
} else {
credentials = new Credentials(username, password);
}
ComputeServiceContext jcloudsContext = ContextBuilder.newBuilder("aws-ec2").credentialsSupplier(Suppliers.ofInstance(credentials)).modules(ImmutableSet.<Module>of(new SLF4JLoggingModule(), new JschSshClientModule())).buildView(ComputeServiceContext.class);
this.jcloudsComputeService = jcloudsContext.getComputeService();
}
}
}
return jcloudsComputeService;
}
Aggregations