Talk with Rancher from Ruby.
Add this line to your application's Gemfile:
gem 'rancher.rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rancher.rb
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
Each resource type in the API is available as a member of the Client.
hosts = Rancher.host.query();
puts "There are #{hosts.length} hosts:\n";
hosts.each { |host|
puts host.getName
}
Filters allow you to search a collection for resources matching a set of conditions.
http_balancers = Rancher.loadbalancers.query({
:publicStartPort => 80
})
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');
- Write More Tests
- Ability To Define Custom Classes for specific types
- Fork it ( https://github.com/jwhitcraft/rancher.rb/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request