Skip to content

lenovo/xclarity_client

Repository files navigation

Lenovo Xclarity Logo

xclarity_client

Build Status

Ruby gem to interact with Lenovo XClarity.

Installation

Add this line to your application's Gemfile:

gem 'xclarity_client'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install xclarity_client

Usage

To configure your appliance access:

require 'xclarity_client'

conf = XClarityClient::Configuration.new(
  :host             => 'http://lxca_host.com'
  :username         => 'username',
  :password         => 'password',
  :port             => 'lxca_port',
  :auth_type        => 'auth_type',  # ('token', 'basic_auth')
  :verify_ssl       => 'verify_ssl', # ('PEER', 'NONE')
  :user_agent_label => 'user_agent'  # Api gem client identification
)

client = XClarityClient::Client.new(conf)

To access the appliance data:

client.discover_aicc # get AICC informations

client.discover_cabinet # get Cabinets from LXCA appliance

# get the cabinets with the specifieds UUIDs,
# and retrive just `storageList` and `height` attributes.
client.fetch_cabinet(
  uuids = ['590b2546bbbc457f-bf801661018c408e', 'd27e57aa278c49a9b57e34a8e6c6e8ae'],
  include_attributes = ['storageList', 'height']
)

# get the cabinets with the specifieds UUIDs,
# and retrive all attributes except `height`.
client.fetch_cabinet(
  uuids = ['590b2546bbbc457f-bf801661018c408e', 'd27e57aa278c49a9b57e34a8e6c6e8ae'],
  exclude_attributes = ['height']
)

To see how to interact with other LXCA resources, please take a look at lib/xclarity_client/mixins folder.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/lenovo/xclarity_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.