Identity
// V2 authenticationOSClientV2 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 ObjectServer 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 ImageImage 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 PortPort port = os.networking().port() .create(Builders.port() .name("port1") .networkId("networkId") .fixedIp("52.51.1.253", "subnetId") .build());