class RightScaleCLI::ServerArrays
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/rightscale_cli/server_arrays.rb, line 31 def initialize(*args) super @client = RightScaleCLI::Client.new(options) @logger = RightScaleCLI::Logger.new() end
Public Instance Methods
alert_specs(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays/alert_specs.rb, line 22 def alert_specs(server_array_id) alert_specs = [] @client.client.server_arrays(:id => server_array_id).show.alert_specs.index.each { |alert_spec| alert_specs.push(alert_spec.raw) } @client.render(alert_specs, 'server_array') end
alerts(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays/alerts.rb, line 22 def alerts(server_array_id) @client.render(@client.client.server_arrays(:id => server_array_id).show.alerts.index, 'alert_specs') end
api_methods(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 90 def api_methods(server_array_id) @logger.info "Retrieving API methods for server array, #{server_array_id}." puts @client.client.server_arrays(:id => server_array_id).show.api_methods end
desc(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 78 def desc(server_array_id) @logger.info "Retrieving description for server array, #{server_array_id}." puts @client.client.server_arrays(:id => server_array_id).show.description end
inputs(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 96 def inputs(server_array_id) @client.render(@client.show('server_arrays', server_array_id), 'server_array') end
instances(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays/current_instances.rb, line 37 def instances(server_array_id) filter = [] filter.push("datacenter_href==#{options[:datacenter]}") if options[:datacenter] filter.push("deployment_href==#{options[:deployment]}") if options[:deployment] filter.push("name==#{options[:private_ip]}") if options[:name] filter.push("os_platform==#{options[:os]}") if options[:os] filter.push("parent_href==#{options[:parent]}") if options[:parent] filter.push("private_dns_name==#{options[:private_dns]}") if options[:private_dns] filter.push("private_ip_address==#{options[:private_ip]}") if options[:private_ip] filter.push("public_dns==#{options[:public_dns]}") if options[:public_dns] filter.push("public_ip_address==#{options[:public_ip]}") if options[:public_ip] filter.push("resource_uid==#{options[:resource_uid]}") if options[:resource_uid] filter.push("server_template_href==#{options[:server_template]}") if options[:server_template] filter.push("state==#{options[:state]}") if options[:state] @logger.debug "filter: #{filter}" if options[:debug] array_instances = [] @client.client.server_arrays(:id => server_array_id).show.current_instances(:filter => filter).index.each { |array_instance| array_instances.push(array_instance.raw) } @client.render(array_instances, 'array_instances') end
instances_count(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 72 def instances_count(server_array_id) @logger.info "Retrieving instances count for server array, #{server_array_id}." puts @client.client.server_arrays(:id => server_array_id).show.instances_count end
links(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays/links.rb, line 31 def links(server_array_id) @logger.info "Retrieving links for server array, #{server_array_id}." @client.render(@client.client.server_arrays(:id => server_array_id).show.links, 'links') end
list()
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 44 def list() filter = [] filter.push("cloud_href==/api/clouds/#{options[:cloud]}") if options[:cloud] filter.push("deployment_href==/api/deployments/#{options[:cloud]}") if options[:deployment] filter.push("name==#{options[:name]}") if options[:name] @logger.debug "filter: #{filter}" if options[:debug] server_arrays = [] @client.client.server_arrays.index(:filter => filter).each { |server_array| server_arrays.push(server_array.raw) } @client.render(server_arrays, 'server_arrays') end
name(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 84 def name(server_array_id) @logger.info "Retrieving name for server array, #{server_array_id}." puts @client.client.server_arrays(:id => server_array_id).show.name end
next(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 101 def next(server_array_id) @client.render(@client.client.server_arrays(:id => server_array_id).show.next_instance.index) end
params(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays/elasticity_params.rb, line 22 def params(server_array_id) @logger.info "Retrieving elasticity parameters for server array, #{server_array_id}." @client.render(@client.client.server_arrays(:id => server_array_id).show.elasticity_params, 'server_array') end
run_exec(server_array_id, exec_type, exec_identifier)
click to toggle source
# File lib/rightscale_cli/server_arrays/multi_run_executable.rb, line 22 def run_exec(server_array_id, exec_type, exec_identifier) params = {} if exec_type == 'recipe' params['recipe_name'] = exec_identifier elsif exec_type == 'rightscript' params['right_script_href'] = "/api/right_scripts/#{exec_identifier}" end server_array = @client.client.server_arrays(:id => server_array_id) @logger.info "params: #{params}" if options[:debug] @logger.info "Running executable on server array." server_array.multi_run_executable(params) end
show(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 61 def show(server_array_id) @client.render(@client.show('server_arrays', server_array_id), 'server_array') end
state(server_array_id)
click to toggle source
# File lib/rightscale_cli/server_arrays.rb, line 66 def state(server_array_id) @logger.info "Retrieving state for server array, #{server_array_id}." puts @client.client.server_arrays(:id => server_array_id).show.state end