Project

rancher.rb

0.0
No commit activity in last 3 years
No release in over 3 years
Consume the API from Rancher with Ruby!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.7

Runtime

~> 0.8.1
 Project Readme

Rancher.rb

Talk with Rancher from Ruby.

Installation

Add this line to your application's Gemfile:

gem 'rancher.rb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rancher.rb

Configuration

You can globally configure Rancher-rb to alawys use the same project by using the .configure command.

Rancher.configure do |c|
  c.api_endpoint = 'http://localhost:8080/v1/projects/1a5/'
  c.access_key = 'my_access_key_here'
  c.secret_key = 'my_secret_key_here'
end

Finding Resources

Each resource type in the API is available as a member of the Client.

Listing all resources in a collection

hosts = Rancher.host.query();
puts "There are #{hosts.length} hosts:\n";
hosts.each { |host|
  puts host.getName
}

Filtering

Filters allow you to search a collection for resources matching a set of conditions.

http_balancers = Rancher.loadbalancers.query({
  :publicStartPort => 80
})

Getting a single Resource by ID

If you know the ID of the resource you are looking for already, you can also get it directly.

host = Rancher.host.by_id('your-host-id');

ToDo:

  • Write More Tests
  • Ability To Define Custom Classes for specific types

Contributing

  1. Fork it ( https://github.com/jwhitcraft/rancher.rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request