Barista - Chef Java Client ![semver 2.0.0 compliant](https://camo.githubusercontent.com/b0abfeaa33867c8b40418f3f6dab4fbad18f0055981a2f6cba36d971942c9325/687474703a2f2f696d672e736869656c64732e696f2f62616467652f73656d7665722d322e302e302d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)
Java 8 Chef Java Client written using Restify REST Client
I've only added methods that I'm using, open an issue if you'd like a method added, or feel free to submit a pull request, the pattern should be very easy to follow.
Code Examples
// Construct a new Chef Client
ChefClient client = new ChefClient(
"vandelay", // userId used in header X-Ops-UserId
"https://chef.acme.com", // Server URL
"vandelayIndustries", // Organization Name
"/usr/local/acme/vandelay.pem"); // Path to PEM file
// Delete a Node by Name
ClientResponse<Void, Void> response = client.deleteNode("node-name");
// Delete a Client by Name
ClientResponse<Void, Void> response = client.deleteClient("client-name");
// Retrieve All Nodes
ClientResponse<Nodes, Void> response = client.retrieveNodes();
// Retrieve a Node by Name, print the node name if successful, else print the status code.
ClientResponse<Node, Void> response = client.retrieveNode("fooBar");
if (response.wasSuccessful()) {
System.out.println(response.successResponse.name); // --> fooBar
} else {
System.out.println("Request failed. Status code : [" + response.status + "]");
}
Download from Maven
<dependency>
<groupId>com.inversoft</groupId>
<artifactId>barista</artifactId>
<version>1.0.0</version>
</dependency>
Building in Maven
$ mvn install
Building in Savant
Note: This project uses the Savant build tool. To compile using using Savant, follow these instructions:
$ mkdir ~/savant
$ cd ~/savant
$ wget http://savant.inversoft.org/org/savantbuild/savant-core/1.0.0/savant-1.0.0.tar.gz
$ tar xvfz savant-1.0.0.tar.gz
$ ln -s ./savant-1.0.0 current
$ export PATH=$PATH:~/savant/current/bin/
Then, perform an integration build of the project by running:
$ sb int
Downloading from Savant
Released versions can be downloaded from the Savant Repository.
For more information, checkout savantbuild.org.