use of org.jclouds.compute.ComputeServiceContext in project legacy-jclouds-examples by jclouds.
the class CreateServer method init.
private void init(String[] args) {
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";
String username = args[0];
String apiKey = args[1];
// These properties control how often jclouds polls for a status udpate
Properties overrides = new Properties();
overrides.setProperty(ComputeServiceProperties.POLL_INITIAL_PERIOD, Constants.POLL_PERIOD_TWENTY_SECONDS);
overrides.setProperty(ComputeServiceProperties.POLL_MAX_PERIOD, Constants.POLL_PERIOD_TWENTY_SECONDS);
ComputeServiceContext context = ContextBuilder.newBuilder(provider).credentials(username, apiKey).overrides(overrides).buildView(ComputeServiceContext.class);
compute = context.getComputeService();
}
use of org.jclouds.compute.ComputeServiceContext in project legacy-jclouds-examples by jclouds.
the class DeleteServer method init.
private void init(String[] args) {
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";
String username = args[0];
String apiKey = args[1];
// These properties control how often jclouds polls for a status udpate
Properties overrides = new Properties();
overrides.setProperty(ComputeServiceProperties.POLL_INITIAL_PERIOD, Constants.POLL_PERIOD_TWENTY_SECONDS);
overrides.setProperty(ComputeServiceProperties.POLL_MAX_PERIOD, Constants.POLL_PERIOD_TWENTY_SECONDS);
ComputeServiceContext context = ContextBuilder.newBuilder(provider).credentials(username, apiKey).overrides(overrides).buildView(ComputeServiceContext.class);
compute = context.getComputeService();
}
use of org.jclouds.compute.ComputeServiceContext in project legacy-jclouds-examples by jclouds.
the class ServerMetadata method init.
private void init(String[] args) {
// The provider configures jclouds To use the Rackspace Cloud (US)
// To use the Rackspace Cloud (UK) set the provider to "rackspace-cloudservers-uk"
String provider = "rackspace-cloudservers-us";
String username = args[0];
String apiKey = args[1];
ComputeServiceContext context = ContextBuilder.newBuilder(provider).credentials(username, apiKey).buildView(ComputeServiceContext.class);
compute = context.getComputeService();
nova = context.unwrap();
serverApi = nova.getApi().getServerApiForZone(Constants.ZONE);
}
Aggregations