← Back to team overview

openstack team mailing list archive

Re: Fwd: Documentation for openstack-java-sdk

 

Surely Luis can help you, I've used openstack-java-sdk in one of my
projects, and this is the example Luis gave to me


private static final File TEST_FILE = new File("pom.xml");

 private static final String KEYSTONE_AUTH_URL = "
https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0";;

 private static final String KEYSTONE_USERNAME = "";

 private static final String KEYSTONE_PASSWORD = "";


 /**

 * @param args

 */

public static void main(String[] args) throws Exception {

 KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL);

 //access with unscoped token

 Access access = keystone.execute(Authenticate.withPasswordCredentials(
KEYSTONE_USERNAME, KEYSTONE_PASSWORD));

  //use the token in the following requests

 keystone.setToken(access.getToken().getId());

  Tenants tenants = keystone.execute(new ListTenants());

  //try to exchange token using the first tenant

 if(tenants.getList().size() > 0) {

   access =
keystone.execute(Authenticate.withToken(access.getToken().getId()).withTenantId(tenants.getList().get(0).getId()));

   SwiftClient swiftClient =
newSwiftClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(),
"object-store", null, "public"), access.getToken().getId());

   //swiftClient.execute(new DeleteContainer("navidad2"));

   swiftClient.execute(new CreateContainer("navidad2"));

   System.out.println(swiftClient.execute(new ListContainers()));

   ObjectForUpload upload = new ObjectForUpload();

 upload.setContainer("navidad2");

 upload.setName("example2");

 upload.setInputStream(new FileInputStream(TEST_FILE));

 swiftClient.execute(new UploadObject(upload));

   System.out.println(swiftClient.execute(new ListObjects("navidad2",
new HashMap<String,
String>() {{

  put("path", "");

 }})).get(0).getContentType());

   }


 }



On Thu, Jul 11, 2013 at 11:31 AM, Endre Karlson <endre.karlson@xxxxxxxxx>wrote:

> I think Luis can answer that?
> ---------- Videresendt melding ----------
> Fra: "Jobin Raju George" <jobin.rv@xxxxxxxxx>
> Dato: 11. juli 2013 14:38
> Emne: [Openstack] Documentation for openstack-java-sdk
> Til: "openstack lista" <openstack@xxxxxxxxxxxxxxxxxxx>
> Kopi:
>
> I am trying to query ceilometer using openstack-java-sdk<https://github.com/woorea/openstack-java-sdk>for meters of VM's running on KVM. I am able to get the CPU meters via curl
> on the command line but unfortunately I don't find good documentation for
> the SDK's for ceilometer.
>
> I have seen this example program<https://github.com/woorea/openstack-java-sdk/blob/master/openstack-examples/src/main/java/com/woorea/openstack/examples/metering/v2/TestAll.java> but
> most of it is commented(probably because it is deprecated).
>
> Where can I find good documentation/examples or java programs/snippets?
>
> --
>
>  Thanks and regards,
>
> Jobin Raju George
>
> Third Year, Information Technology
>
> College of Engineering Pune
>
> Alternate e-mail: georgejr10.it@xxxxxxxxxx
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
*guilherme* \n
\t *maluf*

Follow ups

References