Show available option values in separate section after options display. In cases where Options can be taken from elsewhere in the application, do that instead of hard coding the options. This allows burstable-1 and burstable-2 to show up as VM/PG size options, and show more available VM/PG storage sizes. This doesn't show which storage sizes are valid for a given VM/PG size. That's possible but would clutter the display. Update to a later rodish checkout, which moved some of the features UbiCli uses to plugins, and load those plugins.
34 lines
919 B
Ruby
34 lines
919 B
Ruby
# frozen_string_literal: true
|
|
|
|
UbiCli.on("lb").run_on("show") do
|
|
desc "Show details for a load balancer"
|
|
|
|
fields = %w[id name state location hostname algorithm stack health-check-endpoint health-check-protocol src-port dst-port subnet vms].freeze.each(&:freeze)
|
|
|
|
options("ubi lb (location/lb-name | lb-id) show [options]", key: :lb_show) do
|
|
on("-f", "--fields=fields", "show specific fields (comma separated)")
|
|
end
|
|
help_option_values("Fields:", fields)
|
|
|
|
run do |opts|
|
|
get(lb_path) do |data|
|
|
keys = underscore_keys(check_fields(opts[:lb_show][:fields], fields, "lb show -f option"))
|
|
|
|
body = []
|
|
|
|
keys.each do |key|
|
|
if key == "vms"
|
|
body << "vms:\n"
|
|
data[key].each do |vm_ubid|
|
|
body << " " << vm_ubid << "\n"
|
|
end
|
|
else
|
|
body << key << ": " << data[key].to_s << "\n"
|
|
end
|
|
end
|
|
|
|
body
|
|
end
|
|
end
|
|
end
|