mirror of https://github.com/apache/jclouds.git
api version in properties builder,
more methods in simple client app
This commit is contained in:
parent
159224de89
commit
402ee2adbe
|
@ -23,6 +23,8 @@ import org.jclouds.PropertiesBuilder;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds properties used in Openstack Nova Clients
|
* Builds properties used in Openstack Nova Clients
|
||||||
*
|
*
|
||||||
|
@ -32,6 +34,7 @@ public class NovaPropertiesBuilder extends PropertiesBuilder {
|
||||||
@Override
|
@Override
|
||||||
protected Properties defaultProperties() {
|
protected Properties defaultProperties() {
|
||||||
Properties properties = super.defaultProperties();
|
Properties properties = super.defaultProperties();
|
||||||
|
properties.setProperty(PROPERTY_API_VERSION, "1.0");
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jclouds.openstack.nova;
|
package org.jclouds.openstack.nova;
|
||||||
|
|
||||||
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
|
@ -11,14 +12,23 @@ import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||||
|
|
||||||
public class _NovaClient {
|
public class _NovaClient {
|
||||||
static public void main(String[] args) {
|
static public void main(String[] args) {
|
||||||
|
//curl -v -H "X-Auth-User:admin" -H "X-Auth-Key: d744752f-20d3-4d75-979f-f62f16033b07" http://172.18.34.40:8774/v1.0/
|
||||||
|
//curl -v -H "X-Auth-Token: c97b10659008d5a9ce91462f8c6a5c2c80439762" http://172.18.34.40:8774/v1.0/images/detail?format=json
|
||||||
|
|
||||||
String identity = "admin";
|
String identity = "admin";
|
||||||
String credential = "";
|
String credential = "d744752f-20d3-4d75-979f-f62f16033b07";
|
||||||
String endpoint = "";
|
String endpoint = "http://172.18.34.40:8774";
|
||||||
|
|
||||||
ComputeServiceContextFactory contextFactory = new ComputeServiceContextFactory();
|
ComputeServiceContextFactory contextFactory = new ComputeServiceContextFactory();
|
||||||
|
|
||||||
Properties overrides = new Properties();
|
Properties overrides = new Properties();
|
||||||
overrides.setProperty(PROPERTY_ENDPOINT, endpoint);
|
overrides.setProperty(PROPERTY_ENDPOINT, endpoint);
|
||||||
ComputeServiceContext context = contextFactory.createContext("nova", identity, credential, Collections.singleton(new JschSshClientModule()), overrides);
|
ComputeServiceContext context = contextFactory.createContext("nova", identity, credential, Collections.singleton(new JschSshClientModule()), overrides);
|
||||||
|
|
||||||
|
ComputeService cs = context.getComputeService();
|
||||||
|
System.out.println(cs.listImages());
|
||||||
|
System.out.println(cs.listNodes());
|
||||||
|
System.out.println(cs.listAssignableLocations());
|
||||||
|
System.out.println(cs.listHardwareProfiles());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue