npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chef-api

v0.6.0

Published

A simple chef server api wrapper

Downloads

16

Readme

chef-api

##About

###Description A simple client providing access the chef server api, implemented in nodejs

###Author Norman Joyner - [email protected]

##Getting Started

###Installation npm install chef-api

###Configuration

Simply require the chef-api module, instantiate a new object, and call the .config() method to start accessing the Chef API.

The object passed to the .config() method should be configured as follows:


var options = {
    user_name: "myusername", // (required unless using 'client_name') a chef user
    client_name: "myclientname", // (required unless using 'user_name') a chef client
    key_path: "/Users/myusername/.chef/myusername.pem", // (required unless using 'key') path to private key
    key: "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----", // (required unless using 'key_path') contents of private key
    organization: "myorganization", // (required unless using 'url') organization name for use with hosted chef
    url: "https://mychefserver.com/organizations/SHORT_ORGNAME", // (required unless using 'organization') url for use with local chef server
    ca: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----", // (optional) if this key is omitted, then the default CA chain will be used. If null, the client will operate unsafely and not validate the server's certificate, it set to a certificate list explicitly, that list will be used as the CA chain.
    timeout: 15000 // (optional) request timeout in ms
}

chef.config(options);

You are now free to make API calls.

###Examples

Example usage with hosted chef server, accessing API using a user's pem path:

var ChefApi = require("chef-api");
var chef = new ChefApi();

var options = {
    user_name: "myusername",
    key_path: "/Users/myusername/.chef/myusername.pem",
    organization: "myorganization"
}

chef.config(options);

chef.getNodes(function(err, res){
    if(err)
        throw err;

    console.log(res);
});

Example usage with private chef server, accessing API using a client's pem contents:

var ChefApi = require("chef-api");
var chef = new ChefApi();

var options = {
    client_name: "myclientname",
    key: "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----",
    url: "https://mychefserver.com/organizations/default"
}

chef.config(options);

chef.getNode("mynodes.fqdn", function(err, res){
    if(err)
        throw err;

    console.log(res);
});

###API Methods

chef-api provides a high level abstraction from the Chef Server API. Please consult the official docs at http://docs.chef.io/api_chef_server.html for API specifics.