Coder Social home page Coder Social logo

webee's Introduction

Installation

gem install webee

Usage

$: << '../lib'
require 'webee'
require 'md5'

WeBee::Api.user = ENV['user'] || 'admin'
WeBee::Api.password = ENV['pass'] || 'xabiquo'
WeBee::Api.url = 'http://abiquo/api'

#
# List all datacenters available
# 
WeBee::Datacenter.all.each do |dc|
  puts dc.name
end


# 
# Return the first datacenter whose name matches BCN (matched via Regexp)
#
dc = WeBee::Datacenter.find_by_name('BCN').first
puts dc.name

#
# List Datacenter Racks
#
dc.racks.each do |r|
  puts r.name
end

#
# List all the enterprises
#
WeBee::Enterprise.all.each do |e|
  puts e.name
end

#
# Find an enterprise named QA
#
qa_ent = WeBee::Enterprise.find_by_name('QA')

#
# List enterprise 'QA' users
#
qa_ent.users.each do |u|
  puts u.name
end


#
# Create a new user in QA enterprise
# 
user = qa_ent.create_user :name => 'Sergio Rubio',
                   :role => WeBee::UserRole.cloud_admin,
                   :password => MD5.hexdigest('rubiojr'),
                   :surname => 'rubiojr', #optional
                   :email => '[email protected]',
                   :locale => 'en_US',
                   :nick => 'rubiojr',
                   :active => 'true'  #optional

# delete the user
user.delete

#
# Create a new datacenter
# FIXME: not implemented in WeBee
#
# WeBee::Datacenter.create :name => 'Test DC'

#
# List WeBee::OVFPackage available in enterprise QA
#
qa_ent.ovf_packages.each do |pkg|
  puts "#{pkg.product_name} (#{pkg.category_name})"
end

#
# Create a new Rack
#
dc = WeBee::Datacenter.find_by_name('BCN').first
rack = WeBee::Rack.create dc.datacenter_id,
                          :name => 'rack_1',
                          :ha_enabled => false,
                          :vlan_min_id => 100,
                          :vlan_max_id => 2048,
                          :vlan_per_vdc_expected => 6,
                          :nrsq => 80

#
# Delete the rack
# FIXME: Not supported in Abiquo right now
#
#rack.delete

More examples can be found in the examples folder

webee's People

Contributors

rubiojr avatar

Stargazers

Salvador Girones Gil avatar Daniel Barber avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

sgirones

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.