class DDcloud::Client
Constants
- API_URL
- IMAGES
Attributes
account[R]
api_base[R]
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]
directory[R]
filter_with[RW]
image[R]
network[R]
order_by[RW]
org_id[R]
page_number[RW]
page_size[RW]
password[R]
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]
Public Class Methods
new(api_base, org_id, username, password, default_password="verysecurepassword", datacenter="EU1", colors = true, silent = true)
click to toggle source
# File lib/ddcloud/client.rb, line 23 def initialize(api_base, org_id, username, password, default_password="verysecurepassword", datacenter="EU1", colors = true, silent = true) @api_base = api_base @org_id = org_id @username = username @password = password @datacenter = datacenter @default_password = default_password @colors = colors @silent = silent if @colors require 'colorize' end end
Public Instance Methods
filter_params()
click to toggle source
# File lib/ddcloud/client.rb, line 67 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/ddcloud/client.rb, line 85 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/ddcloud/client.rb, line 82 def log_error(message, color=nil, mode=nil) log message, color, mode, true end
vip()
click to toggle source
# File lib/ddcloud/client.rb, line 63 def vip DDcloud::API::VIP.new(self) end