Silverline API Gem

Ruby wrapper for the Librato Silverline API.

Installation

sudo gem install librato_silverline_api

Description

This gem conists of three classes: Template, Container and Axis. The interaction with the API happens exclusively through the Template class. It offers very basic Active Resource methods to find, create, save and update templates. Templates contains Containers and they again contain Axes.

Example Usage

# Configure API Access
SilverlineAPI.username = "[email protected]"
SilverlineAPI.key = "YOUR_API_TOKEN"

# Retrieve Templates
templates = SilverlineAPI::Templates.find(:all) # returns a maximum of 100 templates

templates = SilverlineAPI::Templates.find(:all, :length => 10, :offset => 20) # returns the 3rd page and contains 10 templates

templates = SilverlineAPI::Templates.find(:all, :name => "foo") # returns a maximum of 100 templates which partially match the name

SilverlineAPI.last_response # holds the information of the last response, e.g. the amount of templates, pagination and search detail, etc.

# create a template with the default containers
template = SilverlineAPI::Template.new(:name => "foo", :min_cpu => 200, :min_mem => 128)
template.save # saves the newly created template

# add a special container
container = SilverlineAPI::Container.new(:name => "bar", :cpu => {:allocation => 40}, :mem => {:allocation => 64, :max => 64})
template.containers.push(container)
template.save

Copyright (c) 2011 Librato Inc.. See LICENSE for details.