Take Control of Your Cloud
OpenStack4j is an open source OpenStack client which allows provisioning and control of an OpenStack system.
Growing User Community
And More!
100% Fluent API
Identity
// V2 authentication
OSClientV2 os = OSFactory.builderV2()
.endpoint("http://127.0.0.1:5000/v2.0")
.credentials("admin", "secret")
.tenantName("admin")
.authenticate();
// V3 authentication
OSClientV3 os = OSFactory.builderV3()
.endpoint("http://127.0.0.1:5000/v3")
.credentials("admin", "secret", Identifier.byName("Default"))
.scopeToProject(Identifier.byName("admin"))
.authenticate();
Compute
// Create a Server Model Object
Server server = Builders.server()
.name("Ubuntu 2")
.flavor("large")
.image("imageId")
.build();
// Boot the Server
Server server = os.compute().servers().boot(server);
// Create a Snapshot
os.compute().servers().createSnapshot("id", "name");
Image
// Create an Image
Image image = os.images().create(Builders.image()
.name("Cirros 0.3.0 x64")
.isPublic(true)
.containerFormat(ContainerFormat.BARE)
.diskFormat(DiskFormat.QCOW2)
.build()
), Payloads.create(new File("cirros.img")));
Network
// Create a Port
Port port = os.networking().port()
.create(Builders.port()
.name("port1")
.networkId("networkId")
.fixedIp("52.51.1.253", "subnetId")
.build());