Class: RightScaleCLI::Instances
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Instances
- Defined in:
- lib/rightscale_cli/instances.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
105 106 107 |
# File 'lib/rightscale_cli/instances.rb', line 105 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#list ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rightscale_cli/instances.rb', line 39 def list() instances = [] filter = [] filter.push("datacenter_href==#{options[:datacenter]}") if [:datacenter] filter.push("deployment_href==#{options[:deployment]}") if [:deployment] filter.push("name==#{options[:private_ip]}") if [:name] filter.push("os_platform==#{options[:os]}") if [:os] filter.push("parent_href==#{options[:parent]}") if [:parent] filter.push("private_dns_name==#{options[:private_dns]}") if [:private_dns] filter.push("private_ip_address==#{options[:private_ip]}") if [:private_ip] filter.push("public_dns==#{options[:public_dns]}") if [:public_dns] filter.push("public_ip_address==#{options[:public_ip]}") if [:public_ip] filter.push("resource_uid==#{options[:resource_uid]}") if [:resource_uid] filter.push("server_template_href==#{options[:server_template]}") if [:server_template] filter.push("state==#{options[:state]}") if [:state] @logger.debug "filter: #{filter}" if [:debug] @client.render(@client.clent.clouds(:id => [:cloud]).show.instances(:filter => filter).index) end |
#run_exec(exec_type, exec_identifier) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rightscale_cli/instances.rb', line 75 def run_exec(exec_type, exec_identifier) params = {} filter = [] if exec_type == 'recipe' params['recipe_name'] = exec_identifier elsif exec_type == 'rightscript' params['right_script_href'] = "/api/right_scripts/#{exec_identifier}" end filter.push("datacenter_href==#{options[:datacenter]}") if [:datacenter] filter.push("deployment_href==#{options[:deployment]}") if [:deployment] filter.push("name==#{options[:private_ip]}") if [:name] filter.push("os_platform==#{options[:os]}") if [:os] filter.push("parent_href==#{options[:parent]}") if [:parent] filter.push("private_dns_name==#{options[:private_dns]}") if [:private_dns] filter.push("private_ip_address==#{options[:private_ip]}") if [:private_ip] filter.push("public_dns==#{options[:public_dns]}") if [:public_dns] filter.push("public_ip_address==#{options[:public_ip]}") if [:public_ip] filter.push("resource_uid==#{options[:resource_uid]}") if [:resource_uid] filter.push("server_template_href==#{options[:server_template]}") if [:server_template] filter.push("state==#{options[:state]}") if [:state] params['filter'] = filter @logger.debug "filter: #{filter}" if [:debug] @logger.debug "params: #{params}" if [:debug] @client.client.clouds(:id => [:cloud]).show.instances.multi_run_executable(params) end |