By Daniel DeGroff

Technology

October 11, 2016 Tweet

At Inversoft, we like open source and we like Java.

When we built out our platform to support our new cloud product offerings we started using Chef to help us manage our deployment strategy.

While a well documented and easy to use RESTful API over HTTP is great, that same API provided with native bindings is awesome. Native APIs save developers a lot of hours of reading through documentation and building their own domain object and REST bindings. We use a number of native APIs for services like Stripe and Intuit and provide a native bindings for Passport in Java, PHP, JavaScript, Python and C#.

When we began working on some new backend features for our cloud product offerings, I set out to find a Chef Client written in Java in order to simplify our integration.

As luck wouldn’t have it (yes you read that correctly), I was unable to find a Java library that really made my life easier. There are other Chef libraries out there, but all of them were very lightweight wrappers around HTTP calls. Some went so far as to return the JSON response from the Chef server as a String rather than right POJO.

Rather than limping along with a library that was essentially a glorified URLConnection, I did what any software engineer would do, I wrote it myself.

Behold Barista! A native binding for Chef that provides rich domain objects and REST bindings to work with a Chef server.

https://github.com/inversoft/barista

Building a properly authenticated HTTP request to Chef is not great fun, so I don’t suggest you do it yourself unless you enjoy the pain. We’ve done the heavy lifting for you and we did this without using any third party encryption libraries. This means you can pick up this library without dragging along any unnecessary dependencies like Bouncycastle.

I’ve only coded the methods I’ve needed thus far, but the pattern should be easy to follow for additional API calls. Feel free to open an issue if you’d like a specific API or submit a pull request.

We love writing great software for developers, so if you’re using it - let us know how we can make it better.

This client follows the pattern of our other client libraries using our REST client library Restify (https://github.com/inversoft/restify). Restify makes writing a client library around a REST API really easy.