Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

abiquo-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abiquo-api


Version published
Maintainers
1
Created
Source

Abiquo API client for Ruby

Basic API browsing and raw object manipulation for Ruby.

Installation

To get the client installed just issue:

gem install abiquo-api

Or if you are using a Gemfile, add:

gem 'abiquo-api'

An example usage would be:

require 'abiquo-api'

a = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api', 
                  :abiquo_username => "admin", 
                  :abiquo_password => "xabiquo")

Or, if you want to force a specific API version:

require 'abiquo-api'

abq = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api', 
                    :abiquo_username => "admin", 
                    :abiquo_password => "xabiquo",
                    :version => "2.9")

You can also define some connection parameters that will be applied to the underlying Faraday HTTP connection:

require 'abiquo-api'

abq = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api',
                    :abiquo_username => "admin",
                    :abiquo_password => "xabiquo",
                    :connection_options => {
                      :ssl => {
                        :verify => false
                      }
                    })

Or, you can also use OAuth credentials:

require 'abiquo-api'

abq = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api',
                    :abiquo_api_key => "somekey",
                    :abiquo_api_secret => "somesecret",
                    :abiquo_token_key => "sometoken",
                    :abiquo_token_secret => "sometokensecret",
                    :connection_options => {
                      :ssl => {
                        :verify => false
                      }
                    })

Then you can start browsing the API:

l = AbiquoAPI::Link.new(:href => 'cloud/virtualdatacenters', 
                        :type => 'application/vnd.abiquo.virtualdatacenters+json',
                        :client => abq)

l.get

Client object

The client object contains 2 methods that allow API browsing.

  • login Makes the login API call, returning the current user information. From there you can navigate to related objects.
  • properties Makes the config/properties call and returns a hash containing all the system properties in the system. Useful to get default values for some objects (ie. VLAN parameters in VDC creation).

Represents an Abiquo API Link. Issuing get on them will retrieve link destination. This allows for things like:

vapp = vdc.link(:virtualappliances).get.first

Generic model object

This is used to map Abiquo API objects.

Generic list

This is used to iterate over paginated lists.

Examples

Browse the API

Initialize connection
a = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api', 
                  :abiquo_username => "admin", 
                  :abiquo_password => "xabiquo")
Login call

Is the User object returned by the API at login. You can browse the links provided like:

user = a.login

vm = user.link(:virtualmachines).get.first

vm.name
=> "ABQ_6b6d9856-c05f-425e-8916-1ff7de1683e3"

vm.id
=> 18

Create a VDC using an existing one as reference

Initialize connection
a = AbiquoAPI.new(:abiquo_api_url => 'https://10.60.13.40/api', 
                  :abiquo_username => "admin", 
                  :abiquo_password => "xabiquo")
l = AbiquoAPI::Link.new(:href => '/api/cloud/virtualdatacenters', 
                        :type => 'application/vnd.abiquo.virtualdatacenters+json',
                        :client => a)
v = l.get.first
Create a new object
v1 = a.new_object(:name => "vdctest", 
                  :hypervisorType => "VMX_04", 
                  :vlan => v.vlan, 
                  :links => [v.link(:location), a.enterprise])
v1.vlan.delete("links")
v1.vlan.delete("id")
v1.vlan.delete("tag")
Create a link where to post data
l1 = AbiquoAPI::Link.new(:href => '/api/cloud/virtualdatacenters', 
                         :type => 'application/vnd.abiquo.virtualdatacenter+json')
Post data
v2 = a.post(l1, v1)
Modify the created object
v2.name = "SomeValue"
v2 = a.put(v2.edit, v2)

Or:

v2.name = "SomeValue"
v2.update
Delete it
a.delete(v2.edit)

Or:

v2.delete

FAQs

Package last updated on 06 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc