Giter VIP home page Giter VIP logo

squall's Introduction

Squall Squall Build Status

A Ruby library for working with the OnApp REST API.

Squall has been tested on MRI versions 1.9.3, 2.0.0, 2.1.2 and 1.9-compatible JRuby.

Documentation is available in TomDoc format.

Install

To install Squall using Bundler:

echo "gem 'squall'" >> Gemfile
bundle install

To install Squall globally using RubyGems:

gem install squall

Configuration

You have two main options for configuring Squall.

Directly in a config block:

require 'squall'

Squall.config do |c|
  c.base_uri 'https://onappurl.com' # Root level URI for OnApp instance
  c.username 'username'             # OnApp username
  c.password 'topsecret'            # OnApp password
  c.debug     true                  # Toggle HTTP/Faraday debugging (prints to $stderr)
end

Squall can load configuration from a yaml file:

# .squall.yml
base_uri: 'https://onappurl.com'
username: 'username'
password: 'topsecret'
debug: false

To load it (by default it assumes ~/.squall.yml):

Squall.config_file("/path/to/.squall.yml")

It is also possible to change individual configuration settings on the fly.

Squall.configuration.debug(true)

Note: you will need to re-instantiate all modules after changing Squall's configuration.

Usage

Show the info for a VM:

vm = Squall::VirtualMachine.new
vm.show 1

Create a new VM:

vm = Squall::VirtualMachine.new

params = {
  label:             'testmachine',
  hypervisor_id:     5,
  hostname:          'testmachine',
  memory:            512,
  cpus:              1,
  cpu_shares:        10,
  primary_disk_size: 10,
  template_id:       1
}

vm.create params

Supported Methods

This gem partially implements the OnApp API v2.3.

The following OnApp modules have been added:

  • Data store zones
  • Firewall rules
  • Hypervisors
  • Hypervisor zones
  • IP addresses
  • IP address joins
  • Networks
  • Network zones
  • Users
  • User groups
  • Roles
  • Statistics
  • Templates
  • Transactions
  • Virtual machines
  • Whitelists
  • Disks

The following still need to be added:

  • Billing plans
  • Currencies
  • Network interfaces
  • Template groups
  • Software licenses
  • Resolvers
  • VM autoscaling
  • Load Balancers
  • CDN edge servers
  • CDN resources
  • CDN edge groups
  • Backups
  • Autobackup Presets
  • Schedules
  • SSH keys
  • Alerts
  • Logs
  • System configuration

Tests

Squall uses rspec for tests. To run:

bundle exec rake # Runs all tests
bundle exec rspec spec/squall/[module]_spec.rb # Runs tests for a specific module

Squall uses VCR to cache server responses to test against. To test via live http connections, pass RERECORD=1 into test command. NOTE: since OnApp does not currently support a test environment this is not recommended unless you know what you're doing, as it will destroy live data!

Known issues:

  1. VirtualMachine#change_user currently breaks the parser on an invalid user_id because OnApp returns html instead of JSON
  2. VirtualMachine#create is currently broken in certain cases.
  3. FirewallRule#edit and #create break the parser by returning invalid JSON

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2010-2014 Site5.com. See LICENSE for details.

squall's People

Contributors

tfwright avatar jmazzi avatar itspriddle avatar fabiokr avatar boone avatar rubemz avatar vtg avatar mzahir avatar

Watchers

James Cloos avatar karlitxo avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.