groupId | artifactId | version |
org.openstack | openstack-java-sdk | 1.0-RC2 |
https://raw.github.com/woorea/maven/master/releases/
You can configure the client in a properties file
verbose=true #for HPCloud #auth.credentials=apiAccessKeyCredentials #auth.accessKey=<your accessKey> #auth.secretKey=<your secretKey> #auth.tenantId=<your tenantId> auth.credentials=passwordCredentials auth.username=demo auth.password=secret0 #auth.tenantId=123456789 auth.tenantName=demo identity.endpoint.publicURL=http://192.168.1.43:5000/v2.0 identity.endpoint.internalURL=http://192.168.1.43:5000/v2.0 identity.endpoint.adminURL=http://192.168.1.43:35357/v2.0 identity.admin.token=secret0 test.glance=false test.swift=false
// X-Auth-Token OpenStackClient openstack = OpenStackClient.authenticate(properties); IdentityAdministrationEndpoint identity = openstack.getIdentityAdministationEndpoint();
//GET tenants available TenantList tenants = identity.tenants().get(); //POST tenant KeystoneTenant kst = new KeystoneTenant(); kst.setName("test"); kst.setDescription("desc"); kst.setEnabled(true); Tenant tenant = identity.tenants().post(kst); //GET tenant tenant = identity.tenants().tenant(tenant.getId()).get(); //DELETE tenant identity.tenants().tenant(tenant.getId()).delete();
UserList users = identity.users().get(); KeystoneUser ksu = new KeystoneUser(); ksu.setName("test"); ksu.setPassword("secret0"); ksu.setEmail("[email protected]"); ksu.setEnabled(true); User user = identity.users().post(ksu); user = identity.users().user(user.getId()).get(); identity.users().user(user.getId()).delete();
RoleList roles = identity.roles().get(); KeystoneRole ksr = new KeystoneRole(); ksr.setName("test"); Role role = identity.roles().post(ksr); role = identity.roles().role(role.getId()).get(); identity.roles().role(role.getId()).delete();
ServiceList services = identity.services().get(); KeystoneService kss = new KeystoneService(); kss.setName("test"); kss.setType("compute"); kss.setDescription("Nova 3.0"); Service service = identity.services().post(kss); service = identity.services().service(service.getId()).get(); identity.services().service(service.getId()).delete();
501 HTTP Error from Keystone Server API
// Authenticate on admin tenant openstack = openstack.reauthenticateOnTenant("admin"); TenantResource compute = openstack.getComputeEndpoint();
ServerList servers = compute.servers().get();
TODO
ImageList images = compute.images().get();
FlavorList flavors = compute.flavors().get();
KeyPairList keypairs = compute.keyPairs().get();
SecurityGroupList securityGroups = compute.securityGroups().get();
VolumeList volumes = compute.volumes().get();
org.openstack.model.images.ImageList gImages = openstack.getImagesEndpoint().get();
List<StorageContainer> sAccount = openstack.getStorageEndpoint().get();
We use maven to build the project. Some helpful maven commands:
mvn eclipse:eclipse
Create the eclipse projects
mvn install
Builds everything, runs unit & integration tests, installs into your maven repo
mvn install -Dmaven.test.skip=true
As above, but without running tests
This software is licensed under the Apache 2 license, quoted below. Copyright 2012 Luis Gervaso and OpenStack Java SDK Copyright 2012 Justin Santa Barbara Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.