class CloudControl::Client

Constants

API_URL
IMAGES

Attributes

account[R]
api_base[R]

include CloudControl::XML

colors[RW]
FILTERS

client.page_size = 10 client.page_number = 1 client.order_by = 'location,created.DESCENDING' client.filter_with = {location: %w(NA1 NA2), key: 'value'}

datacenter[R]
default_password[R]
filter_with[RW]
image[R]
network[R]
order_by[RW]
org_id[R]

include CloudControl::XML

page_number[RW]
page_size[RW]
password[R]

include CloudControl::XML

report[R]
server[R]
silent[RW]
FILTERS

client.page_size = 10 client.page_number = 1 client.order_by = 'location,created.DESCENDING' client.filter_with = {location: %w(NA1 NA2), key: 'value'}

username[R]

include CloudControl::XML

Public Class Methods

new(api_base, org_id, username, password, colors = true, silent = true) click to toggle source
# File lib/cloudcontrol/client.rb, line 27
def initialize(api_base, org_id, username, password, colors = true, silent = true)
  @api_base = api_base
  @org_id       = org_id
  @username     = username
  @password     = password
  @colors = colors
  @silent = silent

  if @colors
    require 'colorize'
  end
end

Public Instance Methods

filter_params() click to toggle source
# File lib/cloudcontrol/client.rb, line 68
def filter_params
  params = {}
  params[:page_size] = @page_size if @page_size.present?
  params[:page_number] = @page_number if @page_number.present?
  params[:order_by] = @order_by if @order_by.present?

  if @filter_with.present?
    @filter_with.each do |k, val|
      params[k.to_sym] = val
    end
  end
  params
end
log(message, color = nil, mode = nil, error=nil) click to toggle source
# File lib/cloudcontrol/client.rb, line 86
def log(message, color = nil, mode = nil, error=nil)
  return if (@silent && (not error))
  if @colors
    color = color.to_sym if color
    mode = mode.to_sym if mode
    puts message.colorize(:color => color, :mode => mode)
  else
    puts message
  end
end
log_error(message, color=nil, mode=nil) click to toggle source

mode: bold, underscore, default

# File lib/cloudcontrol/client.rb, line 83
def log_error(message, color=nil, mode=nil)
    log message, color, mode, true
end
vip() click to toggle source
# File lib/cloudcontrol/client.rb, line 64
def vip
  CloudControl::API::VIP.new(self)
end