use of org.jclouds.chef.ChefApiMetadata in project legacy-jclouds-examples by jclouds.
the class MainApp method initChefService.
private static ChefService initChefService(String client, String validator) {
try {
Properties chefConfig = new Properties();
chefConfig.put(ChefProperties.CHEF_VALIDATOR_NAME, validator);
chefConfig.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, credentialForClient(validator));
ContextBuilder builder = //
ContextBuilder.newBuilder(new ChefApiMetadata()).credentials(client, //
credentialForClient(client)).modules(//
ImmutableSet.<Module>of(new SLF4JLoggingModule())).overrides(//
chefConfig);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
ChefContext context = builder.build();
return context.getChefService();
} catch (Exception e) {
System.err.println("error reading private key " + e.getMessage());
System.exit(1);
return null;
}
}
Aggregations