lib/aly/app.rb in aly-0.3.2 vs lib/aly/app.rb in aly-0.3.3
- old
+ new
@@ -33,11 +33,24 @@
selected = selected.select do |item|
item.values_at('InstanceId', 'InstanceName', 'PrivateIP', 'PublicIP').compact.any? { |e| query.any? { |q| e.include?(q) } }
end
end
- if options['detail']
+ if options['full']
+ selected = selected.map do |row|
+ {
+ Id: row['InstanceId'],
+ Name: row['InstanceName'],
+ PrivateIP: row['PrivateIP'],
+ PublicIP: row['PublicIP'],
+ CPU: row['Cpu'],
+ RAM: "#{row['Memory'] / 1024.0} GB",
+ WEB: "https://ecs.console.aliyun.com/#/server/#{row['InstanceId']}/monitor?regionId=#{row['RegionId']}"
+ }
+ end
+ puts selected.table&.to_s
+ elsif options['detail']
puts JSON.pretty_generate(selected)
else
selected = selected.map do |row|
{
Id: row['InstanceId'],
@@ -102,10 +115,11 @@
puts([{
Id: lb['LoadBalancerId'],
Name: lb['LoadBalancerName'],
Address: lb['Address'],
Eip: lb['Eip'],
- Listeners: listeners.size
+ Listeners: listeners.size,
+ WEB: "https://slb.console.aliyun.com/slb/#{lb['RegionId']}/slbs/#{lb['LoadBalancerId']}/listeners"
}].table.to_s.gsub(/^/, ' '))
puts
if background_servers && background_servers.size > 0
puts ' Default Backend Servers:'